Timer.js (system script)
From Spheriki
The timer.js system script provides a Timer object, which is a counter that will start at 0 when created and increase by 1000 every second.
Contents |
[edit]
Usage
RequireSystemScript("timer.js");
[edit]
Variables and functions of timer.js
- object constructor Timer()
- methods of objects created from it:
- getMilliseconds() - returns the elapsed time since the creation of the timer object.
- pause() - pauses the timer.
- unpause() - resumes the timer.
- methods of objects created from it:
[edit]
Example
This will create a timer object:
RequireSystemScript("timer.js");
var MyTimer = new Timer();
Later, to get its state, use:
var CurrentState = MyTimer.getMilliseconds()
To reset the timer, simply create a new object over the old one:
MyTimer = new Timer();
[edit]
Notes
SetFrameRate()usually suffices when it comes to time animations. You won't needtimer.jsfor it.
[edit]

