| 08-11-2009, 11:33 PM | #1 |
Code:
library TimerUtils
globals
timer array udg_timerstack
integer udg_ntimer = 0
endglobals
function NewTimer takes nothing returns timer
if udg_ntimer == 0 then
return CreateTimer()
else
set udg_ntimer = udg_ntimer-1
return udg_timerstack[udg_ntimer]
endif
endfunction
function ReleaseTimer takes timer t returns nothing
if udg_ntimer == 8190 then
call BJDebugMsg("Warning- you need 8191 timers at once!?")
call DestroyTimer(t)
else
set udg_timerstack[udg_ntimer] = t
set udg_ntimer = udg_ntimer + 1
endif
endfunction
endlibraryThis the is TimerUtils code I'm using. I'm hoping that it is outdated or something, because it is causing many bugs in my map. The NewTimer() function sometimes just doesn't work. Is there a specific way I'm supposed to use this? If so, please enlighten me. Right now I'm using the NewTimer() for perodic effect and attaching handles to it via hashtable and GetHandleId(). Any spell that uses NewTimer doesn't work 10% of the time. That's why I think it is really buggy and unreliable. When I change it to CreateTimer() it works completely fine. |
| 08-11-2009, 11:43 PM | #2 |
How about you simply import Vex's |
| 08-12-2009, 12:07 AM | #3 |
Right, where would I find that? |
| 08-12-2009, 12:28 AM | #4 |
| 08-12-2009, 12:42 PM | #5 | |
Quote:
Thanks. Question though, you can only assign 1 value to the timer with SetTimerData? That's kind of weird? On the otherhand, are you supposed to attach structs to it? |
| 08-12-2009, 12:55 PM | #6 |
yes you are supposed to attach structs to timer. |
