• 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.
  • The Hive's 22nd Icon Contest: Creep Abilities is now concluded, time to vote for your favourite set of icons! Click here to vote!
  • ✅ The POLL for Hive's Texturing Contest #34 is OPEN! Vote for the TOP 3 SKINS! 🔗Click here to cast your vote!
  • ✅ The POLL for Hive's Techtree Contest #20 is OPEN! Vote for the TOP 3 FACTIONS! 🔗Click here to cast your vote!

newbie, timers vs periodic ttime

Status
Not open for further replies.
Level 5
Joined
Sep 22, 2012
Messages
90
good day peepz,

I would like to know more about timers. I've also been studying jass then I've noticed that "azeroth grand prix" uses timers instead of every periodic time stuff. How does timers differ from periodic time event?
 
Periodic events are not precise; a 0.1 second periodic event isn't triggered exactly every 0.1 seconds

Timers are precise, and can be handled in more ways than a periodic trigger.
 
Create both triggers, one with a periodic event and another with a timer, each one with a 1 second duration.
Also create 2 Integer variables, one for the periodic and another for the timer.

Make each one display message "Periodic - PeriodicInteger+1" in case of the periodic, and "Timer - TimerInteger +1" in case of the timer.

After some time, you'll see that Periodic Integer goes over or under the Timer Integer, because it triggers faster or slower.

It has ben widely said around that timers are precise.
 
JASS:
function sayHi takes nothing returns nothing
    call DisplayTextToPlayer(Player(0),0,0,"Hello World")
endfunction

//add this into the trigger init
call TimerStart(CreateTimer(),3,true,function sayHi)

The Reason we use timers instead of triggers is they are faster(a whole lot faster)
and they only need one handle, as opposed to the 3 that are required if you use a trigger to do it.
 
Status
Not open for further replies.
Back
Top