Tyrulan
Ultra Cool Member
- Reaction score
- 37
Been experimenting with periodic timers and came up with this simple function.
My problem is as follows: When calling TimerStart (timer, real, boolean, code handlerFunc) it is expecting a function. While within structures I am only using methods. Is there a simple solution for this?
JASS:
scope
globals
timer T
real TCount = 0
real TOTAL = 0
endglobals
function timerLoop takes nothing returns nothing
set TOTAL = TimerGetElapsed(T) + TCount
call BJDebugMsg("Timer: " + R2S(TOTAL))
set TCount = TCount + 1
if (TOTAL == 15.00) then
call DestroyTimer(T)
call BJDebugMsg ("All Done.")
set TCount = 0
set TOTAL = 0
endif
endfunction
function Trig_Untitled_Trigger_001_Actions takes nothing returns nothing
set T = CreateTimer()
call BJDebugMsg("Timer Created")
call TimerStart(T, 1.00, true, function timerLoop)
endfunction
//===========================================================================
function InitTrig_Untitled_Trigger_001 takes nothing returns nothing
set gg_trg_Untitled_Trigger_001 = CreateTrigger( )
call TriggerRegisterPlayerChatEvent(gg_trg_Untitled_Trigger_001, Player(0), "-start", false)
call TriggerAddAction( gg_trg_Untitled_Trigger_001, function Trig_Untitled_Trigger_001_Actions )
endfunction
endscope
My problem is as follows: When calling TimerStart (timer, real, boolean, code handlerFunc) it is expecting a function. While within structures I am only using methods. Is there a simple solution for this?