forums

TNT Basic Forums > Programming Q&A
Timer
< Last Thread     Next Thread >
Author
Thread        Post A Reply

05-27-2005 18:27

Posted by:
koyin

Click Here to Email koyin   Find more posts by koyin

Does anybody know how to make a timer so that when it end someting changes??
Or a timer that counts up that people can see...
Please help

Koyin

06-15-2005 10:19

Posted by:
allnodcoms

Location:
hertfordshire (England)

Click Here to Email allnodcoms   Find more posts by allnodcoms

Using the Timer

The call you need is 'timer'. This keeps a count of the ticks (1000ths of a second) since TNT booted. To use this you would include something like

myTime=timer

at the start of your loop (but outside of it), and each loop you call

elapsedTime=(timer-myTime)/1000

to get the time since the loop started, in seconds. This obviously counts up, if you want to use a countdown style timer you could try the following:

myTime=timer
totalTime=10 'in seconds (or whatever)

while totalTime>0

if timer-myTime>1000 then 'a second has passed
totalTime=totalTime-1 'so dec the time remaining
print totalTime '(or do something more interesting)
myTime=timer 'reset the timer
end if

wend


Hope this helps...

All times are GMT        Post A Reply

Forum Jump:
< Last Thread     Next Thread >

< Contact Us - TNT Basic >

Powered by: vBulletin Lite Version 1.0.1 Lite
Copyright © Jelsoft Enterprises Limited 2000.