• 🏆 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!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

[JASS] TimedWait

Status
Not open for further replies.
Level 9
Joined
Nov 4, 2007
Messages
931
[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