• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

[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
978
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 41
Joined
Jun 9, 2011
Messages
13,239
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
978
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