at start of your program, create a global timer variable, for example:
m.timer=createobject("rotimespan")
m.timer.mark()
m.days=5
There are various ways to implement the above, for instance, if you are using a more object oriented approach to your programming, you may want to include the timer in a global object that you create at start time:
function init() as object
return {timer:createobject("rotimespan")
days:5}
end function
You might have a function that checks the time, which you can call from within all parts of your application, for example:
function timecheck()
if m.timer.totalseconds() > (m.numdays * 86400)
dialog=createobject("roonelinedialog")
dialog.settitle("time's up!")
dialog.show()
sleep(10000)
dialog.close()
end
end if
end function
To do this you will need to make sure all your msg=wait(time,port) statements do not block, in otherwords, use values greater than 0: for example:
while true
msg=wait(100,port)
timecheck()
end while
Screenshades: The first Screensaver for Roku2!
Musiclouds: The best free internet music, on your Roku!
Ouroborialis: Psychedelic Screensaver for Roku!