User Tag List

Results 1 to 10 of 10

Thread: array checking inconsistent?

  1. #1
    Clicker Fusion 2.5 Developer

    Join Date
    Jan 2013
    Posts
    36
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    array checking inconsistent?

    right now i have some objects linked by comparing fixed values stored in an array table which has been working just fine, the values written in on creation. each object uses an alterable value to store the Y position of where all their data is in the array, each X field having certain details regarding the entire linked set. it all works fine but when i try to write something new in later on outside object creation, such as a fixed value of an object one of them collides with, i cannot properly do a comparison with the value period by searching the array at the spot where it wrote to.

    i am not sure why this is inconsistent and works with some things, but data written in later does absolutely nothing.

  2. #2
    Clicker

    Fusion 2.5 DeveloperFusion 2.5+ DLCAndroid Export ModuleSWF Export Module
    Konidias's Avatar
    Join Date
    Aug 2009
    Posts
    1,546
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)
    I think this might just be user error.

    In a start of frame condition, add the array object to debugger... then in your game, you can look in the array and go to the array dimensions you're having problems with and see what value is being stored there. My guess is that nothing is being stored, meaning that you are goofing it up somewhere... (possibly you are trying to read/write from dimensions outside the array's limit, or some condition is causing the values to not write at all, etc)

    I'm not sure how much experience you have with arrays, but I just wanted to make sure that you know you can only store up to 10 values per array dimension unless you actually change the size. A default array is sized X10,Y10,Z1... So if you're trying to write to X20 or something, it isn't going to work.

  3. #3
    Clicker Fusion 2.5 DeveloperFusion 2.5+ DLCAndroid Export ModuleiOS Export ModuleSWF Export Module
    Skyhunter's Avatar
    Join Date
    Jan 2007
    Location
    Croatia
    Posts
    451
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Actually you can write outside the dimension, the mmf2 default array object expands when writing outside range.
    But the arrays are always consistent unless you messed up something in your code.

  4. #4
    Clicker Fusion 2.5 Developer

    Join Date
    Jan 2013
    Posts
    36
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    in specific, i have already maybe 30 events where it's using compare two general values to compare the x and y value (the y value being an alterable value of an object) to a fixed object and have it work, successfully being able to compare between two specific instances of an object. i have a foreach loop checking collisions so proper specific values and be shared, and the array is written into during this. it's written in fine, if i have a counter display that value on screen it shows the proper fixed value fine, but i cannot do a compare two general values to specifically get it.

  5. #5
    Clicker

    Fusion 2.5 DeveloperFusion 2.5+ DLCAndroid Export ModuleSWF Export Module
    Konidias's Avatar
    Join Date
    Aug 2009
    Posts
    1,546
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)
    I think you're going to have to post your MFA here. It's going to be too confusing to figure out just what part is not working and why.

  6. #6
    Clicker Fusion 2.5 Developer

    Join Date
    Jan 2013
    Posts
    36
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    here is an example showing how it's not handling it properly. pressing ctrl will make a little red hitbox appear and if it overlaps someone else it writes their fixed value into the array table, and it does that part just fine. for some reason though actually checking its value in the array is NOT working properly.

    examplearray.mfa

  7. #7
    Clicker Fusion 2.5 Developer

    Join Date
    Jul 2008
    Posts
    1,299
    Mentioned
    11 Post(s)
    Tagged
    0 Thread(s)
    For one thing, you're comparing the array value to the object's fixed value, not the other way around, so obviously that isn't going to work.
    For another, you have two members of group.bullets, but don't specify which one you want to get Alterable Value A from when you use it as the array's Y index - by default, MMF2 uses the most recently created one, which happens to not be the one you want it to use in this case (this is easily demonstrated by replacing Alt Val A in line #9 with the value "1").
    A simple fix would be to put line #9 in a ForEach loop (for group.bullet), and swap the fixed value and array value in the condition.

  8. #8
    Clicker Fusion 2.5 Developer

    Join Date
    Jan 2013
    Posts
    36
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by MuddyMole View Post
    For one thing, you're comparing the array value to the object's fixed value, not the other way around, so obviously that isn't going to work.
    For another, you have two members of group.bullets, but don't specify which one you want to get Alterable Value A from when you use it as the array's Y index - by default, MMF2 uses the most recently created one, which happens to not be the one you want it to use in this case (this is easily demonstrated by replacing Alt Val A in line #9 with the value "1").
    A simple fix would be to put line #9 in a ForEach loop (for group.bullet), and swap the fixed value and array value in the condition.
    the reason i am storing any of this in an array to begin with is to avoid as many loops as possible which is why i do not want to use foreach loops to constantly do a comparison like you are saying i should do to line 9. there's a lot going on in the full project and even adding a foreach loop based event in there ends up slowing it down significantly. this collision type here is one of the only ones i intend on doing.

  9. #9
    Clicker Fusion 2.5 Developer

    Join Date
    Jul 2008
    Posts
    1,299
    Mentioned
    11 Post(s)
    Tagged
    0 Thread(s)
    I said that a ForEach loop would be a simple fix, meaning that it would require the fewest changes to the code you already have - but I agree that it's not the most efficient.

    Arrays are not the way to go here.
    The whole thing could be made simpler and more efficient, just using normal events (without any loops at all), if you understand how MMF2 handles multiple instances of objects/groups, and automatically pairs them.
    You just can't expect MMF2 to read your mind and know which instances you are referring to without being told (which effectively the purpose of a ForEach loop).

    http://www.diybandits.com.au/MMF/tutorials.html
    http://www.diybandits.com.au/MMF/articles.html
    http://www.create-games.com/article.asp?id=1975
    http://www.create-games.com/article.asp?id=2248

  10. #10
    Clicker Fusion 2.5 Developer

    Join Date
    Jan 2013
    Posts
    36
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by MuddyMole View Post
    I said that a ForEach loop would be a simple fix, meaning that it would require the fewest changes to the code you already have - but I agree that it's not the most efficient.
    You just can't expect MMF2 to read your mind and know which instances you are referring to without being told (which effectively the purpose of a ForEach loop).
    except the foreach in that overlap there properly writes it into the right spot, if you pull from that specific area without using the value of it it's the fixed value and everything. the comparisons worked fine outside of this and in the full game engine i have going i have maybe 40 of those going and they all remain consistent and apply to their specific instance so i don't think anything here is "mind reading". i am also aware of embedded detectors but since the actual project this all relates to is so complex and has to account for so many different collisions to be handled, this was the better way to go making separate objects for detectors.

    i'm aware of how compare two general values functions and how order matters, except those other events trigger absolutely fine regardless of their order and apply to the specific instances. the collision area in specific is the only place i know i am probably goofing something but i am not sure of a better way of handling that. if i use loops or a foreach to try to do what the array was already handling, this game will not work at all.

Similar Threads

  1. Center Display is inconsistent
    By Konidias in forum Multimedia Fusion 2 - Technical Support
    Replies: 10
    Last Post: 1st May 2013, 05:39 AM
  2. Inconsistent triggering of Q&A, take 2
    By Teero in forum File Archive
    Replies: 2
    Last Post: 20th January 2011, 04:24 PM
  3. Texture size in shaders inconsistent
    By Pixelthief in forum Shader Development
    Replies: 4
    Last Post: 17th September 2010, 07:11 AM
  4. Bug R244: OR causes inconsistent selection
    By Random in forum File Archive
    Replies: 50
    Last Post: 8th March 2007, 04:17 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •