| 10-13-2007, 04:58 AM | #1 |
I have one question that's been bugging me lately; waits in loops. What happens when you put a wait (including game-times) in a loop? What are the effects of it? |
| 10-13-2007, 05:26 AM | #2 |
It pauses the function, then after the wait, continues it. If you are talking about GUI, it may cause Integer A/B or the variable used in the loop to be overwritten, creating errors in the script. |
| 10-13-2007, 05:44 AM | #3 |
Code:
Loop Start <------------------------<
> Do whatever you want in the loop ^
> TriggerSleepAction or whatever ^
>End of Loop, go to Loop Start > ^ |
| 10-13-2007, 04:39 PM | #4 |
Sorry, I'm talking about GUI. As for TriggerSleepAction... I have no idea what's going on. Please, I need a more. Er, full, answer. |
| 10-13-2007, 08:08 PM | #5 |
Waits do the same thing inside a loop as they do outside. The main thing to worry about is that GUI loops use a global counter (Integer A or Integer B) to keep track of when to exit the loop. And, waits cause War3 to execute other things that need to be done (it doesn't pause all triggers while its waiting), and then resume the waiting trigger later. So, if you have a wait inside a loop using Integer A, then another trigger runs that also uses Integer A, it can be bad. |
