*NEW* Current Version on STEAM: 16.026Logfile: EN, DEWebchat:Visit the chat
onesecondelapsed=TTIMER(0,1) //returns TURE after 1 secondoneminuteelaped=TTIMER(1,60) //returns TRUE after 60 seconds
FUNCTION TTIMER: TTNum, TTCountTo//onesecondelapsed=TTIMER(0,1) //returns TURE after 1 second//oneminuteelaped=TTIMER(1,60) //returns TRUE after 60 seconds STATIC Init_TTTimer,NumOfTimers, CheckIt IF Init_TTTimer<>TRUE; NumOfTimers=100; Init_TTTimer=TRUE; DIM TIMETIMER[NumOfTimers][2]; TIMETIMER[0][0]=-1; TIMETIMER[0][1]=-1; TIMETIMER[1][0]=-1; TIMETIMER[1][1]=-1; ENDIF IF TTNum>-1 TIMETIMER[TTNum][0]=GETTIMER() TIMETIMER[TTNum][1]=TIMETIMER[TTNum][1]+TIMETIMER[TTNum][0] CheckIt=TIMETIMER[TTNum][1]/1000 IF INTEGER(CheckIt)>=TTCountTo TIMETIMER[TTNum][0]=0 TIMETIMER[TTNum][1]=0 checkit=0 RETURN TRUE ELSE RETURN FALSE ENDIF ENDIFENDFUNCTION
Tips:1. becareful not to use too many timers,2. reuse the id slots if they arent being used anymore.3. More timers you se will result in less performance, dont use more than needed.4. Do not use any single timer for multiple events! Watch those ID's!
Updated for use with current compiler: EDITED ON SEPT.23 2005-Hemlos