[Solved] Finding the first empty value in an Array

Get help using Construct 2

Post » Mon Jul 21, 2014 11:59 pm

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:
c3.png


Is the "Stop Loop" useless here? What can I do for an "For Each XY element" to stop?
You do not have the required permissions to view the files attached to this post.
Last edited by 7Soul on Tue Jul 22, 2014 12:48 am, edited 1 time in total.
B
84
S
22
G
15
Posts: 1,039
Reputation: 15,249

Post » Tue Jul 22, 2014 12:32 am

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
Last edited by codah on Tue Jul 22, 2014 1:02 am, edited 1 time in total.
B
24
S
9
G
4
Posts: 1,646
Reputation: 6,596

Post » Tue Jul 22, 2014 12:42 am

codah wrote: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 ^^

c4.png
You do not have the required permissions to view the files attached to this post.
B
84
S
22
G
15
Posts: 1,039
Reputation: 15,249

Post » Tue Jul 22, 2014 1:01 am

Cool.. it had me stumped and the manual is very scant on this.
B
24
S
9
G
4
Posts: 1,646
Reputation: 6,596


Return to How do I....?

Who is online

Users browsing this forum: leena222, mindragon73 and 19 guests