you mean like this? because > test the reset to zero make it out of sync.
if ping[0].m => 1.0
ping[0].m=ping[0].m-1.0
// AGK 2017.05.15 (Tier1 Basic)
// MR 24.05.2017
// multiple timer
SetSyncRate(10,0)
type TTimer
beep as integer
m as float
endtype
Main()
end
Function Main()
local ping as TTimer[2]
TimerInit(ping)
local i as Integer
Do
Print("timer 1,2,3 seconds")
TimerUpdate(ping)
if ping[0].m => 1.0
TimerReset(ping[0],1.0)
ping[0].beep = 1
else
ping[0].beep = 0
endif
if ping[1].m => 2.0
TimerReset(ping[1],2.0)
ping[1].beep = 1
else
ping[1].beep = 0
endif
if ping[2].m => 3.0
TimerReset(ping[2],3.0)
ping[2].beep = 1
else
ping[2].beep = 0
endif
for i = 0 to ping.length
print(ping[i].beep)
next
sync()
Loop
EndFunction
Function TimerInit(ping ref as TTimer[])
local i as Integer
for i = 0 to ping.length
ping[i].m=0
ping[i].beep=0
next
EndFunction
Function TimerUpdate(ping ref as TTimer[])
local i as Integer
for i = 0 to ping.length
ping[i].m = ping[i].m + GetFrameTime()
next
EndFunction
Function TimerReset(ping ref as TTimer,t as float)
ping.m = ping.m - t
EndFunction
AGK (Steam) V2017.05.15 : Windows 10 Pro 64 Bit : AMD (17.4.4) Radeon R7 265 : Mac mini OS Sierra (10.12.2)