Contents

Console Objects Fields and Methods Quick Reference Part 6


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.

GameConnection Cntd.



Console Methods Cntd.

setControlCameraFov( newFOV )

Purpose
Use the setControlCameraFov method to change the FOV of the control object 'camera'.

Syntax
newFOV
– A floating-point value between 0.0 and 180.0 representing the new field-of-view setting for any and all cameras attached to this connection.

Returns
No return value.

Notes
This setting is sticky. That is, as the camera object is changed, this value will be retained. These values are however constrained by the datablock min and max FOV settings that are currently in effect.

See Also
getControlCameraFov



setControlObject( object )

Purpose
Use the setControlObject method to change the control object for this server-side GameConnection to the GameBase object specified by object.

Syntax
object
– A valid GameBase object to make the new control object.

Returns
Returns true if the control object was successfully changed, otherwise returns false.

Notes
The same control object may NOT be used by more than one client connection.

See Also
getControlObject



setFirstPerson( isFirstPerson )

Purpose
Use the setFirstPerson method to change the current point-of-view to first or third-person, depending on the value of isFirstPerson.

Syntax
isFirstPerson
– A boolean value. If set to true, the POV for this GameConnection is set to 1st POV, otherwise it is set to 3rd POV.

Returns
No return value.

Notes
This will NOT override value specified in the control-object/camera datablocks enabling or disabling a particular POV.

See Also
isFirstPerson



setJoinPassword( password )

Purpose
Use the setJoinPassword method to set the password required to connect to this server-side GameConnection.

Syntax
password
– A string representing the case insensitive password to use for this server-side GameConnection.

Returns
No return value.

Notes
Pass a NULL string to clear the password.

See Also
setConnectArgs



setMissionCRC( CRC )

Purpose
Use the setMissionCRC method to set the cyclic-redundancy-check (CRC) value for the current mission. This allows clients to determine whether they need to relight a scene or not. The CRC value of a mission file is used to calculate the signature of a mission lighting file (.ml). If the signature does not match the current CRC, the mission will be relit.

Syntax
CRC
– An integer value representing the cyclic-redundancy-check code for the current misssion file.

Returns
No return value.



startRecording( fileName )

Purpose
Use the startRecording method to tell the GameConnection to start recording a demo. The demo will be stored at the location specified by fileName.

Syntax
fileName
– To location to store the demo file. This should be a complete filename, including path and file name.

Returns
No return value.

See Also
isDemoPlaying, isDemoRecording, playDemo, stopRecording



stopRecording()

Purpose
Use the stopRecording method to tell the GameConnection to stop recording a demo.

Returns
No return value.

See Also
isDemoPlaying, isDemoRecording, playDemo, startRecording



transmitDataBlocks( sequence )

Purpose
Use the transmitDataBlocks method to start sending datablocks to the client connected to this GameConnection.

Syntax
sequence
– A book-keeping value used by scripts.

Returns
No return value.


HoverVehicle


This class is used represent the hover variety of vehicles. Space A hover vehicle is any vehicle that must maintain a specific distance between the vehicle and the ground at all times, which is not the same as a flying vehicle which may change this distance.


HoverVehicleData


The datablock associated with hover vehicle class. This class describes all of the behaviors of the hover vehicle.

Fields

Field Name Description Sample or Range
brakingActivationSpeed Minimum rate at which braking force will be activated. [ 0.0 , inf.0 )
brakingForce A force used to bring a drifting hover vehicle to a halt. [ 0.0 , inf.0 )
dragForce A percentage of the current velocity applied in the opposite direction of the hover vehicles current motion. [ 0.01 , 1 ]
dustTrailEmitter ParticleEmitterData datablock for dust trails. ParticleEmitterData datablock
dustTrailFreqMod Dust trail modulator. Lower values equal more dense trail, higher values equal more sparse trail. ( 0.0 , inf.0 )
dustTrailOffset A vector by which to offset the dust trail emitter from it's mount node. By default the emitter plays directly beneath the center of the vehicle. “0.0 5.0 0.0”
engineSound Engine sound special effect. AudioProfile datablock
floatingGravMag Gravity modifier that is enabled while vehicle is in contact with other objects. [ 0.0 , 1.0 ]
floatingThrustFactor When vehicle is NOT floatingFloating thrust is equal to: ( floatingThrustFactor * mainThrustForce ), otherwise it is 100% of mainThrustForce. [ 0.0 , 1.0 ]
floatSound Floating sound effect. AudioProfile datablock
forwardJetEmitter ParticleEmitterData datablock used for forward thrust jets, attached at JetNozzle0 and JetNozzle1. ParticleEmitterData datablock
gyroDrag Gyroscopic force that resists tilting. [ 0.0 , inf.0 )
jetSound Jetting sound special effect. AudioProfile datablock
mainThrustForce Forward thrust factor. [ 0.0 , inf.0 )
normalForce A force that attempts to right a tilted vehicle. [ 0.0 , inf.0 )
pitchForce A force applied forward or backward, depending on the amount of vehicle pitch. [ 0.0 , inf.0 )
restorativeForce Another minor force used to level a tiltled vehicle. [ 0.0 , inf.0 )
reverseThrustForce Reverse thrust factor. [ 0.0 , inf.0 )
rollForce A force applied left or right, depending on the amount of vehicle roll. [ 0.0 , inf.0 )
stabDampingConstant A value used to keep the vehicle from bouncing up-and down with minor elevation changes. [ 0.0 , 1.0 ]
stabLenMax A limiting factor applied to the automatically generated stabilizing 'box'. This box grows and shrinks as the velocity of the hover vehicle increase and decreases. This phantom box will collide with objects so limitting it's maximum size is a good idea. [ 0.0 , inf.0 )
stabLenMin A limiting factor applied to the automatically generated stabilizing 'box'. This box grows and shrinks as the velocity of the hover vehicle increase and decreases. If the box becomes too small, the vehicle will become unstable and prone to tilting. [ 0.0 , inf.0 )
stabSpringConstant This value should be at least twice the mass of the hoverVehicle and is used to keep the vehicle from sinking to the ground. [ 0.0 , inf.0 )
steeringForce Controls strength of steering controls. [ 0.0 , inf.0 )
strafeThrustForce Side to side thrust strength. [ 0.0 , inf.0 )
triggerTrailHeight Height at which dust trail emitter is enabled. [ 0.0 , inf.0 )
turboFactor A multiplier applied to thrustforce while jetting ($mvTriggerCount3 > 0 ). [ 0.0 , inf.0 )
vertFactor A multiplier to use to increase or decrese drag in the vertical direction. [ 0.0 , inf.0 )


InteriorInstance


This class is used represent interiors. That is, objects/meshes use to represent buildings bridges and other large objects in the world which can be entered. As the name would imply, interiors have an inside, and interior. Interior instance utilizes a BSP collision algorithm, as well as portals and other features.

Fields

Field Name Description Sample or Range
interiorFile The DIF filename or for this interior. ~/path/filename.dif
showTerrainInside If false, and interior uses portals, terrain will not render inside the interior. [ false , true ]
useGLLighting If this is set to true, interiors wil have basic GL lighting as soon as they are placed, otherwise a relight will be required to make textures show up. [ false , true ]


Globals

Variable Name Description Sample or Range
pref::Interior::LightUpdatePeriod Millisecond between dynamic light updates for interiors. Default is 66 millseconds. [ 1 , inf ]
pref::Interior::ShowEnvironmentMaps Enables environmental mapping for all interiors. [ false , true ]
pref::Interior::DynamicLights Enable dymamic lights for all interiors. [ false , true ]
pref::Interior::VertexLighting Enable vertex lighting for all interiors. [ false , true ]
pref::Interior::TexturedFog Enables advanced fog rendering for all interiors. [ false , true ]
pref::Interior::lockArrays Advanced rendering feature. [ false , true ]
pref::Interior::detailAdjust LOD transition tolerance. [ 0.3 , 1.0 ]
pref::Interior::DontRestrictOutside Debug mode. [ false , true ]


Console Method Summaries

activateLight deactivateLight echoTriggerableLights
getNumDetailLevels magicButton setAlarmMode


Console Methods

activateLight( lightName )

Purpose
Use the activateLight method to enable a named light in the current interior.

Syntax
lightName
– A string containing the name of a light to be activated.

Returns
No return value.

See Also
deactivateLight, echoTriggerableLights



deactivateLight( lightName )

Purpose
Use the deactivateLight method to disable a named light in the current interior.

Syntax
lightName
– A string containing the name of a light to be deactivated.

Returns
No return value.

See Also
activateLight, echoTriggerableLights



echoTriggerableLights()

Purpose
Use the echoTriggerableLights method to dump a list of all the triggerable lights this interior contains to the console.

Returns
No return value.

Notes
This is a nice helper function for those of us who can't always remember our light names.

See Also
activateLight, deactivateLight



getNumDetailLevels()

Purpose
Use the getNumDetailLevels method to determine the number of details that the current interior has.

Returns
Returns an integer value representing the maximum number of detail levels present in this interior.

Notes
Detail levels start from 0 and increment, where 0 has the most detail, 1 less than 0, 2 less than 1, et cetera.

See Also
setDetailLevel



setAlarmMode( mode )

Purpose
Use the setAlarmMode method to set the global alarm mode for this interior. This will enable or disable all alarm mode lights.

Syntax
mode
– A string. If this value is set to “On”, then all alarm mode lights will be enabled. Any other value disables all alarm mode lights.

Returns
No return value.



setDetailLevel( level )

Purpose
Use the setDetailLevel method to force the current interior to render at a specific LOD, if the interior supports that level.

Syntax
level
– An integer value greater than or equal to zero, representing a LOD to render this interior at.

Returns
No return value.

Notes
Detail levels start from 0 and increment, where 0 has the most detail, 1 less than 0, 2 less than 1, et cetera.

See Also
getNumDetailLevels



setSkinBase( basename )

Purpose
Use the setSkinBase method to switch skins on an interior.

Syntax
basename
– Text string equivalent to new texture(s) prefix.

Notes
Currently not working.


Item


This class, derived from ShapeBase, is used to represent small object in the world which are intended to be interacted with and/or picked up. That is coinscoins, grenades, rifles, gems, etc. This class of object does not require a collision mass although having one is useful in certain circumstances, specifically for line of sight collisions. By default the engine will supply a simple collision mesh for object to object collisions. This object supplies a several physical as well as visible behaviors, including object specific gravity, elasticity, lighting, etc.

Fields

Field Name Description Sample or Range
collidable -- deprecated
rotate If set to a true, this item will auto-rotate. [ false , true ]
static if this value is set to true, the item will not move when placed. Conversely, a non-static shape is allowed to move. [ false , true ]


Console Method Summaries

getLastStickyNormal getLastStickyPos isRotating


Console Methods

getLastStickyNormal()

Purpose
Use the getLastStickyNormal method to get the normal vector for the last sticky collision. If the item is not set to sticky, that is the datablock field sticky is set to false, this object will not track collisions.

Returns
Returns a string containing the XYZ values of the normal vector. If no normal vector is available, or if the item is not sticky this method will return the NULL string.

Notes
To enable sticky collisions, set the ItemData.sticky field to true.

See Also
getLastStickyPos



getLastStickyPos()

Purpose
Use the getLastStickyPos method to get the position vector for the last sticky collision. If the item is not set to sticky, that is the datablock field sticky is set to false, this object will not track collisions.

Returns
Returns a string containing the XYZ coordinates of the last collision position. If no normal vector is available, or if the item is not sticky this method will return the null string ("").

Notes
To enable sticky collisions, set the ItemData.sticky field to true.

See Also
getLastStickyNormal



isRotating()

Purpose
Use the isRotating method to determine if this item is playing the built-in rotation animation.

Returns
Returns true if the current item is rotating, that is if the rotate field was set to true when this object was created.

Notes
To enable rotation, set the rotate field in the item instance to true.



isStatic()

Purpose
Use the isStatic method to determine if this is a static item. A static item will not change position as the result of the application of outside forces like gravity and impulses.

Returns
Returns true if the current item is static, that is the static field was set to true when this object was created.

Notes
To make an item static, set the static field in the item instance to true.
A static item can still play animations and auto-rotate.

See Also
isRotating



setCollisionTimeout( obj )

Purpose
Use the setCollisionTimeout method to disable collisions between a specific GameBase derived object and this item. The default period for this timeout is 15 ticks (15 x 32ms is equal to 480ms) or roughly one-half second.

Syntax
obj
– The name or ID of a GameBase derived object with which to ignore collisions for ~1/2 second.

Returns
Returns true if the collision timeout was successfully set.

Notes
To modify the default timeout duration, see sCollisionTimeout in item.cc. It should be noted, that the colliding object is the one that is told to (temporarily) ignore subsequent collisions, not the item.


ItemData


This is the datablock associated with the item object. This class specifies most of the behavior of an item.

Fields

Field Name Description Sample or Range
Pickups
pickupName Message to be printed when this object is picked up. It is the responsibility of scripts to print this message. --
Physics
elasticity A floating-point value specifying how 'bouncy' this object is. i.e. How much of the shape's velocity is lost onCollision().


Note: Because of rounding errors between gravity and elasticity calculations, an object with 1.0 elasticity that is bouncing up and down will eventually bounce away.

Allowed: [ 0.0 , inf )


Suggested: [ 0.0 , 1.0 )

friction A floating-point value specifying how much velocity is lost to impact and sliding friction. Allowed:( -inf , inf )

Suggested: [ 0.0 , 1.0 ]

gravityMod A floating-point value specifying an individual variance of local gravity for this item. In other words, an item can be told to ignore gravity, or to be affected by 2x gravity, or even to float upward. Allowed:( -inf , inf )

Suggested:( -20.0 , 20.0 )

maxVelocity A floating-point value specifying a limit on this item's maximum velocity. This can be used to keep the item from falling for flying too fast. It is also helpful to limit the effects of other settings like velocity, etc.
sticky A boolean value specifying whether this object will arrest (stop) on impact. Furthermore, if an object is sticky, it retains information about the last location is hit which can be accessed via console methods (see below). [ true, false ]
Type
dynamicType An integer value which, if speficied, is added to the value retured by getType(). See dynamicType below
Light
lightColor A three-value floating-point vector contaiining the RGB components of this item's light. Individually: [ 0.0 , 1.0 ]
lightOnlyStatic A boolean value instructing the item to produce light, only in the case that the object field 'isStatic' is true. [ false , true ]
lightRadius A floating point value specifying the radius for this item's light. [ 0.0 , 20.0 ]
lightTime A floating point value specifying the time (in milliseconds) it takes for a pulsing light to transition on-off-on. ( 100 , inf )
lightType A string specifying the type of light, if any, this shape emits.

“NoLight”
“ConstantLight”
“PulsingLight”


Lightning


This class is used to represent the special effect lightning. Lightning can be generated or rendered from a bitmap. Lightning bolts start at the top of the specified lightning block and terminate somewhere at the bottom or below the specified lightning block.

Fields

Field Name Description Sample or Range
boltStartRadius This field specifies the radius within which lightning bolts will start. ( 0.0 , inf )
chanceToHitTarget Defunct. [ 0.0 , 1.0 ]
color This field is used to specify the color of lightning when it is created. Note, this is the exact color for generated lightning but should be considered a filter color for lightning that he uses bitmaps. "r g b a" (float)
fadeColor This field is used to specify the color of lightning as it fades out. Note, this is the exact color for generated lightning but should be considered a filter color for lightning that he uses bitmaps. "r g b a" (float)
strikeRadius This value is used to specify the radius in which lightning will strike. ( 0.0 , inf )
strikesPerMinute This value is used to specify the number of strikes permitted. Note, strikes occur at random but engine guarantees that at least strikes per minute strikes will occur space every minute. [ 0 , inf ]
strikeWidth This value specifies the width of the bitmap or generated lightning, at the point of its strike. ( 0.0 , inf )
useFog If such true this lightning will be affected by fog. Note, this only applies to lightning generated using bitmaps. [ false , true ]


Console Method Summaries

strikeObject strikeRandomPoint warningFlashes


Console Methods

strikeObject( obj )

Purpose
Use the strikeObject method to cause lightning to strike the object specified object.

Syntax
obj
– The name or ID of a GameBase derived object to strike with lightning.

Returns
No return value.

Notes
Not working as of this time.

See Also
strikeRandomPoint



strikeRandomPoint()

Purpose
Use the strikeRandomPoint method to generate a random lightning strike.

Returns
No return value.

See Also
strikeObject


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