| 07-21-2006, 03:12 PM | #1 |
Hi all, I am using this horrible function just because I have already too much created triggers on my new spell. The problem is that this function it's not precise at all, I mean I use wait of 1 second, not 0.01 and it still delays as hell ! In example I have a loop which is similar to it: JASS:loop exitwhen( counter == 10 ) call DisplayTextToForce( GetPlayersAll( ), I2S( counter ) ) call TriggerSleepAction( 1 ) set counter = counter + 1 endloop P.S: please don't tell me to use timers, I already know... |
| 07-21-2006, 03:33 PM | #2 |
Because it uses real time, rather than game time. Use PolledWait for a better version, and timers for precision. |
| 07-21-2006, 03:35 PM | #3 |
periodic event or timers. |
| 07-21-2006, 05:12 PM | #4 | ||
Quote:
Quote:
|
| 07-21-2006, 05:27 PM | #5 | |
Quote:
|
| 07-21-2006, 08:20 PM | #6 |
PolledWait won't do much better, but with long delays you don't need to use a callback and their attendant cruft. An inlined polledwait will work: JASS:local timer t = CreateTimer() call TimerStart(t,30.,false,null) loop exitwhen counter >= 10 if TimerGetElapsed(t) >= counter then call DisplayTextToPlayer(GetLocalPlayer(),0.,0.,I2S(counter)) set counter = counter + 1 endif call TriggerSleepAction(0.) endloop call DestroyTimer(t) set t = null |
| 07-22-2006, 02:20 AM | #7 |
Agreed. PolledWaits are even worse in my opinion, because at the end, it still uses TriggerSleepAction. |
| 07-22-2006, 08:38 AM | #8 |
Polledwaites have the advantages, such as gametime rather than realtime, it uses a timer, and "can" sometimes be more accurate. |
| 07-22-2006, 11:52 AM | #9 | |
Quote:
|
| 07-22-2006, 12:17 PM | #10 |
Ok, I chose to create another trigger using timers. Thank you all anyway. |
