VoidExpanse/scope-timer

From AtomicTorchWiki


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
  • double: time_in_seconds
  • string: function_name
  • object: args
  • int: loops (0 - infinite)

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
  • int: timer_id

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.