RigsofRods
Soft-body Physics Simulation
Namespaces | Functions
Game-to-script

^AngelScript^ Documents script functions (callbacks) invoked by the game. More...

+ Collaboration diagram for Game-to-script:

Namespaces

 Game2Script
 Pseudo-namespace; it doesn't exist in code or script runtime, only in this documentation.
 

Functions

void Game2Script::main ()
 Required; Script setup function - invoked once when script is loaded. More...
 
void Game2Script::frameStep (float dt)
 Optional; Script update function - invoked once every rendered frame. More...
 
void Game2Script::eventCallback (Script2Game::scriptEvents event, int param)
 Optional; Invoked if a registered event is triggered, see GameScriptClass::registerForEvent(). More...
 
void Game2Script::eventCallbackEx (Script2Game::scriptEvents event, int arg1, int arg2ex, int arg3ex, int arg4ex, string arg5ex, string arg6ex, string arg7ex, string arg8ex)
 Optional; if present, will be used instead of Game2Script::eventCallback(). More...
 
void Game2Script::defaultEventCallback (int trigger_type, string inst, string box, int nodeid)
 OBSOLETE, ONLY WORKS WITH TERRAIN SCRIPTS - Use eventCallbackEx() with event SE_EVENTBOX_ENTER instead, it does the same job and works with any script. More...
 

Detailed Description

^AngelScript^ Documents script functions (callbacks) invoked by the game.

Function Documentation

◆ defaultEventCallback()

void Game2Script::defaultEventCallback ( int  trigger_type,
string  inst,
string  box,
int  nodeid 
)

OBSOLETE, ONLY WORKS WITH TERRAIN SCRIPTS - Use eventCallbackEx() with event SE_EVENTBOX_ENTER instead, it does the same job and works with any script.

Optional; Invoked when a vehicle touches an eventbox which has no custom handler function. This is a legacy feature which pre-dates generic events SE_EVENTBOX_ENTER and SE_EVENTBOX_EXIT and bundled objects like truckshop/spawners still rely on it.

Parameters
trigger_typeUnused, always 0.
instUnique ID of the terrain object instance which created the eventbox.
boxName of the eventbox as defined by the terrain object's ODEF file.
nodeidNumber of the node which triggered the event, or -1 if not known.

◆ eventCallback()

void Game2Script::eventCallback ( Script2Game::scriptEvents  event,
int  param 
)

Optional; Invoked if a registered event is triggered, see GameScriptClass::registerForEvent().

Parameters
eventEvent code.
paramEvent-specific parameter, see docs for the event codes.

◆ eventCallbackEx()

void Game2Script::eventCallbackEx ( Script2Game::scriptEvents  event,
int  arg1,
int  arg2ex,
int  arg3ex,
int  arg4ex,
string  arg5ex,
string  arg6ex,
string  arg7ex,
string  arg8ex 
)

Optional; if present, will be used instead of Game2Script::eventCallback().

Invoked if a registered event is triggered, see GameScriptClass::registerForEvent(). The first argument is the same as eventCallback() gets, other are extras, see descriptions at Script2Game::scriptEvents.

Parameters
eventEvent code.

◆ frameStep()

void Game2Script::frameStep ( float  dt)

Optional; Script update function - invoked once every rendered frame.

Parameters
dtElapsed time (delta time) in seconds.

◆ main()

void Game2Script::main ( )

Required; Script setup function - invoked once when script is loaded.

If not present, the game will report error and abandon the script.