Home
Products
Community
Manuals
Contact
Login or Signup

BlitzPlus Docs -> 2D - Category -> Time -> Millisecs

Millisecs()

Parameters:

None

Description:

This command will return to you the system timer value in milliseconds.

This is incredibly useful for precision timing of events. By reading this value into a variable, and checking it against the CURRENT time in milliseconds, you can perform 'waits' or check time lapses with a high degree of accuracy. A common use of this command is to seed the random number generator with the SeedRnd command.

Example:

; This prints STILL WAITING! for three seconds then ends.
oldTime=MilliSecs()
While MilliSecs() < oldTime + 3000
Print "Still waiting!"
Wend 

Comments

TAS(Posted 1+ years ago)
Don't forget the '()'s! If you enter millisec instead of millisec() the IDE will still recognize it as a reserved word and not flag it as error but it will return 0.


H&K(Posted 1+ years ago)
millisec ?


Floyd(Posted 1+ years ago)
If you enter millisec instead of millisec() the IDE will still recognize it as a reserved word

millisec is not a reserved word. And since it is not recognized it becomes a new variable. No value has been assigned so it has the value zero.

NOTE: On second thought you probably meant Millisecs, without the parentheses. The compiler still considers this a new variable, but there is extra confusion because the IDE highlights it like a reserved word.

Graphics 600, 400, 0, 2
SetBuffer BackBuffer()

Text 20, 20, "Function Millisecs() = " + MilliSecs()
Text 20, 40, "Variable Millisecs   = " + MilliSecs

MilliSecs = 12345

Text 20, 60, "Variable Millisecs   = " + MilliSecs
Text 20, 80, "Function Millisecs() = " + MilliSecs()

Flip

WaitKey



BlitzPlus Manual Forum

Blitz3D Equivalent Command