[Solver] Not understanding this loop issue

Get help using Construct 2

Post » Mon Jul 21, 2014 10:08 pm

So in this function I have 2 loops, one called "item" and one called "z".
"item" loops through the X index of an array called "Chance", while "z" loops through the depth of the array (which is 2).
"item" returns me the X position at which this function stops, while "z" returns the depth at what that happens

But for some reason, "z" always returns 0, when the events are like this:
(in this order, the loop goes "1,0" "1,1" "2,0" "2,1" "3,0" "3,1"... and always stops at "X, 0" for some reason)
(events 21 and 23)
c21.png



And if I switch the order of the loops, "z" always returns 1
(in this order, the loop goes "1,0" "2,0" "3,0" "4,0" "5,0" "6,0"... and always stops at "X, 1" for some reason)
(events 21 and 23)
c22.png
You do not have the required permissions to view the files attached to this post.
Last edited by 7Soul on Mon Jul 21, 2014 10:45 pm, edited 1 time in total.
B
83
S
22
G
15
Posts: 1,039
Reputation: 15,219

Post » Mon Jul 21, 2014 10:39 pm

One obvious problem is that you check endloop=1 to Stop the outer loop, but the inner one will still run one more time. You should at least have an Else after Endloop=1 to stop that inner loop.
ImageImageImage
B
71
S
21
G
221
Posts: 3,650
Reputation: 124,229

Post » Mon Jul 21, 2014 10:44 pm

blackhornet wrote:One obvious problem is that you check endloop=1 to Stop the outer loop, but the inner one will still run one more time. You should at least have an Else after Endloop=1 to stop that inner loop.

Oh my god, I love you @_@
B
83
S
22
G
15
Posts: 1,039
Reputation: 15,219


Return to How do I....?

Who is online

Users browsing this forum: sublimate and 3 guests