CaptainD's Just Basic Site


Simple timer:

'delay is seconds times a thousand
delay=5000

t=time$("ms")
while time$("ms")<t+delay
wend

This code produces a pause of 5 seconds anywhere in your program. Change delay for a longer / shorter pause.

If you want you could shorten the code to:

t=time$("ms"):while time$("ms")<t+delay:wend

You could use the same code in several places in your program, simply changing the value for DELAY each time. Or you could use it as a subroutine:

[pause]
t=timer$("ms"):while time$("ms")<t+delay:wend:return

Which of course you simply call using gosub [pause] (if like me you were used to line numbers, trust me it doesn't take long to get used to using labels instead!)

Nothing fancy I know, but worth knowing if you're just starting out! (I much prefer this to using the TIMER function, that's just personal preference!)