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

[JASS] Jass Timers

Status
Not open for further replies.
Level 5
Joined
Jul 17, 2006
Messages
145
Is there a way i can get the TimerStart function to accept parameters in the last parameter (lol, i didetn really word that well did i) example:

Code:
call TimerStart(t, 0.01, true, function Knockback)

Instead of that i would like to use something like

Code:
call TimerStart(t, 0.01, true, function Knockback(parameters))

(assuming the function your running has parameters)

The only problem with that, is iv tried doing it and it returns a syntax error O_o

Any help is apprecated :)
 
thats what the Local Handle Variables are for.

They basically allow you to tag on values to handles, through a global gamecache.

An example of how to use them

JASS:
function Knockback takes nothing returns nothing
    local timer ThisIsAnotherHandle = GetExpiredTimer()
    local real r = GetHandleReal( ThisIsAnotherHandle, "thisisastring" )
endfunction

function KnockbackInit takes nothing returns nothing
    local timer ThisIsAHandle = CreateTimer()
    call SetHandleReal( ThisIsAHandle, "thisisastring", 999999999.999 )
    call TimerStart( ThisIsAHandle, 0.001, true, function Knockback )
endfunction

Note that i named the variables so that theyre easy to figure out what goes where :D

Also, note that instead of having a seperate function for Lightning, Unit, Group, and all the works, there is SetHandleHandle, but you have to get the individual types, as handles themselves ( not child-types however ) arent very useful on their own :P

PS. To clean up the functions, in the [STOP, TIMER!] part of your timer function, along with PauseTimer and DestroyTimer ( above DestroyTimer, though ), put FlushHandleLocals( timer ), where timer is a timer.
 
Status
Not open for further replies.
Back
Top