AngelScript scripting quickstart guide.

only_a_ptr

Infamous Developer
Administrator
Developer
Joined
Jan 31, 2018
Messages
167
Location
Prague, CZ
We have a decently-capable scripting environment, and it will get expanded in a close future. This thread should be a catch-all introductory spot.
Credit is due: the scripting subsystem, along with a race manager script, was developed by former member 'neorej16' in circa 2010 - correct me if I'm wrong.

What's the programming language?

AngelScript http://www.angelcode.com/angelscript/ is a high-performance scripting library written with games in mind. The author provides support at GameDev forums: https://www.gamedev.net/forums/forum/34-angelcode/.

The language itself resembles C++/C#/Java, source files have extension ".as". The official documentation is exellently written: http://www.angelcode.com/angelscript/sdk/docs/manual/index.html

What can scripts do?
What docs do we provide?

Online docs:

In game help:
How to run a script?

Either by including it with terrain or invoking by hand:
  1. By including the ".as" file(s) with terrain - see terrn2 fileformat, section '[Scripts]': https://docs.rigsofrods.org/terrain-creation/terrn2-subsystem/. This is the classic old method, used for i.e. races and event boxes. Note that if no script is provided, a bundled "default.as" is invoked. It provides the basic handling for spawners, garages and races.
  2. By placing the ".as" file(s) in 'Documents\My Games\Rigs of Rods\Scripts' and:
    1. [since 2022.04] running the game with command line parameter '-runscript <filename>'. You can use this command multiple times at once.
    2. [since 2022.04] setting 'app_custom_scripts' in RoR.cfg to a comma-separated list of filenames. Spaces in filename are acceptable.
    3. [dev build only] in game, opening console (tilde key) and using command `loadscript <filename>`.
How to diagnose scripts?
Any questions?

Ask right in this thread!
 
Last edited:
Back
Top