Array Condition example cap....

This forum is currently in read-only mode.
  • ...as per the discussion in the help forum.

  • Contra!

    I've attached an example that uses the 'for each element' Array condition. In order to output a certain index only (the first Z layer), add a condition that compares the Array.CurrentZ to the index you want. Remove that condition and it'll display the whole table.

    It seems that Array object is still 0-indexed... Is this intended? I was under the impression that this was changed to 1-indexed.

    - [CHANGE] Array is now 1 based; if you use Array in a project please review and update your events accordingly

    This obviously isn't true in our case.

    Also, your example should work, but it apparently doesn't, which should be considered a bug. The 'for (n)" aren't at fault here, it is the Array condition that is not doing its job. The Array - Compare value at X,Y,Z appears bugged, you could use the X,Y or X variants instead. I will report this to the tracker.

    So, in your case, it would be:

    +Trigger Once
    +For "x" from 0 to 99
    +For "y" from 0 to 99
    +Array - Value at LoopIndex("x"),LoopIndex("y") equal to 0
    

    List: Add "Yes"

    [/code:2tpotvn2]

    But that is redundant, since "for each element" array condition does the job just fine as shown in my example.

    Also, use "Trigger Once" system condition so the event should evaluate once only; by itself it will keep triggering each tick.

  • Parts of the Array object were 1-based and other parts were 0-based, like the Array(x, y, z) retrieving syntax. I've fixed it for the next build - it should all be 1-based then.

  • Parts of the Array object were 1-based and other parts were 0-based

    That's what I surmised in my post in the main 0-index vs 1-index thread.

    Don't know if you saw that, but glad to hear that it's fixed for the next build.

    Those bugs are falling one by one eh?

    Incidentally, another recently discovered bug is that the date object returns the year as 109 instead of 09 when you choose a format that has only 2 digits for the year.

    Don't know if it's been tracked yet.

    Sponge.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Sorry to bring this old thread up, but Mipey's example answered a question on arrays for me.

    That being if the for each condition cycled each z. Apparently it does.

    It's also a good example of the order for which each is called.

    Thanks

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)