VoidExpanse/scope-timer: Difference between revisions
(Created page with "<noinclude> Category:VoidExpanse/api_scopes </noinclude> = Timer scope = Used to create and manage timers - delayed events. Timers only works inside it's script, but they'...") |
No edit summary |
||
| Line 31: | Line 31: | ||
<pre style="margin:0px">timer.ClearTimer(5);</pre> | | <pre style="margin:0px">timer.ClearTimer(5);</pre> | | ||
Removes timer with specified ID. | Removes timer with specified ID. | ||
}} | |||
{{Scripting_api|GetGameTime| | |||
void| | |||
double| | |||
<pre style="margin:0px">timer.GetGameTime();</pre> | | |||
Returns time passed since game was started in seconds. | |||
}} | }} | ||
Latest revision as of 08:15, 27 May 2014
Timer scope
Used to create and manage timers - delayed events. Timers only works inside it's script, but they're persistent through savegames.
Visibility: Global.
List of functions
| SetTimer | ||
|---|---|---|
| Arguments | Returns | Example |
|
int - ID of created timer |
var timer = timer.SetTimer(5, "SomeFunction", {what_to_say: "hello"}, 1);
function SomeFunction( args )
{
console.Print("I was told to say " + args.what_to_say);
}
|
| Description | ||
|
Creates a timed event, which will be executed after "time_in_seconds" interval. Can be infinite loop. | ||
| ClearTimer | ||
|---|---|---|
| Arguments | Returns | Example |
|
void |
timer.ClearTimer(5); |
| Description | ||
|
Removes timer with specified ID. | ||
| GetGameTime | ||
|---|---|---|
| Arguments | Returns | Example |
|
void |
double |
timer.GetGameTime(); |
| Description | ||
|
Returns time passed since game was started in seconds. | ||