Michael,
I was experimenting with TBEM module in order to stress it a bit
I wanted to have different events fired at different time interval. See below example.
[code=thinbasic]
uses "TBEM"
uses "Console"
dim event000Sec as long
dim event001Sec as long
dim event005Sec as long
dim event010Sec as long
dim event050Sec as long
dim event100Sec as long
%evg_Timers = 1
%evt_000Secs = 1
%evt_001Secs = 2
%evt_005Secs = 3
%evt_010Secs = 4
%evt_050Secs = 5
%evt_100Secs = 6
function Event_Print_000Secs()
Console_PrintAt("Timer occurs every 10 MilliSecs " & gettickcount, 1, 7, 9)
end function
function Event_Print_001Secs()
Console_PrintAt("Timer occurs every 100 MilliSecs " & gettickcount, 5, 8, 9)
end function
function Event_Print_005Secs()
Console_PrintAt("Timer occurs every 500 MilliSecs " & gettickcount, 10, 9, 10)
end function
function Event_Print_010Secs()
Console_PrintAt("Timer occurs every 1 seconds " & time$ , 15, 10, 11)
end function
function Event_Print_050Secs()
Console_PrintAt("Timer occurs every 5 seconds " & time$ , 20, 11, 12)
end function
function Event_Print_100Secs()
Console_PrintAt("Timer occurs every 10 seconds " & time$ , 25, 12, 13)
end function
event000Sec = TBEM_AddEvent ("Event_Print_000Secs", %evt_000Secs, getTickcount, %evg_Timers, %TRUE)
TBEM_SetRepeat (event000Sec, %TRUE , 10)
'tbem_addtrigger (%evt_000Secs, %TRUE)
event001Sec = TBEM_AddEvent ("Event_Print_001Secs", %evt_001Secs, getTickcount, %evg_Timers, %TRUE)
TBEM_SetRepeat (event001Sec, %TRUE , 100)
'tbem_addtrigger (%evt_001Secs, %TRUE)
event005Sec = TBEM_AddEvent ("Event_Print_005Secs", %evt_005Secs, getTickcount, %evg_Timers, %TRUE)
TBEM_SetRepeat (event005Sec, %TRUE , 500)
tbem_addtrigger (%evt_005Secs, %TRUE)
event010Sec = TBEM_AddEvent ("Event_Print_010Secs", %evt_010Secs, getTickcount, %evg_Timers, %TRUE)
TBEM_SetRepeat (event010Sec, %TRUE , 1000)
tbem_addtrigger (%evt_010Secs, %TRUE)
event050Sec = TBEM_AddEvent ("Event_Print_050Secs", %evt_050Secs, getTickcount, %evg_Timers, %TRUE)
TBEM_SetRepeat (event050Sec, %TRUE , 5000)
tbem_addtrigger (%evt_050Secs, %TRUE)
event100Sec = TBEM_AddEvent ("Event_Print_100Secs", %evt_100Secs, getTickcount, %evg_Timers, %TRUE)
TBEM_SetRepeat (event100Sec, %TRUE , 10000)
tbem_addtrigger(%evt_100Secs, %TRUE)
while %TRUE
TBEM_run(%evg_Timers)
wend
[/code]
I have a problem and some questions.
Problem:
- if commented triggers are uncommented, nothing happened. Maybe I missed something
Questions:
- once event is created and active, do I also have to call tbem_addtrigger even if event has been set as active?
- event type must be a unique number all around or unique inside a group? If event type is unique all around, why groups?
I mean, can I have EventType 1 in 2 different groups? If yes, how can tbem_addtrigger knows what to trigger
Sorry for "stressing" it/you
Ciao
Eros
Bookmarks