Section Index


1. OpenAL || 2. Debugging || 3. String Manipulation || 4. Networking || 5. Console || 6. Device I/O || 7. File I/O
8. Packages || 9. Objects || 10. Event Scheduling || 11. Datablocks || 12. Video / Texturing || 13. Special || 14. Resource Management
15. Scene || 16. Containers and Raycasts || 17. Editors || 18. Build || 19. Time || 20. GUIs || 21. Math


This quick reference guide was taken directly out of The Game Programmer's Guide to Torque by Edward Maurina. It's an outstanding resource - a must for anyone wanting to get serious about programming in Torque.


Contents

Special

calcExplosionCoverage( source, targetObject , coverageMask )

Purpose
Use the calcExplosionCoverage function to calculate the total exposure for targetObject to an explosion located at source position and blocked by all objects having a tight as specified by coverageMask. In other words, this function will calculate how much of an explosive force is applied to an object if intervening objects block portions of the explosion.

Syntax
source
A position vector.
targetObject – The name of ID of the object to check coverage for. coverageMask – A bitmask containing object type masks for all objects that can block this explosion. 0 For none, and -1 for all. For specific types, please see the "Object Types Table" below.

Returns
Returns a value between 0.0 and 1.0, where 0.0 is no coverage and therefore no damage, and when 1.0 is full coverage.

%coverage = calcExplosionCoverage(%position, %targetObject,
           $TypeMasks::InteriorObjectType |  $TypeMasks::TerrainObjectType |
           $TypeMasks::ForceFieldObjectType | $TypeMasks::VehicleObjectType);

if (%coverage == 0) continue;



Object Types Table

$TypeMasks::StaticObjectType
$TypeMasks::EnvironmentObjectType
$TypeMasks::TerrainObjectType
$TypeMasks::InteriorObjectType
$TypeMasks::WaterObjectType
$TypeMasks::TriggerObjectType
$TypeMasks::MarkerObjectType
$TypeMasks::GameBaseObjectType
$TypeMasks::ShapeBaseObjectType
$TypeMasks::CameraObjectType
$TypeMasks::StaticShapeObjectType
$TypeMasks::PlayerObjectType
$TypeMasks::ItemObjectType
$TypeMasks::VehicleObjectType
$TypeMasks::VehicleBlockerObjectType
$TypeMasks::ProjectileObjectType
$TypeMasks::ExplosionObjectType
$TypeMasks::PhysicalZoneObjectType



getControlObjectAltitude()

Purpose
Use the getControlObjectAltitude function to determine how high above the terrain the control object.

Returns
Returns a floating-point value equal to the distance above the terrain for the current control object. If the object is below the terrain, a zero is returned.

See Also
getControlObjectSpeed, getTerrainHeight

getControlObjectAltitude();



getControlObjectSpeed()

Purpose
Use the getControlObjectSpeed function to determine how fast the control object is currently moving.

Returns
Returns a floating-point value equal to the magnitude of the current control objects velocity in the game world in meters-per-second.

See Also
getControlObjectAltitude, getTerrainHeight

%player.getControlObjectSpeed();



getClipboard()

Purpose
Use the getClipboard function to get the contents of the GUI clipboard.

Returns
Returns a string equal to the current contents of the copy the clipboard, or a NULL strain if the copy clipboard is empty.

See Also
setClipboard



getModPaths()

Purpose
Use the getModPaths function to get the current mod path information.

Returns
Returns a string equivalent to the complete current mod path, that is all pads that are visible to the file manager.

See Also
setModPaths



getTerrainHeight( position )

Purpose
Use the getTerrainHeight function to tetermine the height of the terrain at an XY postion in the game world.

Syntax
position
– An XY position vector in the game world.

Returns
Returns the terrain height at XY position.

See Also
getControlObjectAltitude, getControlObjectSpeed

%TerHeight = getTerrainHeight(%pos);



isPointInside( position )

Purpose
Use the isPointInside function to determine if an XYZ point is inside an interior.

Syntax
position
– An XYZ position vector in the game world.

Returns
Returns true if the XYZ position is inside an interior, otherwise returns false.

Notes
This will only work if the interior at position is using portals, otherwise inside and outside are equivalent.

isPointInside(“143 34  567”);



pathOnMissionLoadDone()

Purpose
Use the pathOnMissionLoadDone function to load all path information from the currently loaded interiors.

Returns
No return value.

pathOnMissionLoadDone();



setModPaths( path )

Purpose
Use the setModPaths function to set the current mod path to the value specified in path.

Syntax
path
– A string containing a semi-colon (;) separated list of game and mod paths.

Returns
No return value.

See Also
getModPaths

// Set the mod path which dictates which directories will be visible
// to the scripts and the resource engine.
$modPath = pushback($userMods, $baseMods, ";");
setModPaths($modPath);



setClipboard( string )

Purpose
Use the setClipboard function to Set value on clipboard to string.

Syntax
string
– The new value to place in the GUI clipboard.

Returns
Returns true if successful, false otherwise.

See Also
getClipoard



setZoomSpeed( delay )

Purpose
Use the setZoomSpeed function to set the current zoom speed to the value specified in delay, where delay is the time it takes to transition across 90-degrees of field-of-view specified in milliseconds. The maximum deilay is 2000 ms.

Syntax
delay
– An integer value between 0 and 2000, equal to the time it takes the camera across 90-degrees of FOV.

setZoomSpeed( $pref::Player::zoomSpeed );


Section Index


1. OpenAL || 2. Debugging || 3. String Manipulation || 4. Networking || 5. Console || 6. Device I/O || 7. File I/O
8. Packages || 9. Objects || 10. Event Scheduling || 11. Datablocks || 12. Video / Texturing || 13. Special || 14. Resource Management
15. Scene || 16. Containers and Raycasts || 17. Editors || 18. Build || 19. Time || 20. GUIs || 21. Math