Just a fastloop question. – Clickteam.
Re: Just a fastloop question. [Re: kjellm87] | |
Registered: 09/15/06 |
When you run a loop, for each iteration of the loop, it will read through every single “On Loop” command, and if the string matches the loop name, it will use that event. So you can have as many conditions in a single loop as you want.
If you have 3 events that you want to repeat inside of a loop before going on, you can actually run a loop *inside of* a loop. When you do this, that whole loop will execute, then it will return to where it was in the outer loop. When you run a fast loop in MMF2, it doesn’t matter where in your program the lines of code for your ‘on loop’ conditions are. The program will immediately run them all and skip all non-loop commands between them (it still reads top to bottom). So if you call loop “HelloWorld” in the top of your event list, but all the “On Loop ‘HelloWorld'” events are in the bottom, they will all be run before the loop continues on. The side effect of this is that when MMF2 runs *any* loop, it will read *all* loops, but only run the relevant ones. That means that if you have 50 different loops will tons of conditions, the program will have to take the time to read through every single event N times for each loop. A loop that only had 5 events and only ran 20 times might have 30000 events to check instead of 100. If your program ever experiences slowdown due to this, theres a simple fix; you can put your “On Loop” events inside of an event group. Then, whenever you run the loop, you open the event group, and when it finishes, you close it again. So instead of writing “Run Loop X for 100 times” You write: “Open group “Loop X Events”” |