RigsofRods
Soft-body Physics Simulation
Data Structures | Typedefs | Enumerations | Functions | Variables
Scripting

Game scripting subsystem using AngelScript. More...

Data Structures

class  RoR::GameScript
 Proxy class that can be called by script functions. More...
 
class  RoR::LocalStorage
 A class that allows scripts to store data persistently. More...
 
class  OgreScriptBuilder
 
struct  RoR::ScriptUnit
 Represents a loaded script and all associated resources/handles. More...
 
struct  RoR::LoadScriptRequest
 
struct  RoR::ScriptCallbackArgs
 
class  RoR::ScriptEngine
 This class represents the angelscript scripting interface. More...
 
class  RoR::CReadonlyScriptDictView< T >
 
class  RoR::CReadonlyScriptArrayView< T >
 

Typedefs

typedef std::map< ScriptUnitId_t, ScriptUnitRoR::ScriptUnitMap
 
typedef BitMask_t RoR::GetFuncFlags_t
 Flags for RoR::ScriptEngine::getFunctionByDeclAndLogCandidates() More...
 

Enumerations

enum  RoR::ScriptCategory { RoR::ScriptCategory::INVALID, RoR::ScriptCategory::ACTOR, RoR::ScriptCategory::TERRAIN, RoR::ScriptCategory::CUSTOM }
 Note: Either of these can be loaded from script using game.pushMessage(MSG_APP_LOAD_SCRIPT_REQUESTED...) More...
 

Functions

void RoR::RegisterActor (AngelScript::asIScriptEngine *engine)
 defined in ActorAngelscript.cpp More...
 
void RoR::RegisterVehicleAi (AngelScript::asIScriptEngine *engine)
 defined in VehicleAiAngelscript.cpp More...
 
void RoR::RegisterInputEngine (AngelScript::asIScriptEngine *engine)
 Registers RoR::InputEngine, defined in InputEngineAngelscript.cpp. More...
 
void RoR::RegisterConsole (AngelScript::asIScriptEngine *engine)
 Registers RoR::Console, defined in ConsoleAngelscript.cpp. More...
 
void RoR::RegisterLocalStorage (AngelScript::asIScriptEngine *engine)
 Registers RoR::LocalStorage, defined in LocalStorageAngelscript.cpp. More...
 
void RoR::RegisterGameScript (AngelScript::asIScriptEngine *engine)
 Registers RoR::GameScript, defined in GameScriptAngelscript.cpp. More...
 
void RoR::RegisterScriptEvents (AngelScript::asIScriptEngine *engine)
 Registers enum scriptEvents, defined in ScriptEventsAngelscript.cpp. More...
 
void RoR::RegisterImGuiBindings (AngelScript::asIScriptEngine *engine)
 defined in ImGuiAngelscript.cpp More...
 
void RoR::RegisterOgreObjects (AngelScript::asIScriptEngine *engine)
 defined in OgreAngelscript.cpp More...
 
void RoR::RegisterTerrain (AngelScript::asIScriptEngine *engine)
 Registers RoR::Terrain, defined in TerrainAngelscript.cpp. More...
 
void RoR::RegisterProceduralRoad (AngelScript::asIScriptEngine *engine)
 defined in ProceduralRoadAngelscript.cpp More...
 
void RoR::RegisterGenericFileFormat (AngelScript::asIScriptEngine *engine)
 defined in GenericFileFormatAngelscript.cpp More...
 
void RoR::RegisterMessageQueue (AngelScript::asIScriptEngine *engine)
 Registers enum MsgType, defined in MsgQueueAngelscript.cpp. More...
 
void RoR::RegisterSoundScript (AngelScript::asIScriptEngine *engine)
 defined in SoundScriptAngelscript.cpp More...
 
void RoR::RegisterCacheSystem (AngelScript::asIScriptEngine *engine)
 defined in CacheSystemAngelscript.cpp More...
 
void RoR::TRIGGER_EVENT_ASYNC (scriptEvents type, int arg1, int arg2ex=0, int arg3ex=0, int arg4ex=0, std::string arg5ex="", std::string arg6ex="", std::string arg7ex="", std::string arg8ex="")
 Asynchronously (via MSG_SIM_SCRIPT_EVENT_TRIGGERED) invoke script function eventCallbackEx(), if registered, otherwise fall back to eventCallback() More...
 
const char * RoR::ScriptCategoryToString (ScriptCategory c)
 
template<typename T >
AngelScript::CScriptArray * RoR::VectorToScriptArray (const std::vector< T > &vec, const std::string &decl)
 
template<typename T , typename U >
AngelScript::CScriptArray * RoR::MapToScriptArray (std::map< T, U > &map, const std::string &decl)
 
template<typename ItorT >
AngelScript::CScriptArray * RoR::IterableMapToScriptArray (ItorT begin, ItorT end, const std::string &decl)
 
template<typename ItorT >
AngelScript::CScriptArray * RoR::IterableListToScriptArray (ItorT begin, ItorT end, const std::string &decl)
 
template<typename T >
bool RoR::GetValueFromScriptDict (const std::string &log_msg, AngelScript::CScriptDictionary *dict, bool required, std::string const &key, const char *decl, T &out_value)
 
template<class A , class B >
B * RoR::ScriptRefCast (A *a)
 
template<class A , class B >
B * RoR::ScriptRefCastNoCount (A *a)
 

Variables

const GetFuncFlags_t RoR::GETFUNCFLAG_OPTIONAL = 0
 Only logs warning if candidate is found, to help modder find a typo. More...
 
const GetFuncFlags_t RoR::GETFUNCFLAG_REQUIRED = BITMASK(1)
 Always logs warning that function was not found. More...
 
const GetFuncFlags_t RoR::GETFUNCFLAG_SILENT = BITMASK(2)
 Never logs. More...
 
const std::string RoR::GETFUNC_DEFAULTEVENTCALLBACK_SIGFMT = "void {}(int, string, string, int)"
 
const std::string RoR::GETFUNC_DEFAULTEVENTCALLBACK_NAME = "defaultEventCallback"
 

Detailed Description

Game scripting subsystem using AngelScript.

Typedef Documentation

◆ GetFuncFlags_t

◆ ScriptUnitMap

Definition at line 88 of file ScriptEngine.h.

Enumeration Type Documentation

◆ ScriptCategory

enum RoR::ScriptCategory
strong

Note: Either of these can be loaded from script using game.pushMessage(MSG_APP_LOAD_SCRIPT_REQUESTED...)

Enumerator
INVALID 
ACTOR 

Defined in truck file under 'scripts', contains global variable BeamClass@ thisActor.

TERRAIN 

Defined in terrn2 file under '[Scripts]', receives terrain eventbox notifications.

CUSTOM 

Loaded by user via either: A) ingame console 'loadscript'; B) RoR.cfg 'app_custom_scripts'; C) commandline '-runscript'.

Definition at line 58 of file ScriptEngine.h.

Function Documentation

◆ GetValueFromScriptDict()

template<typename T >
bool RoR::GetValueFromScriptDict ( const std::string &  log_msg,
AngelScript::CScriptDictionary *  dict,
bool  required,
std::string const &  key,
const char *  decl,
T &  out_value 
)

Definition at line 108 of file ScriptUtils.h.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ IterableListToScriptArray()

template<typename ItorT >
AngelScript::CScriptArray* RoR::IterableListToScriptArray ( ItorT  begin,
ItorT  end,
const std::string &  decl 
)

Definition at line 93 of file ScriptUtils.h.

+ Here is the call graph for this function:

◆ IterableMapToScriptArray()

template<typename ItorT >
AngelScript::CScriptArray* RoR::IterableMapToScriptArray ( ItorT  begin,
ItorT  end,
const std::string &  decl 
)

Definition at line 78 of file ScriptUtils.h.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ MapToScriptArray()

template<typename T , typename U >
AngelScript::CScriptArray* RoR::MapToScriptArray ( std::map< T, U > &  map,
const std::string &  decl 
)

Definition at line 59 of file ScriptUtils.h.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ RegisterActor()

void RoR::RegisterActor ( AngelScript::asIScriptEngine *  engine)

defined in ActorAngelscript.cpp

+ Here is the caller graph for this function:

◆ RegisterCacheSystem()

void RoR::RegisterCacheSystem ( AngelScript::asIScriptEngine *  engine)

defined in CacheSystemAngelscript.cpp

+ Here is the caller graph for this function:

◆ RegisterConsole()

void RoR::RegisterConsole ( AngelScript::asIScriptEngine *  engine)

Registers RoR::Console, defined in ConsoleAngelscript.cpp.

+ Here is the caller graph for this function:

◆ RegisterGameScript()

void RoR::RegisterGameScript ( AngelScript::asIScriptEngine *  engine)

Registers RoR::GameScript, defined in GameScriptAngelscript.cpp.

+ Here is the caller graph for this function:

◆ RegisterGenericFileFormat()

void RoR::RegisterGenericFileFormat ( AngelScript::asIScriptEngine *  engine)

defined in GenericFileFormatAngelscript.cpp

+ Here is the caller graph for this function:

◆ RegisterImGuiBindings()

void RoR::RegisterImGuiBindings ( AngelScript::asIScriptEngine *  engine)

defined in ImGuiAngelscript.cpp

Definition at line 53 of file ImGuiAngelscript.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ RegisterInputEngine()

void RoR::RegisterInputEngine ( AngelScript::asIScriptEngine *  engine)

Registers RoR::InputEngine, defined in InputEngineAngelscript.cpp.

+ Here is the caller graph for this function:

◆ RegisterLocalStorage()

void RoR::RegisterLocalStorage ( AngelScript::asIScriptEngine *  engine)

Registers RoR::LocalStorage, defined in LocalStorageAngelscript.cpp.

+ Here is the caller graph for this function:

◆ RegisterMessageQueue()

void RoR::RegisterMessageQueue ( AngelScript::asIScriptEngine *  engine)

Registers enum MsgType, defined in MsgQueueAngelscript.cpp.

+ Here is the caller graph for this function:

◆ RegisterOgreObjects()

void RoR::RegisterOgreObjects ( AngelScript::asIScriptEngine *  engine)

defined in OgreAngelscript.cpp

Definition at line 683 of file OgreAngelscript.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ RegisterProceduralRoad()

void RoR::RegisterProceduralRoad ( AngelScript::asIScriptEngine *  engine)

defined in ProceduralRoadAngelscript.cpp

+ Here is the caller graph for this function:

◆ RegisterScriptEvents()

void RoR::RegisterScriptEvents ( AngelScript::asIScriptEngine *  engine)

Registers enum scriptEvents, defined in ScriptEventsAngelscript.cpp.

+ Here is the caller graph for this function:

◆ RegisterSoundScript()

void RoR::RegisterSoundScript ( AngelScript::asIScriptEngine *  engine)

defined in SoundScriptAngelscript.cpp

Definition at line 30 of file SoundScriptAngelscript.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ RegisterTerrain()

void RoR::RegisterTerrain ( AngelScript::asIScriptEngine *  engine)

Registers RoR::Terrain, defined in TerrainAngelscript.cpp.

+ Here is the caller graph for this function:

◆ RegisterVehicleAi()

void RoR::RegisterVehicleAi ( AngelScript::asIScriptEngine *  engine)

defined in VehicleAiAngelscript.cpp

+ Here is the caller graph for this function:

◆ ScriptCategoryToString()

const char * RoR::ScriptCategoryToString ( ScriptCategory  c)

Definition at line 66 of file ScriptEngine.cpp.

+ Here is the caller graph for this function:

◆ ScriptRefCast()

template<class A , class B >
B* RoR::ScriptRefCast ( A *  a)

Definition at line 269 of file ScriptUtils.h.

◆ ScriptRefCastNoCount()

template<class A , class B >
B* RoR::ScriptRefCastNoCount ( A *  a)

Definition at line 286 of file ScriptUtils.h.

◆ TRIGGER_EVENT_ASYNC()

void RoR::TRIGGER_EVENT_ASYNC ( scriptEvents  type,
int  arg1,
int  arg2ex = 0,
int  arg3ex = 0,
int  arg4ex = 0,
std::string  arg5ex = "",
std::string  arg6ex = "",
std::string  arg7ex = "",
std::string  arg8ex = "" 
)
inline

Asynchronously (via MSG_SIM_SCRIPT_EVENT_TRIGGERED) invoke script function eventCallbackEx(), if registered, otherwise fall back to eventCallback()

Definition at line 51 of file ScriptEngine.h.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ VectorToScriptArray()

template<typename T >
AngelScript::CScriptArray* RoR::VectorToScriptArray ( const std::vector< T > &  vec,
const std::string &  decl 
)

Definition at line 42 of file ScriptUtils.h.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Variable Documentation

◆ GETFUNC_DEFAULTEVENTCALLBACK_NAME

const std::string RoR::GETFUNC_DEFAULTEVENTCALLBACK_NAME = "defaultEventCallback"

Definition at line 113 of file ScriptEngine.h.

◆ GETFUNC_DEFAULTEVENTCALLBACK_SIGFMT

const std::string RoR::GETFUNC_DEFAULTEVENTCALLBACK_SIGFMT = "void {}(int, string, string, int)"

Definition at line 112 of file ScriptEngine.h.

◆ GETFUNCFLAG_OPTIONAL

const GetFuncFlags_t RoR::GETFUNCFLAG_OPTIONAL = 0

Only logs warning if candidate is found, to help modder find a typo.

Definition at line 107 of file ScriptEngine.h.

◆ GETFUNCFLAG_REQUIRED

const GetFuncFlags_t RoR::GETFUNCFLAG_REQUIRED = BITMASK(1)

Always logs warning that function was not found.

Definition at line 108 of file ScriptEngine.h.

◆ GETFUNCFLAG_SILENT

const GetFuncFlags_t RoR::GETFUNCFLAG_SILENT = BITMASK(2)

Never logs.

Definition at line 109 of file ScriptEngine.h.