Warcraft III resources & community, 2003–2006 · archived

RunSeperateDelayed

not rated
Submitted by KaTTaNaExecution0 downloads
Runs the given code after the specified delay. It doesn't pause the calling thread, and it cleans up after itself.
The delay is in game seconds. The delay should be quite accurate since it's not a polled delay.

Source

function RunSeperateDelayed_Child takes nothing returns nothing
    local timer t = bj_lastStartedTimer
    call PolledWait(TimerGetTimeout(t)+1)
    call DestroyTimer(t)
    set t = null
endfunction

function RunSeperateDelayed takes code c, real delay returns nothing
    local trigger trg = CreateTrigger()
    local timer last = bj_lastStartedTimer
    set bj_lastStartedTimer = CreateTimer()
    call TimerStart(bj_lastStartedTimer, delay, false, c)
    call TriggerAddAction(trg, function RunSeperateDelayed_Child)
    call TriggerExecute(trg)
    call DestroyTrigger(trg)
    set bj_lastStartedTimer = last
    set last = null
    set trg = null
endfunction

Comments

0

No comments.