#Define Timer_Loop 0 #Define Timer_NoLoop 1 Type TimerUDT Dim as Sub(TimerName as String) CB Dim as Integer StartTime Dim as Integer RunTime Dim as String TName Dim as Byte Mode Dim as Byte Aktive Declare Constructor(ByVal TimerName as String, ByVal TimeToRun as Integer, ByVal Modus as Byte, ByVal Callback as Sub(TimerName as String)) Declare Sub Update() End Type '############################################################################### Constructor TimerUDT(ByVal TimerName as String, ByVal TimeToRun as Integer, ByVal Modus as Byte, ByVal Callback as Sub(TimerName as String)) TName = TimerName RunTime = TimeToRun Mode = Modus CB = Callback StartTime = Timer Aktive = 1 End Constructor '############################################################################### Sub TimerUDT.Update() If Aktive = 1 and Timer - StartTime >= RunTime then If Mode = 0 then StartTime = Timer CB(TName) ElseIf Mode = 1 then Aktive = 0 CB(TName) Endif Endif End Sub