Contents

Console Objects Fields and Methods Quick Reference Part 13


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.

SimSet



This is a generic container class for SimObjects. It provides a basic set of console methods for storing and accessing SimObjects contained in the set. Any SimObject may be contained in multiple SimSets

Console Methods

add bringToFront clear getCount
getObject isMember listObjects pushToBack
remove


add( obj1 , ... )

Purpose
Use the add method to add one or more objects to this SimSet.

Syntax
obj1
– The ID or name of an object to add to the SimSet.
... - A comma separated list of as many names and object IDs as you wish, all of which will be added to this SimSet.

Returns
No return value.

See Also
clear, bringToFront, getCount, getObject, isMember, listObjects, pushToBack.

Add new object to SimSet. Objects are validated on addition. i.e. If you pass an invalid ID an error will be printed and the add will fail.

obj1 – A object ID to add to the SimSet.
... - A list of comma separated IDs may be passed.



bringToFront( object )

Purpose
Use the bringToFront method to move object to front of SimSet (queue). This is useful for sorting and later when this class is used as the base to the GUIControl class.

Syntax
object
– The ID or name of an object already in the set.

Returns
No return value.

Notes
Do not attempt to call this for objects that are not in the SimSet as you can crash the engine.

See Also



clear()

Purpose
Use the clear method to remove all entries from SimSet.

Notes
This does not cause the entries to be deleted.

See Also
add, remove



getCount()

Purpose
Use the getCount method to determine how many objects are currently being tracked by this SimSet.

Returns
Returns an integer value between 0 and inf equal to the number of objects currently being tracked by this SimSet.

See Also
add, clear, remove



getObject( index )

Purpose
Use the getObject method to get the ID of an object stored in this SimSet at position index.

Syntax
index
– The queue position of the object to look for/get. Index starts at 0.

Returns
Returns ID of object at index in SimSet. If no object is found at that index, 0 is returned.



isMember( object )

Purpose
Use the isMember method to determine if object is being tracked by this SimSet.

Syntax
object
– An object name or ID to check for in this set.

Returns
Returns true if object is in this SimSet, otherwise returns false.

Notes
Unless you are absolutely sure about membership be sure to use this method prior to using bringToFront or pushToBack.

See Also
bringToFront, pushToBack



listObjects()

Purpose
Use the listObjects method to dump a list of all objects in this SimSet to the console.

Returns
No return value.

Notes
This is a helpful debug tool.



pushToBack( object )

Purpose
Use the pushToBack method to push an object (already in the SimSet) to then back of the queue.

Syntax
object
– The ID or name of an object already in the set.

Returns
No return value.

Notes
Do not attempt to call this for objects that are not in the SimSet as you can crash the engine.

See Also
bringToFront



remove( obj1 , ... )

Purpose
Use the remove method to remove one or more objects from this SimSet.

Syntax
obj1
– The ID or name of an object already in the SimSet.
... - A comma separated list of objects already in this SimSet.

Returns
No return value.

Notes
Attempting to remove an object from this SimSet which is not in the SimSet will have no effect.

See Also
add, clear


Sky



Fields

Field Name Description Sample or Range
cloudHeightPer0 Relative height of layer 0 clouds. [ 0.0 , cloudHeightPer1 ]
cloudHeightPer1 Relative height of layer 1 clouds. [ cloudHeightPer0 , cloudHeightPer2 ]
cloudHeightPer2 Relative height of layer 2 clouds. [ cloudHeightPer1 , 1.0 ]
cloudSpeed1 Cloud scrolling vs. windVelocity multiplier for layer 0 clouds. [ 0.0 , inf.0 )
cloudSpeed2 Cloud scrolling vs. windVelocity multiplier for layer 1 clouds. [ 0.0 , inf.0 )
cloudSpeed3 Cloud scrolling vs. windVelocity multiplier for layer 2 clouds. [ 0.0 , inf.0 )
cloudText[0,2] -- Not used
fogColor Color of general fog. "1.0 0.5 0.5 1.0"
fogDistance Affects fog density as a ratio of visibleDistance. [ 0.0 , inf.0 )
fogStorm1 Enables fog storm fading of layer 0. [ false , true ]
fogStorm2 Enables fog storm fading of layer 1. [ false , true ]
fogStorm3 Enables fog storm fading of layer 2. [ false , true ]
fogVolume1 Layer 0 fog definition. "dist low-elev high-elev"
fogVolume2 Layer 1 fog definition. "dist low-elev high-elev"
fogVolume3 Layer 2 fog definition. "dist low-elev high-elev"
fogVolumeColor[1:3] -- Not used
materialList Path to sky DML file. dml file path
noRenderBans If set to true, the sky box is not allowed to be fogged out. [ false , true ]
renderBottomTexture If set to true, the bottom texture in the DML file will be rendered. [ false , true ]
SkySolidColor The color for the untextured sky box. "r g b a" (float)
useSkyTextures Enables sky box texture rendering. [ false , true ]
visibleDistance Maximum render distance. [ 0.0 , inf )
windEffectPrecipitation If set to true, wind will blow precipitation. [ false , true ]
windVelocity Magnitude and direction of wind. “1.5 2.0 0.0”


Globals

Variable Name Description Sample or Range
pref::CloudOutline Enable or disable cloud outlining. [ false , true ]
pref::CloudsOn Enables clound rendering. [ false , true ]
pref::NumCloudLayers Limits number of clound layers that are rendered. [ 0 , 3 ]
pref::SkyOn Enables the sky. [ false , true ]


Console Methods

getWindVelocity() realFog() setWindVelocity() stormClouds()
stormCloudsShow() stormFog() stormFogShow()


getWindVelocity()

Purpose
Use the getWindVelocity method to tet the current wind velocity vector.

Returns
Returns a three-element floating point vector representing the direction and velicity of the wind.



setWindVelocity( x , y , z )

Purpose
Use the setWindVelocity method to modify the current wind velocity.

Syntax
x
– A floating-point value representing the X component of the wind velocity.
y – A floating-point value representing the Y component of the wind velocity.
z – A floating-point value representing the Z component of the wind velocity.

Returns
No return value.



stormClouds( show , duration )

Purpose
Use the stormClouds method to show or hide all defined cloud layers over duration seconds.

Syntax
show
– Boolean value specifying whether to show (true), or hide (false) clouds.
duration – Time in seconds within which to achieve results.

Returns
No return value.

Notes

  • duration cannot be zero
  • Layers fade in top-to-bottom and fade out bottom-to-top


See Also
stormCloudsShow, stormFog, stormFogShow



stormCloudsShow( show )

Purpose
Use the stormCloudsShow method to show or hide all defined cloud layers instantly.

Syntax
show
– Boolean value specifying whether to show (true), or hide (false) clouds.

Returns
No return value.

See Also
stormClouds, stormFog, stormFogShow



stormFog( percent , duration )

Purpose
Use the stormFog method to show or hide all stormFog enabled fog layers over duration seconds.

Syntax
percent
– Floating-point value specifying ending fade level for fog layers.
duration – Time in seconds within which to achieve results.

Returns
No return value.

Notes

  • duration cannot be zero
  • Layers fade in bottom to top and fade out top-to-bottom
  • stormFogn – Must be checked for that layer to be affected by this method.
  • percent – Must be in range [ 0.0 , 1.0 ]


See Also
stormClouds, stormCloudsShow, stormFogShow



stormFogShow( show )

Purpose
Use the stormFogShow method to show or hide all stormFog enabled fog layers instantly.

Syntax
show
– Boolean value specifying whether to show (true), or hide (false) fog.

Returns
No return value.

See Also
stormClouds, stormCloudsShow, stormFog


SpawnSphere


Mission marker used to mark drop points. Can be used for many things. The fields in this object are only used by scripts, not the engine.

Fields

Field Name Description Sample or Range
indoorWeight Only used by scripts. any float
outdoorWeight Only used by scripts. any float
radius Only used by scripts. any float
sphereWeight Only used by scripts. any float


Splash


No fields or methods to discuss.

SplashData



Fields

Field Name Description Sample or Range
acceleration The acceleration of the splash, as used in the physical simulation. Affects the splash's velocity over time, along with the gravitational force acting in the system. ( -inf.0 , inf.0 )

colors[0]
colors[1]
colors[2]
colors[3]

Array of colors. Specifies what colors are to be used for splash rings at each time value specified in the times array field. First entry in the colors array corresponds to the initial ring color, and is interpolated with colors[1] until times[0] time has elapsed, at which time colors[1] is the draw color and it begins being interpolated with colors[2]. See the times and ringLifetime field documentation for more information. "1.0 0.5 0.5"
delayMS Note: this field currently has no tangible effect in the engine's simulation. --
delayVariance Note: this field currently has no tangible effect in the engine's simulation. --
ejectionAngle The angle at which new splash rings should be ejected, specified in degrees. ( -inf.0 , inf.0 )
ejectionFreq The frequency with which new splash rings should be created. ( -inf.0 , inf.0 )

emitter[0]
emitter[1]
emitter[2]

Array of pointers to ParticleEmitterData datablocks which specify the particle emissions to be used for the Splash object. see type
explosion ExplosionData datablock, which will be used to spawn an explosion for the splash. see type
height This field currently has no tangible effect in the engine's simulation. --
lifetimeMS Used along with lifetimeVariance to determine the maximum time the Splash object persists in the world. Measured in whole milliseconds.
lifetimeVariance Used along with lifetime to determine the maximum time the Splash object persists in the world. The Splash object's actual life-time is calculated by adding the lifetime field with a random integer from -1*lifetimeVariance to lifetimeVariance. A Splash object will be marked as dead once it's life-time expires, but a Splash object will not delete itself until its ring life-time has expired as well; see the documentation for the ringLifetime field for more information. Using lifetimeVariance, separate Splash objects sharing the same SplashData datablock can be given varied behavior. ( -inf , inf )
numSegments The number of segments used to generate each ring of the splash. Each segment has an associated splash ring texture u-coordinate, which is calculated by dividing the segment's position in the splash ring's segment list by the total number of the ring's segments, and then multiplying this result by the scalar value in the texWrap field. ( -inf , inf )
ringLifetime The life-time, in seconds, of splash rings generated by the Splash object. Also used during the rendering of splash rings to determine the opacity of the ring; the ring starts out fully transparent, and follows a linear progression to become fully opaque at the mid-point of its life-time, after which time a linear fall-off in opacity occurs until the end of the ring's life-time, at which point it is once again fully transparent. a Splash object will not delete itself until all ring's it has generated have expired.
scale Note: this field currently has no tangible effect in the engine's simulation. --
soundProfile Note: this field currently has no tangible effect in the engine's simulation.
startRadius The inital radius with which to eject splash rings, affected by velocity over time. ( -inf.0 , inf.0 )
texFactor Scalar value used to translate the v-coordinate value of texture reads from the splash rings texture during their rendering. texFactor is not applied directly to scale v-coordinate reads, as the texWrap field is. Rather, texFactor is multiplied with the non-integer portion of the elapsed time (elapsedTime - int(elapsedTime)) to determine the v-coordinate texture position to be read for the splash ring.escription. ( -inf.0 , inf.0 )
texture The texture file to be used for the splash rings. ~/path/filename.png
texWrap Scalar value used along with numSegments to determine the u-coordinate value of texture reads from the splash rings texture during their rendering. See the numSegments field documentation for more information. ( -inf.0 , inf.0 )

times[0]
times[1]
times[2]
times[3]

Array of time values. Each entry is used to help determine the color used in rendering splash rings, as described in the colors field documentation. ( -inf.0 , inf.0 )
velocity The velocity of the splash, as used in physical simulation. Affects the radius of the splash over time, and the velocity of splash rings. Velocity changes over time in accordance with the value specified with the acceleration field, and the gravity affecting the physical simulation. ( -inf.0 , inf.0 )
width Note: this field currently has no tangible effect in the engine's simulation. --


StaticShape


A concrete class derived from ShapeBase used to reprsent world objects.

Console Methods

getPoweredState() setPoweredState()


getPoweredState()

Purpose
Use the getPoweredState method to get the shape's current 'powered' state.

Syntax
state
– Is the shape powered? [ false , true ]

Returns
No return value.

Notes
This feature does not modify any engine behaviors and is purely for scripted use.

See Also
setPoweredState



setPoweredState( isPowered )

Purpose
Use the setPoweredState method to set shape's current 'powered' state.

Syntax
state
– Is the shape powered? [ false , true ]

Returns
No return value.

Notes
This feature does not modify any engine behaviors and is purely for scripted use.

See Also
getPoweredState


StaticShapeData


Datablock associated with StaticShape object class.

Fields

Field Name Description Sample or Range
dynamicType An integer value which, if speficied, is added to the value returned by getType(). See dynamicType below
noIndividualDamage Boolean value used as a hint to scripts, to NOT apply damage to this shape. --


Sun


Mission object representing mission lighting parameters.

Fields

Field Name Description Sample or Range
ambient Color / Intensity of ambient light. "r g b i" (float)
azimuth Azimuth of sun. [ 0, 360 ]
color Color / Intensity of direct light. "r g b i" (float)
elevation Inclination (elevation) of sun. [ 0, 360 ]


TCPObject


Console Methods

connect disconnect listen


connect( addr )

Purpose
Use the connect method to request a connection to a remote agent at the address addr.

Syntax
addr
– A string containing an address of the form: “A.B.C.D:Port”, where A .. B are standard IP numbers between 0 and 255 and Port can be between 1000 and 65536.

Returns
No return value.

See Also
disconnect



disconnect()

Purpose
Use the disconnect method to close a previously opened connetion without destroying the requesting TCPOpbject.

Returns
No return value.

Notes
This will close any open connection, but not destroy this object. Thus, the object can be used to open a new connection.

See Also
connect



listen( port )

Purpose
Use the listen method to allow this TCPObject to accept connections on the specified port.

Syntax
port
– A value between 1000 and 65536.

Returns
No return value.



send( ... )

Purpose
Use the send method to send any number of parameters, as strings, one at a time to the agent at the other end of the connection.

Syntax
...
– Any number of arguments, as strings. Each string is sent separately. i.e. The arguments are not concatenated.

Returns
No return value.


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 12 || Part 14 || Part 15