RigsofRods
Soft-body Physics Simulation
|
Binding of RoR::GameScript; A general class that will provide you with general functions. More...
#include <GameScriptClass.h>
Public Member Functions | |
General | |
void | log (string message) |
writes a message to the scripting logbook (AngelScript.log) More... | |
double | getTime () |
returns the time in seconds since the game was started More... | |
float | rangeRandom (float from, float to) |
Generates a random number between from and to. More... | |
int | useOnlineAPI (const string apiquery, const dictionary dict, string result) |
Sends or request information from the master server. More... | |
void | getFPS () |
Gets the Curent frames per second (FPS) More... | |
void | getAvgFPS () |
Gets the average frames per second (FPS) More... | |
void | backToMenu () |
Back to menu. More... | |
void | quitGame () |
Quits the game. More... | |
bool | pushMessage (MsgType type, dictionary@ dict) |
Pushes a message to internal message queue. More... | |
bool | checkResourceExists (const string &in filename, const string &in resource_group) |
Checks if the resource file exists in the given group. More... | |
bool | deleteResource (const string &in filename, const string &in resource_group) |
Deletes a resource from the given group. More... | |
std::string | loadTextResourceAsString (const string &in filename, const string &in resource_group) |
Loads a text file resource as string. More... | |
bool | createTextResourceFromString (const string &in, const string &in filename, const string &in resource_group, bool overwrite=false) |
Saves a string as a text file resource. More... | |
AngelOgre::SceneManager | getSceneManager () |
Retrieves the OGRE scene manager object. More... | |
void | openUrlInDefaultBrowser (const std::string &url) |
Opens URL (must start with 'http://' or 'https://') in system's default web browser. More... | |
void | fetchUrlAsStringAsync (const std::string &url, const std::string &display_filename) |
Invokes a background thread to fetch data using CURL; when finished, sends MSG_APP_SCRIPT_THREAD_STATUS + Payload = RoR::ScriptEventArgs* (owner) - see SE_ANGELSCRIPT_THREAD_STATUS for arguments. More... | |
GUI | |
void | flashMessage (string message, float time, float charHeight) |
shows a message to the user More... | |
void | message (string txt, string icon, float timeMilliseconds, bool forceVisible) |
shows a message to the user More... | |
int | getChatFontSize () |
OBSOLETE - returns 0. More... | |
void | setChatFontSize (int size) |
OBSOLETE - does nothing. More... | |
void | showMessageBox (string mTitle, stringmText, bool button1, stringmButton1, bool AllowClose, bool button2, stringmButton2) |
Shows a message box. More... | |
void | showChooser (string type, string instance, string box) |
This shows a vehicle chooser. More... | |
void | updateDirectionArrow (string text, vector3 position) |
set direction arrow More... | |
void | hideDirectionArrow () |
Hides the direction arrow. More... | |
bool | getScreenPosFromWorldPos (const vector3 &in, vector2 &out) |
vector2 | getDisplaySize () |
Gets screen size in pixels. More... | |
Ogre::Vector2 | getMouseScreenPosition () |
Gets mouse position in pixels. More... | |
Script management | |
void | registerForEvent (int eventValue) |
registers for a new event to be received by the scripting system More... | |
void | unRegisterEvent (int eventValue) |
unregisters from receiving event. More... | |
BitMask_t | getRegisteredEventsMask (ScriptUnitId_t nid) |
Gets event mask for a specific running script. More... | |
void | setRegisteredEventsMask (ScriptUnitId_t nid, BitMask_t eventMask) |
Overwrites event mask for a specific running script. More... | |
int | addScriptFunction (const string func) |
Adds a global function to the script. More... | |
int | scriptFunctionExists (const string func) |
Checks if a global function exists. More... | |
int | deleteScriptFunction (const string func) |
Removes a global function from the script. More... | |
int | addScriptVariable (const string var) |
Adds a global variable to the script. More... | |
int | deleteScriptVariable (const string var) |
Removes a global variable from the script. More... | |
void | clearEventCache () |
Clears the event cache. More... | |
int | sendGameCmd (const string &message) |
Multiplayer only: sends AngelScript snippet to all players. More... | |
array< int > | getRunningScripts () |
Returns active ScriptUnitIDs; check agains global var thisScript or use getScriptDetails() to get name etc... More... | |
dictionary | getScriptDetails (int nid) |
Returns all info about running script; obtain the NID from getRunningScripts() , global var thisScript or event callbacks: More... | |
Terrain | |
void | loadTerrain (string terrain) |
Loads a terrain. More... | |
int | getLoadedTerrain (string result) |
Gets the currently loaded terrain name. More... | |
TerrainClass | getTerrain () |
Gets the currently loaded terrain instance. More... | |
bool | getCaelumAvailable () |
Checks if Caleum is enabled. More... | |
string | getCaelumTime () |
gets the time of the day in seconds More... | |
void | setCaelumTime (float value) |
sets the time of the day in seconds More... | |
float | getGravity () |
returns the currently set upo gravity More... | |
void | setGravity (float value) |
sets the gravity terrain wide. More... | |
float | getWaterHeight () |
returns the current base water level (without waves) More... | |
float | getGroundHeight (vector3 position) |
returns the ground height for a position More... | |
void | setWaterHeight (float value) |
sets the base water height More... | |
void | spawnObject (const string objectName, const string instanceName, vector3 pos, vector3 rot, const string eventhandler, bool uniquifyMaterials) |
This spawns an object. More... | |
void | moveObjectVisuals (const string instanceName, const vector3 pos) |
This moves an object to a new position. More... | |
void | destroyObject (const string instanceName) |
This destroys an object. More... | |
bool | getMousePositionOnTerrain (vector3 &out) |
Calculates mouse cursor position on terrain. More... | |
Character | |
vector3 | getPersonPosition () |
Returns the current position of the person. More... | |
void | setPersonPosition (vector3 vec) |
sets the character position More... | |
void | movePerson (vector3 relative_movement) |
moves the person relative More... | |
void | setPersonRotation (radian &in) |
radian | getPersonRotation () |
Actors | |
void | activateAllVehicles () |
void | setTrucksForcedAwake (bool forceActive) |
void | boostCurrentTruck (float factor) |
Gives the currently used truck a boost in RPM. More... | |
BeamClass | getCurrentTruck () |
returns the current selected truck, null if in person mode More... | |
BeamClass | getTruckByNum (int truck_number) |
Get an actor by Instance ID, get one from eventCallbackEx() or manually by BeamClass::getInstanceId() . More... | |
array< BeamClass@> | getAllTrucks () |
returns an array of all currently existing actors. More... | |
int | getCurrentTruckNumber () |
returns the instance ID of current player vehicle, or -1 when in person mode More... | |
BeamClass | spawnTruck (stringtruckName, vector3 pos, vector3 rot) |
Spawns a truck by filename. More... | |
void | repairVehicle (string instance, string box, bool keepPosition) |
This method repairs the vehicle in the box. More... | |
void | removeVehicle (string instance, string box) |
This method removes the vehicle in the box. More... | |
int | getNumTrucksByFlag (int flag) |
Number of trucks with flag. More... | |
Waypoint AI for Actors | |
to understand these values, run the game and look in TopMenubar UI->VehicleAI tab. | |
BeamClass | spawnTruckAI (string truckName, vector3 pos, string truckSectionConfig, string truckSkin, int x) |
array< vector3 > | getWaypoints (int x) |
void | addWaypoint (vector3 pos) |
int | getAIVehicleCount () |
int | getAIVehicleDistance () |
int | getAIVehiclePositionScheme () |
int | getAIVehicleSpeed () |
Ogre::String | getAIVehicleName (int x) |
Ogre::String | getAIVehicleSectionConfig (int x) |
std::string | getAIVehicleSkin (int x) |
int | getAIRepeatTimes () |
int | getAIMode () |
VehicleAIClass | getCurrentTruckAI () |
VehicleAIClass | getTruckAIByNum (int num) |
void | setAIVehicleCount (int count) |
void | setAIVehicleDistance (int dist) |
void | setAIVehiclePositionScheme (int scheme) |
void | setAIVehicleSpeed (int speed) |
void | setAIVehicleName (int x, string name) |
void | setAIVehicleSectionConfig (int x, string config) |
void | setAIVehicleSkin (int x, string skin) |
void | setAIRepeatTimes (int times) |
void | setAIMode (int mode) |
Camera | |
void | setCameraPosition (vector3 position) |
Sets the camera's position. More... | |
void | setCameraDirection (vector3 direction) |
Sets the camera's direction vector. More... | |
void | setCameraRoll (float angle) |
Rolls the camera anticlockwise, around its local z axis. More... | |
void | setCameraYaw (float angle) |
Rotates the camera anticlockwise around it's local y axis. More... | |
void | setCameraPitch (float angle) |
Pitches the camera up/down anticlockwise around it's local z axis. More... | |
vector3 | getCameraPosition () |
Retrieves the camera's position. More... | |
vector3 | getCameraDirection () |
Gets the camera's direction. More... | |
void | cameraLookAt (vector3 targetPoint) |
Points the camera at a location in worldspace. More... | |
Race system | |
float | stopTimer () |
Stops the timer. More... | |
void | startTimer () |
Starts a timer (useful for races etc) More... | |
Material helpers | |
int | setMaterialAmbient (const string materialName, float red, float green, float blue) |
int | setMaterialDiffuse (const string materialName, float red, float green, float blue, float alpha) |
int | setMaterialSpecular (const string materialName, float red, float green, float blue, float alpha) |
int | setMaterialEmissive (const string materialName, float red, float green, float blue) |
int | setMaterialTextureName (const string materialName, int techniqueNum, int passNum, int textureUnitNum, const string textureName) |
int | setMaterialTextureRotate (const string materialName, int techniqueNum, int passNum, int textureUnitNum, float rotation) |
int | setMaterialTextureScroll (const string materialName, int techniqueNum, int passNum, int textureUnitNum, float sx, float sy) |
int | setMaterialTextureScale (const string materialName, int techniqueNum, int passNum, int textureUnitNum, float u, float v) |
Audio | |
array< SoundScriptTemplateClass > | getAllSoundScriptTemplates () |
SoundScriptTemplateClass | getSoundScriptTemplate (const string &in name) |
Retrieves one sound script template by name. More... | |
array< SoundScriptInstanceClass > | getAllSoundScriptInstances () |
Diagnostic function, returns all existing sound script instances. More... | |
SoundClass | createSoundFromResource (const string &in filename, const string &in resource_group_name=string()) |
SoundScriptInstanceClass | createSoundScriptInstance (const string &in template_name, int actor_instance_id=-1) |
Binding of RoR::GameScript; A general class that will provide you with general functions.
game
. E.g.: you can log a message using game.log("Hi, I'm a message"); Definition at line 35 of file GameScriptClass.h.
void Script2Game::GameScriptClass::activateAllVehicles | ( | ) |
int Script2Game::GameScriptClass::addScriptFunction | ( | const string | func | ) |
Adds a global function to the script.
func | the function to be added, e.g.: "void func() { log('works'); }" |
int Script2Game::GameScriptClass::addScriptVariable | ( | const string | var | ) |
Adds a global variable to the script.
var | the declaration of the variable that should be added, e.g.: "int missionState;" |
void Script2Game::GameScriptClass::addWaypoint | ( | vector3 | pos | ) |
void Script2Game::GameScriptClass::backToMenu | ( | ) |
Back to menu.
void Script2Game::GameScriptClass::boostCurrentTruck | ( | float | factor | ) |
Gives the currently used truck a boost in RPM.
factor | This factor determines by how much that the RPM of the truck will be increased ( rpm += 2000.0f * factor ). |
void Script2Game::GameScriptClass::cameraLookAt | ( | vector3 | targetPoint | ) |
Points the camera at a location in worldspace.
targetPoint | A vector specifying the look at point. |
bool Script2Game::GameScriptClass::checkResourceExists | ( | const string &in | filename, |
const string &in | resource_group | ||
) |
Checks if the resource file exists in the given group.
KNOWN LIMITATION: If existing file is deleted externally, this function will still report it exists until the resource group is reloaded.
void Script2Game::GameScriptClass::clearEventCache | ( | ) |
Clears the event cache.
SoundClass Script2Game::GameScriptClass::createSoundFromResource | ( | const string &in | filename, |
const string &in | resource_group_name = string() |
||
) |
filename | WAV file; This WAV file MUST be mono, and exported as 16-bit PCM with no metadata. |
resource_group_name | Leave empty to auto-search all groups (classic behavior). |
SoundScriptInstanceClass Script2Game::GameScriptClass::createSoundScriptInstance | ( | const string &in | template_name, |
int | actor_instance_id = -1 |
||
) |
template_name | Name defined in the '.soundscript' file. |
actor_instance_id | Values 0 and larger are reserved as actor instance IDs, see getTruckByNum() ; -1 means undefined, -2 is reserved for terrain objects. |
bool Script2Game::GameScriptClass::createTextResourceFromString | ( | const string & | in, |
const string &in | filename, | ||
const string &in | resource_group, | ||
bool | overwrite = false |
||
) |
Saves a string as a text file resource.
data | The file data. |
filename | Resource name within the resource group, equivalent to filename without path. |
resource_group | Name of resource group to save to. If the group has multiple locations, first writable location is used. |
overwrite | By default existing resources are not overwriten. |
bool Script2Game::GameScriptClass::deleteResource | ( | const string &in | filename, |
const string &in | resource_group | ||
) |
Deletes a resource from the given group.
int Script2Game::GameScriptClass::deleteScriptFunction | ( | const string | func | ) |
Removes a global function from the script.
func | the declaration of the function that should be removed, e.g.: "void func()" |
int Script2Game::GameScriptClass::deleteScriptVariable | ( | const string | var | ) |
Removes a global variable from the script.
var | the declaration of the variable that should be removed, e.g.: "int missionState;" |
void Script2Game::GameScriptClass::destroyObject | ( | const string | instanceName | ) |
This destroys an object.
instanceName | The unique name that you chose when spawning this object |
void Script2Game::GameScriptClass::fetchUrlAsStringAsync | ( | const std::string & | url, |
const std::string & | display_filename | ||
) |
Invokes a background thread to fetch data using CURL; when finished, sends MSG_APP_SCRIPT_THREAD_STATUS + Payload = RoR::ScriptEventArgs* (owner) - see SE_ANGELSCRIPT_THREAD_STATUS
for arguments.
void Script2Game::GameScriptClass::flashMessage | ( | string | message, |
float | time, | ||
float | charHeight | ||
) |
shows a message to the user
message | The message to be shown |
time | How long the message should be shown (in seconds) |
charHeight | The font size to be used (use -1 for the default size) |
int Script2Game::GameScriptClass::getAIMode | ( | ) |
int Script2Game::GameScriptClass::getAIRepeatTimes | ( | ) |
int Script2Game::GameScriptClass::getAIVehicleCount | ( | ) |
int Script2Game::GameScriptClass::getAIVehicleDistance | ( | ) |
Ogre::String Script2Game::GameScriptClass::getAIVehicleName | ( | int | x | ) |
int Script2Game::GameScriptClass::getAIVehiclePositionScheme | ( | ) |
Ogre::String Script2Game::GameScriptClass::getAIVehicleSectionConfig | ( | int | x | ) |
std::string Script2Game::GameScriptClass::getAIVehicleSkin | ( | int | x | ) |
int Script2Game::GameScriptClass::getAIVehicleSpeed | ( | ) |
array<SoundScriptInstanceClass> Script2Game::GameScriptClass::getAllSoundScriptInstances | ( | ) |
Diagnostic function, returns all existing sound script instances.
array<SoundScriptTemplateClass> Script2Game::GameScriptClass::getAllSoundScriptTemplates | ( | ) |
array<BeamClass@> Script2Game::GameScriptClass::getAllTrucks | ( | ) |
returns an array of all currently existing actors.
void Script2Game::GameScriptClass::getAvgFPS | ( | ) |
Gets the average frames per second (FPS)
bool Script2Game::GameScriptClass::getCaelumAvailable | ( | ) |
Checks if Caleum is enabled.
string Script2Game::GameScriptClass::getCaelumTime | ( | ) |
gets the time of the day in seconds
vector3 Script2Game::GameScriptClass::getCameraDirection | ( | ) |
Gets the camera's direction.
vector3 Script2Game::GameScriptClass::getCameraPosition | ( | ) |
Retrieves the camera's position.
int Script2Game::GameScriptClass::getChatFontSize | ( | ) |
BeamClass Script2Game::GameScriptClass::getCurrentTruck | ( | ) |
returns the current selected truck, null if in person mode
VehicleAIClass Script2Game::GameScriptClass::getCurrentTruckAI | ( | ) |
int Script2Game::GameScriptClass::getCurrentTruckNumber | ( | ) |
returns the instance ID of current player vehicle, or -1 when in person mode
vector2 Script2Game::GameScriptClass::getDisplaySize | ( | ) |
Gets screen size in pixels.
void Script2Game::GameScriptClass::getFPS | ( | ) |
Gets the Curent frames per second (FPS)
float Script2Game::GameScriptClass::getGravity | ( | ) |
returns the currently set upo gravity
float Script2Game::GameScriptClass::getGroundHeight | ( | vector3 | position | ) |
returns the ground height for a position
position | The position for which the height should be returned |
int Script2Game::GameScriptClass::getLoadedTerrain | ( | string | result | ) |
Gets the currently loaded terrain name.
result | This string will contain the name of the terrain after you called this function |
bool Script2Game::GameScriptClass::getMousePositionOnTerrain | ( | vector3 & | out | ) |
Calculates mouse cursor position on terrain.
out_pos | Calculated position, in meters. |
Ogre::Vector2 Script2Game::GameScriptClass::getMouseScreenPosition | ( | ) |
Gets mouse position in pixels.
int Script2Game::GameScriptClass::getNumTrucksByFlag | ( | int | flag | ) |
Number of trucks with flag.
vector3 Script2Game::GameScriptClass::getPersonPosition | ( | ) |
Returns the current position of the person.
radian Script2Game::GameScriptClass::getPersonRotation | ( | ) |
BitMask_t Script2Game::GameScriptClass::getRegisteredEventsMask | ( | ScriptUnitId_t | nid | ) |
Gets event mask for a specific running script.
Intended for diagnostic and monitoring purposes.
nid | ScriptUnitID, obtain one from global var thisScript or callback parameters. |
array<int> Script2Game::GameScriptClass::getRunningScripts | ( | ) |
Returns active ScriptUnitIDs; check agains global var thisScript
or use getScriptDetails()
to get name etc...
AngelOgre::SceneManager Script2Game::GameScriptClass::getSceneManager | ( | ) |
Retrieves the OGRE scene manager object.
bool Script2Game::GameScriptClass::getScreenPosFromWorldPos | ( | const vector3 & | in, |
vector2 & | out | ||
) |
world_pos | The world position to be converted, in meters. |
out_screen_pos | The resulting screen position, in pixels. |
dictionary Script2Game::GameScriptClass::getScriptDetails | ( | int | nid | ) |
Returns all info about running script; obtain the NID from getRunningScripts()
, global var thisScript
or event callbacks:
SoundScriptTemplateClass Script2Game::GameScriptClass::getSoundScriptTemplate | ( | const string &in | name | ) |
Retrieves one sound script template by name.
TerrainClass Script2Game::GameScriptClass::getTerrain | ( | ) |
Gets the currently loaded terrain instance.
double Script2Game::GameScriptClass::getTime | ( | ) |
returns the time in seconds since the game was started
VehicleAIClass Script2Game::GameScriptClass::getTruckAIByNum | ( | int | num | ) |
BeamClass Script2Game::GameScriptClass::getTruckByNum | ( | int | truck_number | ) |
Get an actor by Instance ID, get one from eventCallbackEx()
or manually by BeamClass::getInstanceId()
.
truck_number | Actor instance ID. |
float Script2Game::GameScriptClass::getWaterHeight | ( | ) |
returns the current base water level (without waves)
array<vector3> Script2Game::GameScriptClass::getWaypoints | ( | int | x | ) |
void Script2Game::GameScriptClass::hideDirectionArrow | ( | ) |
Hides the direction arrow.
void Script2Game::GameScriptClass::loadTerrain | ( | string | terrain | ) |
Loads a terrain.
terrain | The name of the terrain |
std::string Script2Game::GameScriptClass::loadTextResourceAsString | ( | const string &in | filename, |
const string &in | resource_group | ||
) |
Loads a text file resource as string.
filename | Resource name within the resource group, equivalent to filename without path. |
resource_group | Name of resource group to load from |
void Script2Game::GameScriptClass::log | ( | string | message | ) |
writes a message to the scripting logbook (AngelScript.log)
message | string to log |
void Script2Game::GameScriptClass::message | ( | string | txt, |
string | icon, | ||
float | timeMilliseconds, | ||
bool | forceVisible | ||
) |
shows a message to the user
txt | The message to be shown |
icon | The filename of the icon to be shown in front of the message. |
timeMilliseconds | How long the message should be shown (in milliseconds) |
forceVisible | Set this to true if you want the message to be forced on the user's screen (~it will show, even when the GUI is hidden). |
void Script2Game::GameScriptClass::moveObjectVisuals | ( | const string | instanceName, |
const vector3 | pos | ||
) |
This moves an object to a new position.
instanceName | The unique name that you chose when spawning this object |
pos | The position where the object should be moved to |
void Script2Game::GameScriptClass::movePerson | ( | vector3 | relative_movement | ) |
moves the person relative
relative_movement | X, Y and Z coordinate of the translation |
void Script2Game::GameScriptClass::openUrlInDefaultBrowser | ( | const std::string & | url | ) |
bool Script2Game::GameScriptClass::pushMessage | ( | MsgType | type, |
dictionary@ | dict | ||
) |
Pushes a message to internal message queue.
Parameters are listed in Script2Game::MsgType
comments.
void Script2Game::GameScriptClass::quitGame | ( | ) |
Quits the game.
float Script2Game::GameScriptClass::rangeRandom | ( | float | from, |
float | to | ||
) |
Generates a random number between from and to.
from | The generated number will be higher than this number |
to | The generated number will be lower than this number |
void Script2Game::GameScriptClass::registerForEvent | ( | int | eventValue | ) |
registers for a new event to be received by the scripting system
eventValue |
void Script2Game::GameScriptClass::removeVehicle | ( | string | instance, |
string | box | ||
) |
This method removes the vehicle in the box.
void Script2Game::GameScriptClass::repairVehicle | ( | string | instance, |
string | box, | ||
bool | keepPosition | ||
) |
This method repairs the vehicle in the box.
int Script2Game::GameScriptClass::scriptFunctionExists | ( | const string | func | ) |
Checks if a global function exists.
func | the declaration of the function that should be checked for existance, e.g.: "void func()" |
int Script2Game::GameScriptClass::sendGameCmd | ( | const string & | message | ) |
Multiplayer only: sends AngelScript snippet to all players.
void Script2Game::GameScriptClass::setAIMode | ( | int | mode | ) |
void Script2Game::GameScriptClass::setAIRepeatTimes | ( | int | times | ) |
void Script2Game::GameScriptClass::setAIVehicleCount | ( | int | count | ) |
void Script2Game::GameScriptClass::setAIVehicleDistance | ( | int | dist | ) |
void Script2Game::GameScriptClass::setAIVehicleName | ( | int | x, |
string | name | ||
) |
void Script2Game::GameScriptClass::setAIVehiclePositionScheme | ( | int | scheme | ) |
void Script2Game::GameScriptClass::setAIVehicleSectionConfig | ( | int | x, |
string | config | ||
) |
void Script2Game::GameScriptClass::setAIVehicleSkin | ( | int | x, |
string | skin | ||
) |
void Script2Game::GameScriptClass::setAIVehicleSpeed | ( | int | speed | ) |
void Script2Game::GameScriptClass::setCaelumTime | ( | float | value | ) |
sets the time of the day in seconds
value | day time in seconds |
void Script2Game::GameScriptClass::setCameraDirection | ( | vector3 | direction | ) |
Sets the camera's direction vector.
direction | A vector representing the direction of the vector. |
void Script2Game::GameScriptClass::setCameraPitch | ( | float | angle | ) |
Pitches the camera up/down anticlockwise around it's local z axis.
angle | The pitch-angle |
void Script2Game::GameScriptClass::setCameraPosition | ( | vector3 | position | ) |
Sets the camera's position.
position | The new position of the camera. |
void Script2Game::GameScriptClass::setCameraRoll | ( | float | angle | ) |
Rolls the camera anticlockwise, around its local z axis.
angle | The roll-angle |
void Script2Game::GameScriptClass::setCameraYaw | ( | float | angle | ) |
Rotates the camera anticlockwise around it's local y axis.
angle | The yaw-angle |
void Script2Game::GameScriptClass::setChatFontSize | ( | int | size | ) |
void Script2Game::GameScriptClass::setGravity | ( | float | value | ) |
sets the gravity terrain wide.
This is an expensive call, since the masses of all trucks are recalculated.
value | new gravity terrain wide (default is -9.81) |
int Script2Game::GameScriptClass::setMaterialAmbient | ( | const string | materialName, |
float | red, | ||
float | green, | ||
float | blue | ||
) |
int Script2Game::GameScriptClass::setMaterialDiffuse | ( | const string | materialName, |
float | red, | ||
float | green, | ||
float | blue, | ||
float | alpha | ||
) |
int Script2Game::GameScriptClass::setMaterialEmissive | ( | const string | materialName, |
float | red, | ||
float | green, | ||
float | blue | ||
) |
int Script2Game::GameScriptClass::setMaterialSpecular | ( | const string | materialName, |
float | red, | ||
float | green, | ||
float | blue, | ||
float | alpha | ||
) |
int Script2Game::GameScriptClass::setMaterialTextureName | ( | const string | materialName, |
int | techniqueNum, | ||
int | passNum, | ||
int | textureUnitNum, | ||
const string | textureName | ||
) |
int Script2Game::GameScriptClass::setMaterialTextureRotate | ( | const string | materialName, |
int | techniqueNum, | ||
int | passNum, | ||
int | textureUnitNum, | ||
float | rotation | ||
) |
int Script2Game::GameScriptClass::setMaterialTextureScale | ( | const string | materialName, |
int | techniqueNum, | ||
int | passNum, | ||
int | textureUnitNum, | ||
float | u, | ||
float | v | ||
) |
int Script2Game::GameScriptClass::setMaterialTextureScroll | ( | const string | materialName, |
int | techniqueNum, | ||
int | passNum, | ||
int | textureUnitNum, | ||
float | sx, | ||
float | sy | ||
) |
void Script2Game::GameScriptClass::setPersonPosition | ( | vector3 | vec | ) |
sets the character position
vec | X, Y and Z coordinate of the position on the terrain |
void Script2Game::GameScriptClass::setPersonRotation | ( | radian & | in | ) |
void Script2Game::GameScriptClass::setRegisteredEventsMask | ( | ScriptUnitId_t | nid, |
BitMask_t | eventMask | ||
) |
Overwrites event mask for a specific running script.
Intended for debugging tools - use with caution.
nid | ScriptUnitID, obtain one from global var thisScript or callback parameters. |
eventMask |
void Script2Game::GameScriptClass::setTrucksForcedAwake | ( | bool | forceActive | ) |
void Script2Game::GameScriptClass::setWaterHeight | ( | float | value | ) |
sets the base water height
value | base height in meters |
void Script2Game::GameScriptClass::showChooser | ( | string | type, |
string | instance, | ||
string | box | ||
) |
This shows a vehicle chooser.
type | A string specifying the type of the chooser. You can choose out of the following:
|
instance | the unique name of the object with the event box in which the truck/load should be spawned |
box | the name of the box in which the truck will be spawned |
void Script2Game::GameScriptClass::showMessageBox | ( | string | mTitle, |
stringmText | , | ||
bool | button1, | ||
stringmButton1 | , | ||
bool | AllowClose, | ||
bool | button2, | ||
stringmButton2 | |||
) |
Shows a message box.
mTitle | The box title |
mText | The box content text |
button1 | Set to true to show the first button |
mButton1 | The text in the first button |
AllowClose | If set to true the user can close the box by pressing the X in the top-right |
button2 | Set to true to show the second button |
mButton2 | The text in the second button |
void Script2Game::GameScriptClass::spawnObject | ( | const string | objectName, |
const string | instanceName, | ||
vector3 | pos, | ||
vector3 | rot, | ||
const string | eventhandler, | ||
bool | uniquifyMaterials | ||
) |
This spawns an object.
objectName | The name of the object (~the name of the odef file, but without the .odef extension) |
instanceName | A unique name for this object (you can choose one, but make sure that you don't use the same name twice) |
pos | The position where the object should be spawned |
rot | The rotation in which the object should be spawned |
eventhandler | A name of a function that should be called when an event happens (events, as defined in the object definition file). Enter empty string to ignore events. |
uniquifyMaterials | Set this to true if you need to uniquify the materials |
BeamClass Script2Game::GameScriptClass::spawnTruck | ( | stringtruckName | , |
vector3 | pos, | ||
vector3 | rot | ||
) |
Spawns a truck by filename.
truckName | The filename of the truck |
pos | The position where the truck should be spawned |
rot | The rotation in which the truck should be spawned |
BeamClass Script2Game::GameScriptClass::spawnTruckAI | ( | string | truckName, |
vector3 | pos, | ||
string | truckSectionConfig, | ||
string | truckSkin, | ||
int | x | ||
) |
void Script2Game::GameScriptClass::startTimer | ( | ) |
Starts a timer (useful for races etc)
float Script2Game::GameScriptClass::stopTimer | ( | ) |
void Script2Game::GameScriptClass::unRegisterEvent | ( | int | eventValue | ) |
void Script2Game::GameScriptClass::updateDirectionArrow | ( | string | text, |
vector3 | position | ||
) |
set direction arrow
text | text to be displayed. "" to hide the text |
position | The position to which the arrow should point. |
int Script2Game::GameScriptClass::useOnlineAPI | ( | const string | apiquery, |
const dictionary | dict, | ||
string | result | ||
) |
Sends or request information from the master server.