Contents

Console Objects Fields and Methods Quick Reference



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.

ActionMap



Console Method Summaries

bind
bindCmd
getBinding
getCommand
getDeadZone
getScale
isInverted
pop
push



Console Methods

bind( device , action , [ modifier , mod... ] , command )

Purpose
Use the bind method to associate a function to a keystroke or other device input.

Syntax
device
- Name of the device to bind the command to (see 'Device Table' below).
action - Name of the action to watch for(see 'Action Table' below).
modifier – Special modifiers (mouse only), such as dead spot, etc.
command - The function to be called on make and break.

Returns
No return value.

Notes
The command bound via the bind function must be specified as a flat name with no elipses or semi-colon termination and will be called on make and break events (i.e. key press and release for a mapped key).

Args:

Warning: When a function is bound to a keystroke or other device input, and no other versions of the binding are provided, the function will be called even if a modifier key like CTRL, ALT, or SHIFT is also pressed. For clarification, see 'Bind Sample' example below.

See Also
bindCmd, getBinding, unbind



bindCmd( device , action , makeCmd , breakCmd )

Purpose
Use the bindCmd method to associate up to two functions to a keystroke or other device input.

Syntax
device
- Name of the device to bind the command to (see 'Device Table' below).
action - Name of the action to watch for(see 'Action Table' below).
makeCmd - The function to be called on make event.
breakCmd - The function to be called on break event.

Returns
No return value.

Notes
The makeCmd is bound to the make event and the breakCmd is bound to the break event and in both cases, the commands are specified as complete scripts, with all arguments, elipses, and the terminating semi-colon. Either of these commands may be non-specified (NULL strings). For clarification, see 'Bind Sample' example below.

See Also
bind, getBinding, unbind



getBinding( command )

Purpose
Use the getBinding method to get the binding for a specified command.

Syntax
command
– The function to seek a binding for.

Returns
Returns a string containing the binding as a field (TAB separated string), or a NULL string meaning 'no binding found'.

See Also
bind, bindCmd



getCommand( device , action )

Purpose
Use the getCommand method to get the function associated with a specific device + action pair.

Syntax
device
- Name of the device to bound to a command (see 'Device Table' below).
action - Name of the action to watch for (see 'Action Table' below).

Returns
Returns the function name or specification associated with the specified device + action pair, or a NULL-string meaning 'no binding found'.


See Also
bind, bindCmd, getBinding



getDeadZone( device , action )

Purpose
Use the getDeadZone method to get the dead-zone associated with a specific device + action pair.

Syntax
device
- Name of the device to bound to a command (see 'Device Table' below).
action - Name of the action to watch for (see 'Action Table' below).

Returns
Returns a dead-zone specification, or "0 0" meaning that there is no dead-zone, or a NULL string meaning the mapping was not found.

See Also
bind, bindCmd



getScale( device , action )

Purpose
Use the getScale method to get the scale associated with a specific device + action pair.

Syntax
device
- Name of the device to bound to a command (see 'Device Table' below).
action - Name of the action to watch for (see 'Action Table' below).

Returns
Returns 1 if no scale is associated with the specified device + action pair, or the mapping was not found.

See Also
bind, bindCmd



isInverted( device , action )

Purpose
Use the isInverted method to determine if a specific device + action pair in inverted.

Syntax
device
- Name of the device to bound to a command (see 'Device Table' below).
action - Name of the action to watch for (see 'Action Table' below).

Returns
Returns 1 if the mouse (or other scrolling device) is inverted, 0 otherwise.

Notes
This only applies to scrolling devices.

See Also
bind, bindCmd



pop()

Purpose
Use the pop method to de-activate an ActionMap and remove it from non-global ActionMap stack.

Returns
No return value.

See Also
push



push()

Purpose
Use the push method to activate an ActionMap and place it at the top of the non-global ActionMap stack.

Returns
No return value.

See Also
pop



save( [ fileName ] [ , append ] )

Purpose
Use the save method to save an entire action map specification to a file. If append is not specified, or specified as false, fileName will be overwritten, otherwise the action map will be appended to the file.


Syntax
fileName
– Full path to file in which to store action map definition.
append - If true, do not overwrite the file, else start from scratch.

Returns
No return value.



unbind( device , action )

Purpose
Use the unbind method to remove a previosly specified device + action pair from the action map.

Syntax
device
- Name of the device to bound to a command (see 'Device Table' below).
action - Name of the action to watch for (see 'Action Table' below).

Returns
No return value.

See Also
bind, bindCmd



Device Table

Device Description
keyboardN This is the Nth keyboard hooked up to the system. For the first keyboard, either "keyboard" or "keyboard0" is acceptable.
mouseN This is the Nth mouse hooked up to the system. For the first mouse, either "mouse" or "mouse 0" is acceptable.
joystickN This is the Nth joystick or gamepad hooked up to the system.
unknownN This is the Nth unknown device up to the system. In other words, some devices has been sampled, but TGE doesn't know what it is.


Action Table

Action Description
button0, buton1, ..., button31 This is a mouse, joystick, or gamepad button press. For the mouse, buttons 0,1, and 2 are left, right, and middle buttons repspectively. See the appendix for other button mappings.
a .. z, A .. Z, 0..9, F1..F12 These are keyboard inputs. Because this list is so long and in order to accomodate possible variances for special keyboards and other devices a same GUI has been provided with the kit that displays the current action, be it keyboard, mouse, joystick/gamepad, or other device. Simple start the kit and click SampleGUIs -> Input. Follow the instructions provided in the sample.
shift, ctrl, alt These are modifiers and are not used standalone, but they are included in the action string, for example: "shift p" is the shift key and the p key pressed at the same time.
lshift, rshift, lctrl, rctrl, lalt, ralt These are special modifier actions. Theye only register as 'break' events when one of these keys: left shift, right shift, left ctrl, right ctrl, left alth, or right alt is released.


Mouse Modifiers

Action Modifiers Description
D %x %y Has dead zone. This is used to add a dead zone for the mouse. Motions in this zone will not be recorded. This can be used to remove the jitter caused by a ‘nervous hand’.
S %s Has Scale. This is used to scale the mouse motion (by a multiple).
I Inverted. This is used to invert the mouse.
R %s Has Scale. Same as S.


AIConnection



Console Method Summaries

getAddress
getFreeLook
getMove
getTrigger
setFreeLook
setMove



Console Methods

getAddress()

Purpose
Use the getAddress method to get the address an AIConnection is currently connected to.

Returns
Returns the address of the current connection in the format: " A.B.C.D:Port ", where A .. B are standard IP numbers between 0 and 255 and Port can be between 1000 and 65536.



getFreeLook()

Purpose
Use the getFreeLook method to check if the current connection is in free look mode.

Returns
Returns true if the current connection is free look mode.

See Also
setFreeLook



getMove( field )

Purpose
Use the getMove method to get the move setting for field.

Syntax
field
– Move setting to check.

Returns
Returns a value between 0.0 and 1.0.

See Also
getTrigger, setMove, setTrigger



getTrigger( trigger )

Purpose
Use the getTrigger method to get the current value for a trigger specified by the numeric value trigger.

Syntax
trigger
– An integer value between 0 and 6 representing on of the seven triggers.

Returns
Returns 1 if the trigger is active/depressed, and 0 if it is not.

See Also
getMove, setMove, setTrigger



setFreeLook( isFreeLook )

Purpose
Use the setFreeLook method to set the current connection to a free look mode.

Syntax
isFreeLook
– A boolean value. If true, freelook will be enable, otherwise it will be disabled.

Returns
No return value.

See Also
getFreeLook



setMove( field , value )

Purpose
Use the setMove method to set a move type for the control-object connected to this AIConnection.

Syntax
field
– A string containing a move type. See 'move types' table below.
value – A value between 0.0 and 1.0.

Returns
No return value.

See Also
getMove, getTrigger, setTrigger



setTrigger( trigger , set )

Purpose
Use the setTrigger method to set or un-set a trigger on the control-object connected to this AIConnection.

Syntax
trigger
– An integer value between 0 and 6 representing on of the seven triggers.
set – A boolean value. If true, this trigger is enabled/set/depressed, otherwise, it is disabled/un-set/released.

Returns
No return value.

See Also
getMove, getTrigger, setMove



AIPlayer



Console Method Summaries

clearAim
getAimLocation
getAimObject
getMoveDestination
setAimLocation
setAimObject
setMoveDestination
setMoveSpeed
stop



Console Methods

clearAim()

Purpose
Use the clearAim method to stop aiming at an object or a point.

Returns
No return value.

See Also
setAimObject, setAimLocation



getAimLocation()

Purpose
Use the getAimLocation method to get the point the bot is currently aiming at. This will reflect the position set by setAimLocation(), or the position of the object that the bot is now aiming at, or if the bot is not aiming at anything, this value will change to whatever point the bot's current line-of-sight intercepts.

Returns
Returns an XYZ vector containing the location of the bot's current aim.

See Also
setAimObject, setAimLocation



getAimObject()

Purpose
Use the getAimObject method to get the ID of the object the bot is currently aiming at.

Returns
Returns -1 if no object is being aimed at, or a non-zero positive integer ID of the object the bot is aiming at.

See Also
getAimLocation, setAimObject, setAimLocation



getMoveDestination()

Purpose
Use the getMoveDestination method to get the last set move destination.

Returns
Returns a vector containing the <x y z> position of the bot's current move destination. If no move destination has yet been set, this returns "0 0 0".

Notes
The bot will not look at its destination unless it is told to, which means it can aim at one object or location while walking in another direction.

See Also
setMoveDestination



setAimLocation( target )

Purpose
Use the setAimLocation method to set the bot's aim location to target.

Syntax
target
– An XYZ vector representing a position in the game world.

Returns
No return value.

See Also
getAimLocation, getAimObject, setAimObject



setAimObject( obj [ , offset ] )

Purpose
Use the setAimObject method to set the current object for the bot to aim at, using an optional offset to modify that aim.

Syntax
obj
– A valid GameBase object ID or name.
offset – A three-element offset vector which will be added to the position of the aim object.

Returns
No return value.


See Also
getAimLocation, getAimObject, setAimLocation



setMoveDestination( goal [ , slowDown ] )

Purpose
Use the setMoveDestination method to set the bot's current move destination top goal. This will cause the bot to start moving immediately towards that destination.

Syntax
goal
– An XYZ vector containing the position for the bot to move to.
slowDown – A boolean value. If set to true, the bot will slow down when it gets within 5-meters of its move destination. If false, the bot will stop abruptly when it reaches the move destination. By default, this is true.

Returns
No return value.

Notes
Upon reaching a move destination, the bot will clear its move destination and calls to getMoveDestination will return a NULL string.

See Also
getMoveDestination, setMoveSpeed, stop



setMoveSpeed( speed )

Purpose
Use the setMoveSpeed method to modify the bot's movement rates between 0.0 (0%) and 1.0 (100%).

Syntax
speed
– A speed multiplier between 0.0 and 1.0. This is multiplied by the bot's base movement rates (from its datablock).

Returns
No return value.

See Also
setMoveDestination, stop



stop()

Purpose
Use the stop method to stop the bot from moving.

Returns
No return value.

Notes
This does not clear the bot's move destination, so a call to getMoveDestination will be able to get it.

See Also
setMoveDestination, setMoveSpeed


AIWheeledVehicle



Fields

Field Name Description Sample or Range
disableMove If this value is set to true, the vehicle will not respond to any movement commands. [ false , true ]


Console Method Summaries

getMoveDestination
setMoveDestination
setMoveSpeed
setMoveTolerance
stop


Console Methods

getMoveDestination()

Purpose
Use the getMoveDestination method to get the last set move destination.

Returns
Returns a vector containing the <x y z> position of the vechicle's current move destination. If no move destination has yet been set, this returns "0 0 0".

Notes
The vechicle will not look at its destination unless it is told to, which means it can aim at one object or location while walking in another direction.

See Also
setMoveDestination



setMoveDestination( goal [ , slowDown ] )

Purpose
Use the setMoveDestination method to set the vehicle's current move destination top goal. This will cause the vehicle to start moving immediately towards that destination.

Syntax
goal
– An XYZ vector containing the position for the vehicle to move to.
slowDown – A boolean value. If set to true, the vehicle will slow down when it gets within 5-meters of its move destination. If false, the vehicle will stop abruptly when it reaches the move destination. By default, this is true.

Returns
No return value.

Notes
Upon reaching a move destination, the vehicle will clear its move destination and calls to getMoveDestination will return a NULL string.

See Also
getMoveDestination, setMoveSpeed, setMoveTolerance, stop

Args:
goal - A vector containing the <x y z> position for the vehicle to move to.
slowDown – Slow down near destination?



setMoveSpeed( speed )

Purpose
Use the setMoveSpeed method to modify the vechicle's movement rates between 0.0 (0%) and 1.0 (100%).

Syntax
speed
– A speed multiplier between 0.0 and 1.0. This is multiplied by the vechicle's base movement rates (from its datablock).

Returns
No return value.

See Also
setMoveDestination, setMoveTolerance, stop



setMoveTolerance( tolerance )

Purpose
Use the setMoveTolerance method to set the tolerance radius for an AIWheeled vehicle's target position. In other words, how close to the target does the vehicle have to get before it is considered 'on target'?

Syntax
tolerance
– The maximum distance away from a move target the vehicle can be and still be considered 'on target'.

Returns
No return value.

Notes
Because vehicles can have major variances in size, and because of the way 'on target' is measured, this method is provided to make it easier for a wheeled vehicle to hit it's movement destination.

See Also
getMoveSpeed, setMoveSpeed



stop()

Purpose
Use the stop method to stop the vechicle from moving.

Returns
No return value.

Notes
This does not clear the vechicle's move destination, so a call to getMoveDestination will be able to get it.

See Also
setMoveDestination, setMoveSpeed



Audio Description



Fields

Field Name Description
coneInsideAngle Sweep angle of inner cone.
coneOutsideAngle Sweep angle of Outside cone.
coneOutsideVolume Maximum gain in Zone C (see above).
coneVector Audio emitter’s eye (pointing) vector.
environmentLevel Amount by which the audioEnvironment datablock used with this datablock will affect sound.
is3D Is this a 2D or a 3D sound?
isLooping If true, sound loops, othewise sound plays only once.
isStreaming If true, sound source is streaming, otherwise sound is from file.
loopCount Number of times to loop this sound

   -1 – Loop infinitely.
   0 – Loop once and only once.
   1 – Loop once, possibly twice.
   (N > 1) – Loop N times.

maxDistance Outer boundary for 3D sound sphere. Sound turns on-off here at this distance from 3D emitter.
maxLoopGap Maximum delay between subsequent loop.
minLoopGap Minimum delay between subsequent loop.
ReferenceDistance Distance at which sound turns on to 100% of current maximum gain.
type Audio type. There can be multiple numeric audio types, each with its own globally controlled max gain.
volume Maximum gain for this source.


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