VoidExpanse/scope-config: Difference between revisions

From AtomicTorchWiki
No edit summary
No edit summary
 
(2 intermediate revisions by 2 users not shown)
Line 2: Line 2:
[[Category:VoidExpanse/api_scopes]]
[[Category:VoidExpanse/api_scopes]]
</noinclude>
</noinclude>
= Timer scope =
= Config scope =
Used to create and manage timers - delayed events. Timers only works inside it's script, but
Used to get access to server variables from config file.
they're persistent through savegames.


'''Visibility:''' Global.
'''Visibility:''' Global.
Line 10: Line 9:
== List of functions ==
== List of functions ==


{{Scripting_api|SetTimer|
{{Scripting_api|GetSetting|
* double: time_in_seconds
* string: name|
* string: function_name
string- a particular value of config.|
* object: args
<pre style="margin:0px">var a = config.GetSetting("some_var");</pre>|
* int: loops (0 - infinite)|
Returns a server variable value by name. Basically used to read server config options from script.
int - ID of created timer|
<pre style="margin:0px">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);
}
</pre> |
Creates a timed event, which will be executed after "time_in_seconds" interval. Can be infinite loop.
}}
 
 
{{Scripting_api|ClearTimer|
* int: timer_id|
void|
<pre style="margin:0px">timer.ClearTimer(5);</pre> |
Removes timer with specified ID.
}}
}}

Latest revision as of 03:58, 5 July 2014


Config scope

Used to get access to server variables from config file.

Visibility: Global.

List of functions

GetSetting
Arguments Returns Example
  • string: name

string- a particular value of config.

var a = config.GetSetting("some_var");
Description

Returns a server variable value by name. Basically used to read server config options from script.