![]() |
VR-Forces 4.1.1 Class Documentation
|
This class is a two-way interface between the script language and its parent controller. More...

Public Member Functions | |
| virtual | ~DtScriptInterface () |
| virtual bool | invokeInit ()=0 |
| virtual void | invokeTick ()=0 |
| This will be called by the parent to invoke the script tick. | |
| virtual bool | loadScript ()=0 |
| This will be called by the parent to let the interface know when to load the script. | |
| virtual DtString | type () const =0 |
| Script engine type. | |
| virtual void | setTaskId (int taskId) |
| virtual int | taskId () const |
| virtual void | setScriptId (const DtString &scriptId) |
| virtual const DtString & | scriptId () const |
| virtual void | setScriptPath (const DtFilename &scriptPath) |
| virtual const DtFilename & | scriptPath () const |
| virtual void | setParent (DtScriptMultiTaskController *parent) |
| Sets the parent of this object. | |
| virtual DtScriptMultiTaskController * | parent () const |
| virtual void | setEntity (DtVrfObject *entity) |
| virtual DtVrfObject * | entity () const |
| virtual void | init () |
| virtual void | setTaskVariables (const DtRwVariableBindings &variables) |
| virtual const DtRwVariableBindings & | taskVariables () const |
| virtual bool | updateTaskVariables () |
| virtual void | processScenarioSave (DtRwVariableBindings *saveState)=0 |
| Called when the scenario is saved. | |
| virtual bool | processScenarioLoad (const DtRwVariableBindings *loadState)=0 |
| Called when the scenario is loaded. | |
| virtual void | processClearForReuse () |
| This function should be overridden by the inheritor to clear out any task specific variables. | |
| virtual void | setTaskStarting (bool v) |
| virtual bool | taskStarting () const |
| double | scriptGetExerciseTime () |
| Methods that are available for any script to use. | |
| double | scriptGetTimeOfDay () |
| Methods that are available for any script to use. | |
| double | scriptGetWindSpeed () |
| Returns wind speed in meters/second. | |
| double | scriptGetWindDirection () |
| Returns wind direction in radians. | |
| DtScriptVrfObject | scriptGetVrfObjectByName (const std::string name) |
| Methods that are available for any script to use. | |
| void | printError (const std::string message) |
| Methods that are available for any script to use. | |
| void | printWarn (const std::string message) |
| Methods that are available for any script to use. | |
| void | printInfo (const std::string message) |
| Methods that are available for any script to use. | |
| void | printVerbose (const std::string message) |
| Methods that are available for any script to use. | |
| void | printDebug (const std::string message) |
| Methods that are available for any script to use. | |
| bool | entityTypeMatches (const std::string &, const std::string &) |
| Methods that are available for any script to use. | |
| void | setTickPeriod (double) |
| Tick management. Will store information in PSR of controller only. | |
| double | getTerrainAltitude (const double lat, const double lon, bool &dataAvailable, std::string &surface) const |
| Gets the terrain height at the given location. | |
| bool | doesChordHitTerrain (const DtLocation3D &pt1, const DtLocation3D &pt2, bool &dataAvailableart) const |
| Determines if the chord formed by (point1, point2) intersects the terrain. | |
| virtual DtLocation3D | findClosestPointToRoad (const DtLocation3D &point, double searchRadius, bool &dataAvailable, bool &success) const |
| Methods that are available for any script to use. | |
| std::string | getForceName (int forceType) |
| Methods that are available for any script to use. | |
| bool | forcesHostile (std::string force1, std::string force2) |
| Methods that are available for any script to use. | |
Protected Member Functions | |
| DtScriptInterface () | |
| DtScriptInterface (const DtScriptInterface &other) | |
| DtScriptInterface & | operator= (const DtScriptInterface &other) |
| virtual void | scriptTaskComplete (bool success) |
| This function is meant to be called by the script itself or the script object to tell the parent that the script task is complete. | |
| virtual bool | scriptText (std::string &text) |
| Returns the script text as a string and a bool on whether the text is valid or not. | |
| virtual const DtReaderWriter * | getTaskParam (const DtString ¶mName) |
| virtual bool | getParamMetaDataType (const DtString ¶mName, DtString &typeName) |
Protected Attributes | |
| int | myTaskId |
| DtString | myScriptId |
| DtFilename | myScriptPath |
| DtVrfObject * | myEntity |
| DtRwVariableBindings | myTaskVariables |
| DtScriptMultiTaskController * | myParent |
| bool | myTaskStarting |
| Indicates that a new task is starting, and should be initialized on the next tick. | |
This class is a two-way interface between the script language and its parent controller.
There are functions that either the parent controller will call on the script interface (such as tick() ) and there will be functions the script interface will call on the parent controller to inform the parent of status updates and for data access.
|
protected |
|
protected |
|
virtual |
|
protected |
|
pure virtual |
Implemented in DtLuaScriptInterfaceImpl.
|
pure virtual |
This will be called by the parent to invoke the script tick.
Implemented in DtLuaScriptInterfaceImpl.
|
pure virtual |
This will be called by the parent to let the interface know when to load the script.
Implemented in DtLuaScriptInterfaceImpl.
|
pure virtual |
Script engine type.
Implemented in DtLuaScriptInterfaceImpl.
|
inlinevirtual |
|
inlinevirtual |
|
inlinevirtual |
|
inlinevirtual |
|
inlinevirtual |
|
inlinevirtual |
|
inlinevirtual |
Sets the parent of this object.
It is assumed that the parent will take care of deleting itself so this class should NOT do that.
|
inlinevirtual |
|
inlinevirtual |
|
inlinevirtual |
|
inlinevirtual |
Reimplemented in DtLuaScriptInterfaceImpl.
|
inlinevirtual |
|
inlinevirtual |
|
virtual |
|
pure virtual |
Called when the scenario is saved.
The stateState pointer may not be valid, in which case something went wrong with saving
Implemented in DtLuaScriptInterfaceImpl.
|
pure virtual |
Called when the scenario is loaded.
The load state pointer may not be valid, which does not indicate that the scenario loaded incorrectly, but that the data for this particular script interface was either corrupt or did not exist.
Implemented in DtLuaScriptInterfaceImpl.
|
virtual |
This function should be overridden by the inheritor to clear out any task specific variables.
This version should probably be called last if you override it rather than first to take care of things before these things get cleared.
Reimplemented in DtLuaScriptInterfaceImpl.
|
virtual |
|
virtual |
| double DtScriptInterface::scriptGetExerciseTime | ( | ) |
Methods that are available for any script to use.
| double DtScriptInterface::scriptGetTimeOfDay | ( | ) |
Methods that are available for any script to use.
| double DtScriptInterface::scriptGetWindSpeed | ( | ) |
Returns wind speed in meters/second.
| double DtScriptInterface::scriptGetWindDirection | ( | ) |
Returns wind direction in radians.
| DtScriptVrfObject DtScriptInterface::scriptGetVrfObjectByName | ( | const std::string | name | ) |
Methods that are available for any script to use.
| void DtScriptInterface::printError | ( | const std::string | message | ) |
Methods that are available for any script to use.
| void DtScriptInterface::printWarn | ( | const std::string | message | ) |
Methods that are available for any script to use.
| void DtScriptInterface::printInfo | ( | const std::string | message | ) |
Methods that are available for any script to use.
| void DtScriptInterface::printVerbose | ( | const std::string | message | ) |
Methods that are available for any script to use.
| void DtScriptInterface::printDebug | ( | const std::string | message | ) |
Methods that are available for any script to use.
| bool DtScriptInterface::entityTypeMatches | ( | const std::string & | , |
| const std::string & | |||
| ) |
Methods that are available for any script to use.
| void DtScriptInterface::setTickPeriod | ( | double | ) |
Tick management. Will store information in PSR of controller only.
| double DtScriptInterface::getTerrainAltitude | ( | const double | lat, |
| const double | lon, | ||
| bool & | dataAvailable, | ||
| std::string & | surface | ||
| ) | const |
Gets the terrain height at the given location.
This function always makes a non-blocking call to the terrain interface (see documentation for DtTerrainInterface), even if dataAvailable is null; if dataAvailable is not null, then it is filled in with the result from the terrainInterface call indicating whether the altitude data is valid.
Note that in the Lua interface, dataAvailable and surface are pure_out_values, meaning that the arguments are not included in the function call, but are provided as additional return values of the function. E.g. use: height, valid, surfaceType = getTerrainAltitude(lat, lon)
| bool DtScriptInterface::doesChordHitTerrain | ( | const DtLocation3D & | pt1, |
| const DtLocation3D & | pt2, | ||
| bool & | dataAvailableart | ||
| ) | const |
Determines if the chord formed by (point1, point2) intersects the terrain.
The ground surface and features are considered. Returns a boolean indicating whether the LOS is blocked, and provides a flag indicating if the result is valid (the terrain data was available). This function always makes a non-blocking call to the terrain interface (see documentation for DtTerrainInterface), even if dataAvailable passed in is null.
|
virtual |
Methods that are available for any script to use.
| std::string DtScriptInterface::getForceName | ( | int | forceType | ) |
Methods that are available for any script to use.
| bool DtScriptInterface::forcesHostile | ( | std::string | force1, |
| std::string | force2 | ||
| ) |
Methods that are available for any script to use.
|
protectedvirtual |
This function is meant to be called by the script itself or the script object to tell the parent that the script task is complete.
This call will mark this object for deletion.
|
protectedvirtual |
Returns the script text as a string and a bool on whether the text is valid or not.
|
protectedvirtual |
|
protectedvirtual |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
Indicates that a new task is starting, and should be initialized on the next tick.