• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!

[General] What's the different between Wait and Wait game-time and what is it used for?

Status
Not open for further replies.
Level 13
Joined
Jan 2, 2016
Messages
973
Wait game-time is more accurate, but it leaks a refferecne.
This is how "wait game-time" looks in JASS
JASS:
function PolledWait takes real duration returns nothing
    local timer t
    local real  timeRemaining

    if (duration > 0) then
        set t = CreateTimer()
        call TimerStart(t, duration, false, null)
        loop
            set timeRemaining = TimerGetRemaining(t)
            exitwhen timeRemaining <= 0

            // If we have a bit of time left, skip past 10% of the remaining
            // duration instead of checking every interval, to minimize the
            // polling on long waits.
            if (timeRemaining > bj_POLLED_WAIT_SKIP_THRESHOLD) then
                call TriggerSleepAction(0.1 * timeRemaining)
            else
                call TriggerSleepAction(bj_POLLED_WAIT_INTERVAL)
            endif
        endloop
        call DestroyTimer(t)
    endif
endfunction
while the normal "wait" is call TriggerSleepAction( 2.00 )
 

Chaosy

Tutorial Reviewer
Level 40
Joined
Jun 9, 2011
Messages
13,183
As it sounds.

The difference is that one waits x seconds and the other waits x game time seconds.

I have never bothered to use game time waits because there is no reason to.
I suppose the wait will be stopped when you tab out for instance.
Game time will also be affected by MS, I think. Not entirely sure. I am just brainstorming.
 
Level 13
Joined
Jan 2, 2016
Messages
973
By the way... I'm having problems with 1 trigger, and I think I need to use Trigger Sleep action, since it doesn't seem to work when I try to do it with a timer.
Is the refference leak the only problem of polled wait?
Cuz I'm thinking to re-make the polled wait function, without the leak, and use it for my trigger :p
 
Status
Not open for further replies.
Top