Feature Request :: On For Loop Completed.

Discussion and feedback on Construct 2

Post » Wed Oct 28, 2015 9:31 am

SO I have this Ajax Call that when the onComplete is called, executes a loop.
We are able to give a loop a name and I think that is great for loop index and all but I want to execute another series of events after that particular loop is over, is there a way to implement "On Loop Complete (Specifiy Loop Name)" inside Construct 2 ?
B
12
S
3
Posts: 288
Reputation: 1,694

Post » Wed Oct 28, 2015 10:33 am

A loop is done when it's called, so the next tier event is effectively your oncomplete.
The system ignores everything else other than a function during that time.
Image ImageImage
B
169
S
50
G
169
Posts: 8,286
Reputation: 108,216

Post » Fri Oct 30, 2015 9:51 am

I'm not sure it's work that way, but I use the "Else" event after a loop for doing actions that requires the loop to finish first.
B
135
S
33
G
17
Posts: 1,557
Reputation: 20,717

Post » Fri Oct 30, 2015 10:38 am

Any top level sub event will do.
As long as it's in the same event.
The "add blank sub event" works nice here.
Knowing that the "on loop completed" needs to be called every time.
Image ImageImage
B
169
S
50
G
169
Posts: 8,286
Reputation: 108,216

Post » Fri Oct 30, 2015 12:23 pm

If you know how big the loop is you can just do a compare 2 values, and check if you are on the last iteration of the loop.

if loopindex=10 then whatever....

Also C2 reads things sequentially. If you stack one loop on top of another loop, it will execute the top loop before the bottom loop. So you really don't need to know when it is done, the next condition will not execute until it is done. Most of the time you can stack them together.

If you are using a function you can also use the return value thing to flag when things happen.
B
29
S
8
G
4
Posts: 767
Reputation: 5,985


Return to Construct 2 General

Who is online

Users browsing this forum: lukewasthefish and 1 guest