Contents

Console Objects Fields and Methods Quick Reference Part 12


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.

ShapeBaseData



Fields

Field Name Description Sample or Range
Rendering
cloakTexture Path to texture to be used when shape is cloaked. See lesson samples.
emap A boolean value specifying whether to render environmental map or not. false
shapeFile Path to DTS file containing the model for this shape. See lesson samples.
Physics
density The density of this shape. Affects whether this shape will sink or float in water (relative to water density). See lesson samples.
drag Drag presented by this shape as it moves through the air. 0
mass Mass for this shape. 100
Damage
debris DebrisData datablock to use for post-destruction debris. See lesson samples.
debrisShapeName Path to DTS file containing the model for this shape which is to be rendered post destruction. See lesson samples.
explosion ExplosionData datablock to use for an explsion when this shape is destroyed See lesson samples.
isInvincible If this boolean value is true, this shape does not take damage. false
maxDamage Maximum damage this shape can accrue. 100
renderWhenDestroyed Boolean value specifying whether to render this shape or not once it's damageState is 'Destroyed'. false
underwaterExplosion ExplosionData datablock to use for an explsion when this shape is destroyed and submerged in water. See lesson samples.
Damage Reference Values

These values do not change engine functions and are meant to be used by scripts.

destroyedLevel Damage level at which this shape will be considered destroyed. 100
disabledlevel Damage level at which this shape will be considered disabled. 50
repairRate Rate (in points per tick) at which this shape is repaired when current damage > 0.

0.03125
(is equal to 1 point per second)

Energy
inheritEnergyFromMount When mounted, use mount's energy. false
maxEnergy Maximum energy this object can have. 50
Energy Reference Values

These values do not change engine functions and are meant to be used by scripts.

rechargeRate Rate (in points per tick) at which this shape is recharged when current energy < maxEnergy.

0.03125
(is equal to 1 point per second)

Camera Settings
cameraDefaultFOV Initial field of view for the camera. [ 0.0 , 180 ]
cameraMaxDist Maximum distance from camera to observing object. [ cameraMinDist , inf )
cameraMaxFOV Maximum field of view for the camera. [ 0.0 , 180 ]
cameraMinDist Minimum distance from camera to observing object. [ 0.0 , cameraMaxDist ]
cameraMinFOV Minimum field of view for the camera. [ 0.0 , 180 ]
firstPersonOnly Render shape when in first person (only applies to shapes that are observed through.) [ false , true ]
observeThroughObject If true, camera will use this shape's camera parameters, when this is the controlled object. [ false , true ]
useEyePoint Use the eye node specified by this shape instead. [ false , true ]
Miscellaneous
aiAvoidThis A boolean hit to be used by AI scripts to determine if an AI agent should 'avoid' this object. Scripts are responsible for dealing with this. [ false , true ]
computeCRC Calculate a cyclic-redundancy-code for this shape. [ false , true ]


Console Method Summaries

popFront pushBack


Console Methods

getDeployTransform( position , normal )

Purpose
Use the getDeployTransform method to retrieve the transform that would result from deploying an unscaled object using this datablock at position with the specified normail.

Syntax
position
– The postion to create the transform for.
normal – A vector representing the object's UP vector. This can be thought of as an object's tilt or leaning vector. If the object is to be placed at an angle, pass in a unit-vector that has the same orientation as a vector starting at postion and aligning with the requied angle.

Returns
Returns a deployment (placement) transform for an un-scaled and un-rotated datablock derived shape placed at the required location with an optional tilt.

See Also
checkDeployPos



checkDeployPos( transform )

Purpose
Use the checkDeployPos method to determine if placing an unscaled version of an object using this datablock will cause that shape to be embedded in a staticShape or an InteriorInstance.

Syntax
transforms
– A normal transform, or a transform calculated using getDeployTransform.

Returns
Returns false if the placement will result in the new shape being embedded in a staticShape or an InteriorInstance. Otherwise, it will return true.

Notes
This check doesn't examine the area for all possible object, just staticShapes and Interiors. To include more objects you will need to edit the engine and add them to the list of 'interesting' objects.

See Also
getDeployTransform


ShapeBaseImageData


ShapeBaseImageData has no associated class as other xyzData classes do. This special class is used to represent geometry that can only be mounted to an existing ShapeBase object. ShapeBaseImageData objects cannot otherwise be instantiated like other Shape objects.

Fields

Field Name Description Sample or Range
Rendering
emap A boolean value specifying whether to render environmental map or not. -
firstPerson If true, render this image in 1st POV. -
shapeFile Path to DTS file containing the model for this shape. -
Projectile
projectile ProjectileData datablock -
Cloaking
cloakable A boolean value specifying whether this image cloaks when the shape it is mounted to is cloaked. -
Mounting
eyeOffset Rendering position offset (only affects 1st POV). -
eyeRotation Rendering rotation offset (only affects 1st POV). -
mountPoint Named mount node to mount to on the receving shape. [ 0 , 31 ]
offset Position offset from mount point. -
rotation Rotation offset from mount point. -
Lighting
lightColor Three-element floating-point vector specifing RGB components of light. “r g b a” In range [ 0.0 , 1.0 ]
lightRadius Floating-point value specifying radius for light emision. [0.0 , 20.0]
lightTime Integer value specifyng time (in milliseconds) for light to pulse on-off-on. [ 0 , inf )
lightType String specifying type of light does this image emits.

“NoLight”
“ConstantLight”
”PulsingLight”

Physics
mass Floating-point value specifying mass for this image. -
Weapons
accuFire Has no effect. -
casing DebrisData datablock to use for ejected casings. -
correctMuzzleVector Boolean value specifyng that the muzzle vector should be calculated from the players eyeVector, not from the muzzleVector of the image. [ false , true ]
minEnergy Floating-point value specifying minimum energy required to 'fire' this weapon. -
shellExitDir Ejection vector for ejected casings. -
shellExitVariance Floating-point value specifying variance in ejection vector direction. [ 0.0 , 180.0 ]
shellVelocity Floating-point value specifying shell ejection velocity. [ 0.0 , inf ]
usesEnergy Boolean value specifying that this weapon uses energy. [ false , true ]
State Machine
stateAllowImageChange[] If false, will temporarily block other images from mounting while the statemachine is executing the tasks in this state. [ false , true ]
stateDirection[] Direction of animation. true is foward. [ false , true ]
stateEjectShell[] Eject shell in this state. [ false , true ]
stateEmitter[] Play this particle emitter (at muzzle point or specified node).
stateEmitterNode[] Integer value specifying node to attach emitter to. Default is to mount to named node 'muzzlepoint'.
stateEmitterTime[] Floating-point value specifying time to run emitter.
stateEnergyDrain[] Floating-point value specifying
stateFire[] First state with this a true is the state entered by the client when it receives the 'fire' event.
stateIgnoreLoadedForReady[] If set to true, and both ready and loaded transitions are true, the ready transition will be taken instead of the loaded transition. [ false , true ]
stateLoadedFlag[] Set loaded state of shape to specified value.

“Ignore”
“Loaded”
“Empty”

stateName Name of this state.
stateRecoil[] Play specified recoil anmation.

“NoRecoil”
“LightRecoil”
“MediumRecoil” “HeavyRecoil”

stateScript[] Method to execute on entering this state. Scoped to this image class name, then shapeBaseImageData, ...
stateSequenceRandomFlash[] Play random flash animation. [ false , true ]
stateSequence[] Play this animation.
stateSound[] Play sound specified by this audio file.
stateSpinThread[] Play this spin animation (blended).

“Ignore”
“Stop”
“SpinUp”
”SpinDown”
“FullSpeed”

stateTimeoutValue[] Time in seconds for this state to time out. [ 0.0 , inf )
stateTransitionOnNotLoaded[] Transition to this named state if the state of loaded is 'Empty'. someStateName
stateTransitionOnTriggerDown[] Transition to this named state if the fire button is pressed. someStateName
stateTransitionOnTriggerUp[] Transition to this named state if the fire button is released. someStateName
stateTransitionOnAmmo[] Transition to this named state when the ammo the image has ammo. someStateName
stateTransitionOnLoaded[] Transition to this named state when the loaded state of the image is 'Loaded'. someStateName
stateTransitionOnNoAmmo[] Transition to this named state when the the image has no ammo. someStateName
stateTransitionOnNoTarget[] Transition to this named state when the image has no target. someStateName
stateTransitionOnNotWet[] Transition to this named state when the image is not underwater. someStateName
stateTransitionOnWet[] Transition to this named state when image is underwater. someStateName
stateTransitionTarget[] Transition to this named state when the image has a target. someStateName
stateTransitionTimeout[] Transition to this named state when the current state transition timeout time has elapased. someStateName
stateWaitForTimeout[] If false, this state ignores timeout and transitions immediately if other tests are met. [ false , true ]
Miscellanous
computeCRC Verify that the CRC of the client's image matches the server's CRC for the image on load by client. [ false , true ]


SimDataBlock


This class is the root class for all datablock classes. It does not define any fields or console methods of it’s own.


SimGroup


Same fields as SimSet.

SimObject


Console Method Summaries

delete dump getClassName
getGroup getId getName
getType save schedule


Console Methods

delete()

Purpose
Use the delete method to delete this object.

Returns
No return value.

Notes
When an object is deleted, it automatically:

  • Unregisters its ID and name (if it has one) with the engine.
  • Removes itself from any SimGroup or SimSet it may be a member of.
  • (eventually) returns the memory associated with itself and its non-dynamic members.
  • Cancels all pending %obj.schedule() events.


For objects in the GameBase, ScriptObject, or GUIControl hierarchies, an object will first:

  • Call the onRemove() method for the object's namespace.



dump()

Purpose
Use the dump method to display the following information about this object:

  • All engine registered console methods (including parent methods) for this object.
  • All script registered console methods (including parent methods) for this object.
  • All Non-Dynamic Fields
  • All Dynamic Fields


Returns
No return value.



getClassName()

Purpose
Use the getClassName method to get the ConObject class name of this object.

Returns
Returns a string containing the ConObject registered name of this object's class.

Some Possible Returns:

  • SimObject
  • WheeledVehicle
  • Player
  • ...


See Also
getType



getGroup()

Purpose
Use the getGroup method to determine if this object is contained in a SimGroup and if so, which one.

Returns
Returns the ID of the SimGroup this shape is in or zero if the shape is not contained in a SimGroup.



getId()

Purpose
Use the getId method to get the numeric ID of this shape.

Returns
Returns the unique numeric ID of this shape.

See Also
getName, setName



getName()

Purpose
Use the getName method to get the name (if any) for this shape.

Returns
Returns a string containing the name of this shape, or the NULL string if this shape was never given a name (either when created or subsequently).

See Also
getID, setName



getType()

Purpose
Use the getType method to get the type for this object. This type is an integer value composed of bitmasks. For simplicity, these bitmasks are defined in the engine and exposed for our use as global variables.

Returns
Returns a bit mask containing one or more set bits.

Notes
To simplify the writing of scripts, a set of globals has been provided containing the bit setting for each class corresponding to a particular type. For a complete list of the bit masks, see the 'Shape Type Bitmasks' table.

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

Two interesting general masks are:

  • $TypeMasks::EnvironmentObjectType – Matches sky, sun, lightning, particle emitter nodes.
  • $TypeMasks::StaticObjectType – Matches – fxFoliageReplicator, fxLight, fxShapeReplicator, fxSunlight, interiorInstance, lightning, mirrorSubObject, missionMarker, staticShape, terrain, tsStatic


See Also
getClassName


Shape Type Bitmasks

$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


schedule(time , command , <arg1 ... argN> )

Purpose
Use the schedule method to schedule an action to be executed upon this object time milliseconds in the future.

Syntax
time
– Time in milliseconds till action is scheduled to occur.
command – Name of the command to execute. This command must be scoped to this object (i.e. It must exist in the namespace of the object), otherwise the schedule call will fail.
arg1...argN – These are optional arguments which will be passed to command. This version of schedule automatically passes the ID of %obj as arg0 to command.

Returns
Returns an integer schedule ID.

Notes
The major difference between this and the schedule console function is that if this object is deleted prior to the scheduled event, the event is automatically cancelled.

times should not be treated as exact since some 'simulation delay' is to be expected. The minimum resolution for a scheuled event is ~32 ms, or one tick.

schedule does not validate the existance of command. i.e. If you pass an invalid console method name, the schedule() method will still return a schedule ID, but the subsequent event will fail silently.

See Also
See the schedule console function and its corresponding helper functions.



setName( name )

Purpose
Use the setName method to give this shape a new name.

Syntax
name
– A string containing the new name for this shape, or a NULL string to un-name this shape.

Returns
No return value.

Notes
Names can be compose of non-alphanumeric symbols, but be careful when doing this.

See Also
getID, getName


Table of Contents || Part 1 || Part 2 || Part 3 || Part 4 || Part 5 || Part 6 || Part 7 || Part 8 || Part 9 || Part 10 || Part 11 || Part 13 || Part 14 || Part 15