Timer

Blitz3D Forums/Blitz3D Beginners Area/Timer

po(Posted 2004) [#1]
How would I make a simple timer that went by counting down seconds no matter how fast or slow someones computer is? I just want a simple 60 second one or something. I have tried putting a counter that is in the while loop and takes away 1 every time it loops but the speed would vary on your type of computer I think.


GfK(Posted 2004) [#2]
Graphics 640,480,16,2
SetBuffer BackBuffer()
Alarm% = MilliSecs() + 10000

While Not KeyDown(1)
	Cls
	Text 0,0,"Time Remaining: " + ((Alarm-MilliSecs())/1000) + "s"
	Flip
	If MilliSecs() > Alarm Then End
Wend



Warren(Posted 2004) [#3]
In simpler terms, what he's saying is that 1000 milliseconds is a second ... so if you take MilliSecs()+1000 and wait until that time arrives, you will have waited one second. And so on...