• 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.

[JASS] TimedWait

Status
Not open for further replies.
Level 9
Joined
Nov 4, 2007
Messages
933
[SOLVED]
I can't seem to figure out how to carry out timer functions, can someone tell me the basics format for creating a timer and using it? And does it require vJASS or can it be done with regular JASS. Thanks in advance for asnwering.
 
Last edited:
Level 29
Joined
Jul 29, 2007
Messages
5,174
vJass doesn't add any functionality to Jass.

native TimerStart takes timer whichTimer, real timeout, boolean periodic, code handlerFunc returns nothing

Here's a basic example (although I can't understand why it's so hard to use the Search button as this was asked at least 30 times).
JASS:
function callback takes nothing returns nothing
    local timer t = GetExpiredTimer()
    
    // in case you want the timer to be repetitive, you'll need to destroy it in another way

    call DestroyTimer(t)
    set t = null
endfunction

function start takes nothing returns nothing
    local timer t = CreateTimer();
    call TimerStart(t,1,false,function callback)
    set t = null
endfunction

And before someone comes and screams "TimerUtils" or something like that, there are timer libraries which handle all the nasty stuff for you, use them.
Can't give links because I am not updated and I couldn't care less.
 
Status
Not open for further replies.
Top