Contents

Console Objects Fields and Methods Quick Reference Part 3



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.

FileObject



Console Method Summaries

close
isEOF
openForAppend
openForRead
openForWrite
readLine



Console Methods

close()

Purpose
Use the close method to close the current file handle. If the file was opened for writing, this flushes the contents of the last write to disk.

Returns
No return value.

See Also
openForAppend, openForRead, openForWrite



isEOF()

Purpose
Use the isEOF method to check to see if the end of the current file (opened for read) has been reaached.

Returns
Returns true if the end of file has been reached, false otherwise.

See Also
openForRead



openForAppend( filename )

Purpose
Use the openForAppend method to open a previously created file for appending. If the file specified by filename does not exist, the file is created first.

Syntax
filename
– The path and filename of the file to open for appending.

Returns
Returns true if the file was succesfully opened for appending, false otherwise.

See Also
close, openForRead, openForWrite



openForRead( filename )

Purpose
Use the openForRead method to open a previously created file for reading.

Syntax
filename
– The path and filename of the file to open for reading.

Returns
Returns true if the file was succesfully opened for reading, false otherwise.

See Also
close, OpenForAppend, OpenForWrite



openForWrite( filename )

Purpose
Use the openForWrite method to previously created or a new file for writing. In either case, the file will be overwritten.

Syntax
filename
– The path and filename of the file to open for writing.

Returns
Returns true if the file was succesfully opened for writing, false otherwise.

See Also
close, OpenForAppend, openForRead



readLine()

Purpose
Use the readLine method to read a single line from a file previously opened for reading.

Returns
Returns the next line in the file, or a NULL string if the end-of-file has been reached.

Notes
Use isEOF to check for end of file while reading.

See Also
isEOF, openForRead



writeLine( text )

Purpose
Use the writeLine method to write a value ( text ) into a file that was previously opened for appending or over-writing.

Syntax
text
– The value to write to the file.

Returns
No return value.

See Also
openForAppend, openForWrite


FlyingVehicle


This class is used represent the flying variety of vehicles. It can be used to represent any variety of flying vehicle, including jets, biplanes, or rocket ships. If you do not actually need a flying vehicle, it is suggested that you use the hover vehicle instead which will closely approximate many similar needs.

Fields

Field Name Description Sample or Range
disableMove If set to true, this vehicle will not be allowed to move. [ false , true ]


FlyingVehicleData



Fields

Field Name Description Sample or Range
autoAngularForce Angular stabilizer force. This force levels you out when autostabilizer kicks in. [ 0.0 , 0.inf )
autoInputDamping Amount by which input is damped to reduce occilations caused by too much input. [ 0.0 , 1.0 )
autoLinearForce Linear stabilzer force. This slows you down when autostabilizer kicks in. [ 0.0 , 0.inf )
backwardJetEmitter ParticleEmitterData datablock used for the thrust backward jet emitter. Emitter will be attached at node: JetNozzleX. --
createHoverHeight If set to true, uses hoverHeight to specify height to hover after creation. [ false , true ]
downJetEmitter ParticleEmitterData datablock used for the downward thrust jet emitter(s). Emitters will be attached at nodes: JetNozzle2 , and JetNozzle3. --
engineSound AudioProfile for engine ambient sound. --
forwardJetEmitter ParticleEmitterData datablock used for the forward thrust jet emitter(s). Emitters will be attached at nodes: JetNozzle0 , and JetNozzle1. --
horizontalSurfaceForce Wing thrust used in climbing and diving. [ 0.0 , 0.inf )
hoverHeight Height to hover at after creation if createHoverHeight is set to true. [ 0.0 , 0.inf )
jetSound AudioProfile for engine thrust sound. --
maneuveringForce Horizontal thrust force. [ 0.0 , 0.inf )
maxAutoSpeed Autostabilizer/AutoLinearForce are enabled when the vehicle's velocity magnitude drops below this value. [ 0.0 , 0.inf )
minTrailSpeed Minimum speed at which contrails turn on. [ 0.0 , 0.inf )
rollForce Automatically applied rolling force used to 'right' a tilted vehicle. [ 0.0 , 0.inf )
rotationalDrag Amount of drag applied to rotation about the vehicles up axis. [ 0.0 , 0.inf )
steeringForce Strength of turning thrust. [ 0.0 , 0.inf )
steeringRollForce How much you roll when turning. [ 0.0 , 0.inf )
trailEmitter ParticleEmitterData datablock used for the contrail emitter(s). Emitters will be attached at nodes: contrail0 , contrail1, contrail2, and contrail3. --
verticalSurfaceForce Wing thrust used in 'sliding' side to side during turns. [ 0.0 , 0.inf )
vertThrustMultiple TypeF32 [ 0.0 , 0.inf )


fxFoliageReplicator


This class was originally intended to represent foliage in the scene. In fact, it can be used to represent anything that is displayed using a billboard. The value of this class is that all of the objects represented by a single foliage replicator are tied to a single instance of the class. Thus, regardless of the number of objects which may be displayed by any single foliage replicator the same network bandwidth is used. The billboards may be given a variety of behaviors and attributes. They may be stretched, self lighted, they may sway, and they may be are restricted to specific areas.

Fields

Field Name Description Sample or Range
Transform
position XYZ position of fx object. “10.0 20. 0.0”
rotation Values have no effect. --
scale Values have no effect. --
Debugging
useDebugInfo Enable debug feedback. Some features must be uncommented in code to turn them on. [ false , true ]
debugBoxHeight Quad-tree box heights. [ 0.0 , 0.inf )
HideFoliage Stop displaying foliage. [ false , true ]
showPlacementArea Show the placement feedback device. [ false , true ]
placementAreaHeight Changes height of feedback device. [ 0.0 , 0.inf )
placementColour Changes color of feedback device. “1.0 1.0 1.0 1.0”
Media/Replications
seed Value used to deterministically generate random object positions and parameters. [ 0 , inf )
foliageFile Texture file to use for foliage. Must be suitable for use as billboard. ~/path/filename
foliageCount Number of billboards to replicate. [ 0 , inf )
foliageRetries Determines how many times to attempt to place a billboard. Retries are sometimes required in order to meet placement criteria. Failed placement attempts result fewer objects placed. [ 0 , inf )
Area/Placement Radius
innerRadiusX X dimension of inner do-not-place ellipse. Objects are not allowed in ellipse described by this and the InnerRadiusY dimension. [ 0.0 , 0.inf )
innerRadiusY Y dimension of inner do-not-place ellipse. Objects are not allowed in ellipse described by this and the InnerRadiusX dimension. [ 0.0 , 0.inf )
outerRadiusX X dimension of outer do-not-place ellipse. Objects are not allowed outside ellipse described by this and the OuterRadiusY dimension. [ 0.0 , 0.inf )
outerRadiuxY Y dimension of outer do-not-place ellipse. Objects are not allowed outside ellipse described by this and the OuterRadiusX dimension. [ 0.0 , 0.inf )
Dimension
minWidth If scaling enabled (FixSizeToMax == false), this defines the billboard’s minimum width. [ 0.0 , 0.inf )
maxWidth If scaling enabled (FixSizeToMax == false), this defines the billboard’s maximum width. [ 0.0 , 0.inf )
minHeight If scaling enabled (FixSizeToMax == false), this defines the billboard’s minimum height. [ 0.0 , 0.inf )
maxHeight If scaling enabled (FixSizeToMax == false), this defines the billboard’s maximum height. [ 0.0 , 0.inf )
fixAspectRatio Prevents texture stretching. [ false , true ]
fixSizeToMax Forces all billboards to use MaxWidth and MaxHeight as their respective width and height. [ false , true ]
offsetZ This allows you to assist placement by lowering or raising the billboard by a fixed amount. ( -0.inf , 0.inf )
randomFlip Allows random horizontal flipping of billboards, increasing variation for non-symmetric bilboards. [ false , true ]
Culling
<useCulling> Enables culling algorithms. i.e. test whether a billboard is within view before rendering it. Warning: Computing overhead offsets value for small placements. Only use for large placements if at all. [ false , true ]
cullResolution Determines size of culling quads. Lower values of CullResolution take longer to cull but more effetively removes non-visible billboards. Higher values of CullResolution take less time, but end up rendering more non-visible billboards. Tradeoff: Culling Time vs. Fill Rate. [ 8 , inf )
viewDistance When a billboards is at distane ViewDistance from the camera, it will be completely visible. [ 0.0 , 0.inf )
viewClosest Controls closest point at which billboards will begin to fade out. [ 0.0 , 0.inf )
fadeInRegion

fadeOutRegion
Together, these determine width of region between fade-in and fade-out. [ 0.0 , 0.inf )
alphaCutoff Controls general alpha level for rendering billboards. [ 0.0 , 1.0 ]
groundAlpha Controls alpha in region near ground. For fixing artifacts between billboard and ground. [ 0.0 , 1.0 ]
Animation
swayOn Enables sway animation. [ false , true ]
swaySync All bilboards sway in sync for this fx Object. [ false , true ]
swayMagSide Side-to-side swaying magnitude. [ 0.0 , 0.inf )
swayMagFront Back-and-forth swaying magnitude. [ 0.0 , 0.inf )
minSwayTime Minimum sway time. Sway times are randomly chosen between a min and max on a per swing basis. [ 0.0 , 0.inf )
maxSwayTime Maximum sway time. Sway times are randomly chosen between a min and max on a per swing basis. [ 0.0 , 0.inf )
Lighting
lightOn Turns on luminance (self lighting). [ false ,true ]
lightSync Light billboards in sync. [ false , true ]
minLuminance Minimum light value. [ 0.0 , maxLuminance ]
maxLuminance Maximum light value. [ minLuminance , 1.0 ]
lightTime Time required to transition from Min to Max and Max to Min. i.e. each duration is equal to lightTime. [ 0.0 , 0.inf )
Restrictions/Restraints
allowOnTerrain Allows objects to be placed on terrain. [ false , true ]
allowOnInteriors Allows objects to be placed on interiors. [ false , true ]
allowOnStatics Allows objects to be placed on static shapes. [ false , true ]
allowOnWater Allows objects to be placed in area covered by water. [ false , true ]
allowWaterSurface Place on surface of water. Otherwise will be placed on terrain below water. [ false , true ]
allowedTerrainSlope Maximum slope to place on. Slopes beyond this value will be devoid of objects. [ false , true ]


Console functions

startFoliageReplication()


startFoliageReplication()

Purpose
Use the startFoliageReplication function to start the foliage replication system.

Returns
No return value.

Notes
This can be called before be called after replication objects have been placed, but it should only be called once, and if it is not called, replicators will not work.

See Also
startClientReplication


fxLight


The fxLight object is used to represent in-game lights with and respective flares. This object casts (dynamic) light in the scene. It renders both a representation of the light source flare, and casts light on terrain and other objects.

Fields

Field Name Description Sample or Range
enable Boolean value enabling this light. [ false , true ]
iconSize Floating-point value specifying render size of flare. ( -inf.0 , inf.0 )


Console Method Summaries

attachToObject
detachFromObject
reset


Console Methods

attachToObject( obj )

Purpose
Use the attachToObject method to attach this fxLight object to GameBase object.

Syntax
obj
– A GameBase derived object to attach to

Returns
No return value.

Notes
This method name is bit of a misnomer. When an fxLight object is attached to another object, it doesn't mean the fxLight will move with the object, but rather that if the object the fxLight is attached to is deleted, this object will be deleted. Also, the fxLight will always be processed (for rendering) after the object it is attached to.

See Also
detachFromObject



detachFromObject()

Purpose
Use the detachFromObject method to detach this fxLight from the last object it was attached to.

Returns
No return value.

See Also
attachToObject



reset()

Purpose
Use the reset method to lighting, animation, and texture of the current fxLight.

Returns
No return value.



setEnable( enabled )

Purpose
Use the setEnable method to enable or disable an fxLight.

Syntax
enabled
– A boolean value. If set to true, this fxLight will cast light and be rendered.

Returns
No return value.


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