Simutrans-Squirrel-API OTRP v63_4
Loading...
Searching...
No Matches
api_skeleton.h File Reference

Go to the source code of this file.

Variables

struct { 
   string   short_description 
 Short description of scenario, is shown for example in finance window. More...
   string   author 
 Author(s) of the scenario and/or scripts. More...
   string   version 
 Version of script. More...
   string   api 
 Required version of api. More...
} scenario
struct { 
   string   file 
} map
table persistent
 Persistent data should go into this table.

Detailed Description

Documents the global variables in a scenario script

Definition in file api_skeleton.h.

Variable Documentation

◆ api

string api

Required version of api.

Script requires this version of api. Corresponds to release numbers (e.g. 112.3). Set it to "*" to support nightly versions. If this string is not set, the default "112.3" will be used.

See also
get_api_version

Definition at line 19 of file api_skeleton.h.

◆ author

string author

Author(s) of the scenario and/or scripts.

Definition at line 7 of file api_skeleton.h.

◆ file

string file

Name of savegame. The scenario starts with the world saved there. If file == "<attach>" then do not load a saved, attach the scenario to the running world instead.

See also
get_map_file

Definition at line 34 of file api_skeleton.h.

◆ [struct]

struct { ... } map

Information about game map/world.

◆ persistent

table persistent

Persistent data should go into this table.

Only this table is saved and reloaded with an savegame. Only plain data is saved: no classes / functions, no cyclic references.

Instances of classes can be saved if (1) the class implements the function _save that (2) returns something which can reconstruct the instance, i.e. an constructor call, embedded in a string.

class my_class_with_save {
foo = 0
constructor(f)
{
foo = f;
}
function _save()
{
return "my_class_with_save("+ foo + ")"
}
}

Definition at line 67 of file api_skeleton.h.

◆ [struct]

struct { ... } scenario

Meta information about the scenario.

◆ short_description

string short_description

Short description of scenario, is shown for example in finance window.

Definition at line 5 of file api_skeleton.h.

◆ version

string version

Version of script.

Definition at line 9 of file api_skeleton.h.