[Solved] Finding the first empty value in an Array

From the Asset Store
Supports 1D, 2D, 3D arrays. Import and export arrays in JSON format
  • I'm trying to make a code that finds the first "0" value on an Array and places a number there.

    I don't understand why this fills the entire array with the new value:

    [attachment=0:1oge6q43][/attachment:1oge6q43]

    Is the "Stop Loop" useless here? What can I do for an "For Each XY element" to stop?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • It appears System:Stop Loop does nothing for Array:For each nn element, just for System: loops. I put some logging in your code and the loop does not stop. I guess just have a local variable "valueFound" or similar and set it to 1 when you've found the first zero, and use this as a second expression in the arrInv:Value at condition. AFAIK.

    Edit: anything->nothing

  • It appears System:Stop Loop does anything for Array:For each nn element, just for System: loops. I put some logging in your code and the loop does not stop. I guess just have a local variable "valueFound" or similar and set it to 1 when you've found the first zero, and use this as a second expression in the arrInv:Value at condition. AFAIK.

    Thanks, that worked ^^

    [attachment=0:2ui4rrxl][/attachment:2ui4rrxl]

  • Cool.. it had me stumped and the manual is very scant on this.

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