timer question

Blitz3D Forums/Blitz3D Programming/timer question

dena(Posted 2005) [#1]
Hello everyone:
I want to create a timer so that at intervals, say every 5 minutes or so a GoTo command will be executed, the progam will goto a label, and free certains entities, and load new ones.
I have the goto stuff setup, but am having trouble with the timer. Any ideas?
thanks


Jeppe Nielsen(Posted 2005) [#2]
use the millisecs() command


;five minutes in millisecs = 1000 * 60 * 5
timer=millisecs()+(1000*60*5)

;main loop
repeat

;check if the five minutes has passed
if millisecs()>timer

;reset the timer again
timer=millisecs()+(1000*60*5)

goto yourlabelhere

endif


until keydown(1)


hope this makes sense :-)


dena(Posted 2005) [#3]
beautiful, I was not resetting the timer.
thanks a bunch!