Here is a sample how to use the TBEM_SetRepeat command.
[code=thinbasic]'
' TBEM sample script - SetRepeat
' Michael Hartlef
' October 18th, 2008
uses "CONSOLE", "TBEM"
dim myEvent as long
dim sKey as string
dim run as long value %TRUE
'Define all event types we need.
begin const
%evtType1
end const
'**************************************************
function tbmain()
'**************************************************
'Add an event
myEvent = TBEM_AddEvent("SampleFunc",%evtType1)
'Repeat the event 5 times once it was running the first time, each after 200 milliseconds again
TBEM_Setrepeat( myEvent, %TRUE, 200, 5)
'Fire a trigger to run the event for one time
TBEM_AddTrigger(%evtType1)
console_writeline ("Press q for quit..." + $CRLF)
while run = %TRUE
'Run all active events which triggers were fired
tbem_Run()
'Check now for a keypress
sKey = console_inkeyb
'if "q" key was pressed, end this script
if sKey = "q" then run = %FALSE
wend
end function
'**************************************************
sub SampleFunc()
'**************************************************
static count as long
count += 1
console_writeline("Hello from function SampleFunc")
console_writeline("count = " + count)
end sub
[/code]
Bookmarks