I wanted to create some sort of timer or alarm so I can call an action every x time. I wanted the time to change randomly. I succeeded by using the builtin Timer and encapsulated it in a type. Is this ok, or is there another , better way?
Something like this but not yet finished as not completely in a type yet.
Type TMyTimer
Field newTimer:TTimer
Method createMyTimer(_hertz:Int)
If newTimer Then StopTimer(newTimer)
newTimer = CreateTimer(_hertz)
End Method
Method myTimer:Int()
Delay 1
PollEvent()
If EventID() = EVENT_TIMERTICK
Print "Tick: ..............................................."
Return True
EndIf
End Method
End Type
|