| 10-11-2008, 10:13 AM | #1 |
Question about the wait action.. when using wait in a spell, what's smarter to use? wait, or wait game-time? what exactly is the difference? thanks. |
| 10-11-2008, 11:08 AM | #2 |
normal wait is native to the engine. it pauses execution of the function for specified period. game-time wait is a custom function. it uses a timer as its base, and polls the remaining time with normal waits. as timer speed depends on the game speed, game-time wait will reflect the difference with the real time. however, normal waits have precision lower-bound. furthermore, as those game-time waits utilize normal waits, precision is worse (and result is somewhat random). If you need some precise game-time delay, I suggest using timers (with events or callbacks) instead. |
| 10-11-2008, 12:44 PM | #3 |
The use of PolledWait is quite better because it uses a timer. However that function leaks, but if you use Vex's optimizer, you can also access PolledWait2 which is an optimized version. There is no doubt, waits are evil and timers are better. To know why waits are so bad, check out this link: http://www.wc3campaigns.net/showthre...ght=waits+evil ___________________________________________________________ rep+ those who help you! |
| 10-11-2008, 02:12 PM | #4 |
wait cause game to start other thread and then return. this is against usage of globals. |
| 10-11-2008, 03:03 PM | #5 | |
Quote:
They are also inefficient, and have a minimum value of 0.27... Theses among many other reasons are explained in my post ... just give it a try. |
| 10-11-2008, 05:09 PM | #6 | ||
Quote:
Quote:
|
| 10-11-2008, 05:11 PM | #7 |
There is some form of minimum value. Try making any normal spell using a loop with waits. It won't work. I tried to make a simple meathook spell using GUI with waits, didn't turn out very well. |
| 10-11-2008, 05:52 PM | #8 | |
Quote:
Also, if you give it a lower value, it will just make it 0.27, per example. I read about this in a tutorial too bad I can't find the link =S |
| 10-11-2008, 06:08 PM | #9 |
This test script says otherwise (NewGen isn't working for me at the moment, so I'm stuck with regular JASS >_<) JASS:function ActionFunc takes nothing returns nothing local real time = S2R (GetEventPlayerChatString ()) local string result call DisplayTimedTextToPlayer (Player (0), 0, 0, 2.5, R2S (time)) call TimerStart (udg_timer, 60., false, null) call TriggerSleepAction (time) set result = R2S (TimerGetElapsed (udg_timer)) call DisplayTimedTextToPlayer (Player (0), 0, 0, 2.5, result) endfunction function InitTrig_Melee_Initialization takes nothing returns nothing local trigger t = CreateTrigger () set udg_timer = CreateTimer () call TriggerRegisterPlayerChatEvent (t, Player (0), "", false) call TriggerAddAction (t, function ActionFunc) endfunction For values around 0.01, it was displaying values from 0.1 to 0.2 |
| 10-11-2008, 07:10 PM | #10 |
It doesn't have a minimum value at all, but .27 is a good estimate average for .01 second waits. As for .00 second waits, I've never had them go faster than ~.1 seconds. |
| 10-11-2008, 08:32 PM | #11 | |
Quote:
|
| 10-11-2008, 08:39 PM | #12 | |
Quote:
![]() |
| 10-11-2008, 08:40 PM | #13 |
You can even try TriggerSleepAction( -1 ) or even TriggerSleepAction( -2 ). If my memory serves me right -1 was faster than -2. |
| 10-12-2008, 08:53 AM | #14 |
currently if you test TriggerSleepAction duration offline/in LAN/in BNet you will have different results |
| 10-12-2008, 08:55 AM | #15 | |
Quote:
|
