tooltiperror
Super Moderator
- Reaction score
- 231
So, I decided to dip my fingers into two concepts: ZINC and Timers. So, for practice, I used Weep's advice and made a basic timers system. I want to know how to make it more accurate, or just more complicated in general to improve my knowledge of it.
JASS:
//! zinc
library ZINC
{
constant integer ArraySize=20;
//Maximum Size for Arrays.
hashtable Hash;
integer TimerCount;
timer Stack[ArraySize];
function StartTimer(integer structint, real time, boolean periodic, code handler) -> timer
{
if (TimerCount==0)
{
Stack[1]=CreateTimer();
TimerCount=1;
}
SaveInteger(Hash,0,GetHandleId(Stack[TimerCount]),structint);
TimerStart(Stack[TimerCount],time,periodic,handler);
TimerCount=TimerCount-1;
return Stack[TimerCount];
}
function GetStructData(timer t) -> integer
{
return LoadInteger(Hash,0,GetHandleId(t));
}
function EndTimer(timer t)
{
if(t==null)
{
PauseTimer(t);
TimerCount=TimerCount+1;
Stack[TimerCount]=null;
}
}
}
//! endzinc