3D Game Programming All In One (2004)
.pdf
728 Appendix A ■ The Torque Game Engine Reference
StaticRenderedObjectType |
67108864 |
27 |
unassigned |
268435456 |
28 |
unassigned |
536870912 |
29 |
unassigned |
1073741824 |
30 |
unassigned |
2147483648 |
31 |
Table A.2 |
Torque Object Methods |
Object Class |
Method |
AIPlayer |
ai.moveForward() |
|
ai.walk() |
|
ai.run() |
|
ai.stop() |
|
ai.setMoveSpeed(float) |
|
ai.setTargetObject(object) |
|
ai.getTargetObject() |
|
ai.targetInSight() |
|
ai.aimAt( point) |
|
ai.getAimLocation() |
BanList |
BanList::add(id, TA, banTime) |
|
BanList::addAbsolute(id, TA, banTime) |
|
BanList::removeBan(id, TA) |
|
BanList::isBanned(id, TA) |
|
BanList::export(filename) |
Camera |
camera.getPosition() |
|
camera.setOrbitMode(obj, xform,min-dist,max-dist, cur-dist) |
|
camera.setFlyMode() |
|
watchView.edit(newValue) |
|
watchView.remove() |
|
watchView.queryAll() |
|
watchView.clear() |
Debris |
obj.init(position, velocity) |
EditTSCtrl |
EditTSCtrl.renderSphere(pos, radius,=) |
|
EditTSCtrl.renderCircle(pos, normal, radius,=) |
|
EditTSCtrl.renderTriangle(pnt, pnt, pnt) |
|
EditTSCtrl.renderLine(start, end) |
FileObject |
file.openForRead(fileName) |
|
file.openForWrite(fileName) |
|
file.openForAppend(fileName) |
|
file.writeLine(text) |
continued
Team LRN
Torque Reference Tables |
729 |
file.isEOF()
file.readLine()
file.close()
FlyingVehicle FlyingVehicle.setCreateHeight(bool) GameBase obj.getDataBlock()
obj.setDataBlock(DataBlock) GameConnection conn.chaseCam(size)
conn.setControlCameraFov(fov)
conn.getControlCameraFov()
conn.transmitDataBlocks(seq)
conn.activateGhosting()
conn.resetGhosting()
conn.setControlObject(%obj)
conn.getControlObject()
conn.isAIControlled()
conn.play2D(AudioProfile)
conn.play3D(AudioProfile,Transform)
conn.isScopingCommanderMap()
conn.scopeCommanderMap(bool)
conn.listenEnabled()
conn.getListenState(clientId)
conn.canListen(clientId) conn.listenTo(clientId, true|false) conn.listenToAll() conn.listenToNone() conn.setVoiceChannels(0-3) conn.setVoiceDecodingMask(mask)
conn.setVoiceEncodingLevel(codecLevel) conn.setBlackOut(fadeTOBlackBool, timeMS) conn.setMissionCRC(crc)
GuiBitmapCtrl guiBitmapCtrl.setBitmap(blah) guiBitmapCtrl.setValue(xAxis, yAxis)
GuiCanvas canvas.renderFront(bool) canvas.setContent(ctrl) canvas.getContent() canvas.pushDialog(ctrl) canvas.popDialog() canvas.popLayer() canvas.cursorOn() canvas.cursorOff()
canvas.setCursor(cursor)
continued
Team LRN
730 Appendix A ■ The Torque Game Engine Reference
canvas.hideCursor()
canvas.showCursor()
canvas.repaint()
canvas.reset()
canvas.isCursorOn()
canvas.getCursorPos()
canvas.setCursorPos(pos) GuiControl ctrl.getPosition()
ctrl.getExtent()
ctrl.getMinExtent() ctrl.resize(x, y, w, h) ctrl.setValue(value) ctrl.getValue() ctrl.setActive(value) ctrl.isActive() ctrl.setVisible(value) ctrl.isVisible() ctrl.isAwake() ctrl.setProfile(profile)
ctrl.makeFirstResponder(value) GuiEditCtrl editCtrl.addNewCtrl(ctrl)
editCtrl.select(ctrl)
editCtrl.setRoot(root)
editCtrl.setCurrentAddSet(ctrl)
editCtrl.toggle()
editCtrl.justify(mode)
editCtrl.bringToFront()
editCtrl.pushToBack()
editCtrl.deleteSelection() GuiFilterCtrl guiFilterCtrl.getValue()
guiFilterCtrl.setValue(f1, f2,...) guiFilterCtrl.identity()
GuiFrameSetCtrl gfsc.frameBorder(index, enable) gfsc.frameMovable(index, enable) gfsc.frameMinExtent(index, w, h)
GuiInspector inspector.inspect(obj) inspector.apply(newName)
GuiMessageVectorCtrl [GuiMessageVectorCtrl].attach(MessageVectorId) [GuiMessageVectorCtrl].detach()
GuiPopUpMenuCtrl menu.sort()
menu.add(name,idNum{,scheme})
continued
Team LRN
Torque Reference Tables |
731 |
menu.addScheme(id, fontColor, fontColorHL, fontColorSEL) menu.getText()
menu.setText(text)
menu.getValue()
menu.setValue(text)
menu.clear()
menu.forceOnAction()
menu.forceClose()
menu.getSelected()
menu.setSelected(id)
menu.getTextById(id) menu.setEnumContent(class, enum) menu.findText(text)
menu.size()
menu.replaceText(bool) GuiSliderCtrl guiSliderCtrl.getValue() GuiTerrPreviewCtrl guiTerrPreviewCtrl.reset()
guiTerrPreviewCtrl.setRoot()
guiTerrPreviewCtrl.getRoot() guiTerrPreviewCtrl.setOrigin(x, y) guiTerrPreviewCtrl.getOrigin() guiTerrPreviewCtrl.getValue() guiTerrPreviewCtrl.getValue(t)
GuiTextListCtrl textList.getSelectedId() textList.setSelectedById(id) textList.setSelectedRow(index) textList.clearSelection() textList.clear() textList.addRow(id,text,index) textList.setRow(id,text) textList.getRowId(index) textList.removeRowById(id) textList.getRowTextById(id) textList.getRowNumById(id) textList.getRowText(index) textList.removeRow(index) textList.rowCount() textList.scrollVisible(index) textList.sort(colId{,increasing})
textList.sortNumerical(colId{, increasing})
textList.findText(text)
continued
Team LRN
732 |
Appendix A ■ |
The Torque Game Engine Reference |
|
|
textList.setRowActive(id) |
|
|
textList.isRowActive(id) |
|
GuiTreeViewCtrl |
treeViewCtrl.open(obj) |
|
HTTPObject |
obj.get(addr, request-uri) |
|
|
obj.post(addr, request-uri, query, post) |
|
InteriorInstance |
[InteriorObject].activateLight() |
|
|
[InteriorObject].deactivateLight() |
|
|
[InteriorObject].echoTriggerableLights() |
|
|
[InteriorObject].getNumDetailLevels() |
|
|
[InteriorObject].setDetailLevel(level) |
|
Item |
obj.isStatic() |
|
|
obj.isRotating() |
|
|
obj.setCollisionTimeout(object) |
|
|
obj.getLastStickyPos() |
|
|
obj.getLastStickyNormal() |
|
Lightning |
[LightningObject].warningFlashes() |
|
|
[LightningObject].strikeRandomPoint() |
|
|
[LightningObject].strikeObject(id) |
|
MessageVector |
[MessageVector].deleteLine(DeletePos) |
|
|
[MessageVector].clear() |
|
|
[MessageVector].dump(filename{, header}) |
|
|
[MessageVector].getNumLines() |
|
|
[MessageVector].getLineText(Line) |
|
|
[MessageVector].getLineTag(Line) |
|
|
[MessageVector].getLineTextByTag(Tag) |
|
|
[MessageVector].getLineIndexByTag(Tag) |
|
PhysicalZone |
obj.activate() |
|
|
obj.deactivate() |
|
Player |
obj.setActionThread(sequenceName) |
|
|
obj.setControlObject(obj) |
|
|
obj.getControlObject() |
|
|
obj.clearControlObject() |
|
|
obj.getDamageLocation(pos) |
|
Precipitation |
precipitation.setPercentage(percentage <1.0 to 0.0>) |
|
|
precipitation.stormPrecipitation(percentage <0 to 1>, Time) |
|
SceneObject |
obj.getScale() |
|
|
obj.getWorldBox() |
|
|
obj.getWorldBoxCenter() |
|
|
obj.getObjectBox() |
|
|
obj.getForwardVector() |
|
ShapeBase |
obj.setShapeName(tag) |
continued
Team LRN
Torque Reference Tables |
733 |
obj.getShapeName()
obj.playAudio(slot,AudioProfile)
obj.playAudio(slot)
obj.playThread(thread)
obj.setThreadDir(thread,bool)
obj.stopThread(thread)
obj.pauseThread(thread)
obj.mountObject(object,node)
obj.unmountObject(object)
obj.unmount()
obj.isMounted()
obj.getObjectMount()
obj.getMountedObjectCount()
obj.getMountedObjectNode(index)
obj.getMountedObject(index)
obj.getMountNodeObject(node)
obj.mountImage(DataBlock,slot,[loaded=true],[skinTag])
obj.unmountImage(slot)
obj.getMountedImage(slot)
obj.getPendingImage(slot)
obj.isImageFiring(slot)
obj.isImageMounted(DataBlock)
obj.getMountSlot(DataBlock)
obj.getImageSkinTag(slot)
obj.getImageState(slot)
obj.getImageTrigger(slot)
obj.setImageTrigger(slot,bool)
obj.getImageAmmo(slot)
obj.setImageAmmo(slot,bool)
obj.getImageTarget(slot)
obj.setImageTarget(slot,bool)
obj.getImageLoaded(slot)
obj.setImageLoaded(slot,bool)
obj.getMuzzleVector(slot)
obj.getMuzzlePoint(slot)
obj.getSlotTransform(slot)
obj.getAIRepairPoint()
obj.getVelocity()
obj.setVelocity(Vector)
obj.applyImpulse(Pos,Vector)
obj.getEyeVector()
continued
Team LRN
734 |
Appendix A ■ |
The Torque Game Engine Reference |
|
|
obj.getEyeTransform() |
|
|
obj.setEnergyLevel(value) |
|
|
obj.getEnergyLevel() |
|
|
obj.getEnergyPercent() |
|
|
obj.setDamageLevel(value) |
|
|
obj.getDamageLevel() |
|
|
obj.getDamagePercent() |
|
|
obj.setDamageState(state) |
|
|
obj.getDamageState() |
|
|
obj.isDestroyed() |
|
|
obj.isDisabled() |
|
|
obj.isEnabled() |
|
|
obj.applyDamage(value) |
|
|
obj.applyRepair(value) |
|
|
obj.setRepairRate(value) |
|
|
obj.getRepairRate() |
|
|
obj.setRechargeRate(value) |
|
|
obj.getRechargeRate() |
|
|
obj.getControllingClient() |
|
|
obj.getControllingObject() |
|
|
obj.canCloak() |
|
|
obj.setCloaked(true|false) |
|
|
obj.isCloaked() |
|
|
obj.setDamageFlash(flash level) |
|
|
obj.getDamageFlash() |
|
|
obj.setWhiteOut(flash level) |
|
|
obj.getWhiteOut() |
|
|
obj.setInvincibleMode(time, speed) |
|
|
obj.getCameraFov() |
|
|
obj.setCameraFov(fov) |
|
|
obj.hide(bool) |
|
|
obj.isHidden() |
|
|
startFade( U32, U32,bool) |
|
|
obj.setDamageVector(vec) |
|
ShapeBaseData |
obj.checkDeployPos(xform) |
|
|
obj.getDeployTransform(pos, normal) |
|
SimpleNetObject |
obj.setMessage(msg) |
|
Sky |
sky.stormCloudsOn(0 or 1,Time) |
|
|
sky.stormFogOn(Percentage <0 to 1>, Time) |
sky.realFog(0 or 1, max, min, speed)
sky.getWindVelocity()
continued
Team LRN
|
Torque Reference Tables |
735 |
|
|
|
|
sky.setWindVelocity(x, y, z) |
|
|
sky.stormCloudsShow(bool) |
|
|
sky.stormFogShow(bool) |
|
StaticShape |
obj.setPoweredState(bool) |
|
|
obj.getPoweredState(bool) |
|
TCPObject |
obj.listen(port) |
|
|
obj.send(string,...) |
|
|
obj.connect(addr) |
|
|
obj.disconnect() |
|
Terraformer |
Terraformer.canyon(dst, freq, turb, seed) |
|
|
Terraformer.preview(dst_gui, src) |
|
|
Terraformer.previewScaled(dst_gui, src) |
|
|
Terraformer.clearRegister(r) |
|
|
Terraformer.fBm(r, freq, 0.0-1.0{roughness}, detail, seed) |
|
|
Terraformer.smoothRidges(src,dst,0-1{factor},iterations) |
|
|
Terraformer.setTerrain(r) |
|
Trigger |
[TriggerObject].getNumObjects() |
|
|
[TriggerObject].getNumObjects(Object Index) |
|
TriggerData |
[TriggerData].enterTrigger(Trigger, ObjectId) |
|
|
[TriggerData].leaveTrigger(Trigger, ObjectId) |
|
|
[TriggerData].tickTrigger(Trigger) |
|
WaterBlock |
waterBlock.toggleWireFrame() |
|
WorldEditor |
worldEditor.redirectConsole(objID) |
|
|
|
|
|
Table A.3 |
Torque Script Keywords |
|
|
Keyword |
Description |
|
|
break |
Breaks execution out of a loop. |
|
|
case |
Indicates a choice in a switch block. |
|
|
continue |
Causes execution to continue at top of loop. |
|
|
datablock |
Indicates that the following code block defines a datablock. |
|
|
default |
Indicates the choice to make in a switch block when no cases match. |
|
|
do |
Indicates start of a do-while type loop block. |
|
|
else |
Indicates alternative execution path in an if statement. |
|
|
false |
Evaluates to 0, the opposite of true. |
|
|
for |
Indicates start of a for loop. |
|
|
function |
Indicates that the following code block is a callable function. |
|
|
if |
Indicates start of a conditional (comparison) statement. |
|
|
new |
Creates a new object datablock. |
|
|
|
continued |
|
|
|
|
|
Team LRN
736 |
Appendix A ■ |
The Torque Game Engine Reference |
|
|
|
|
package |
Indicates that the following code block encompasses a package. |
|
return |
Indicates return from a function. |
|
switch |
Indicates start of a switch selection block. |
|
true |
Evaluates to 1, the opposite of false. |
|
while |
Indicates the start of a while loop. |
|
|
|
Table A.4 Torque Script Operators
Symbol |
Meaning |
+ |
Add. |
- |
Subtract. |
* |
Multiply. |
/ |
Divide. |
% |
Modulus. |
++ |
Increment by 1. |
-- |
Decrement by 1. |
+= |
Addition totalizer. |
-= |
Subtraction totalizer. |
*= |
Multiplication totalizer. |
/= |
Division totalizer. |
%= |
Modulus totalizer. |
@ |
String append. |
( ) |
Parentheses—operator precedence promotion. |
[ ] |
Brackets—array index delimiters. |
{ } |
Braces—indicate start and end of code blocks. |
SPC |
Space append macro (same as @ " " @). |
TAB |
Tab append macro (same as @ "\t" @). |
NL |
New line append (same as @ "\n" @). |
~ |
(Bitwise NOT) Flips the bits of its operand. |
| |
(Bitwise OR) Returns a 1 in a bit if bits of either operand is 1. |
& |
(Bitwise AND) Returns a 1 in each bit position if bits of both operands are 1s. |
^ |
(Bitwise XOR) Returns a 1 in a bit position if bits of one but not both operands are 1. |
<< |
(Left-shift) Shifts its first operand in binary representation the number of bits to |
|
the left specified in the second operand, shifting in 0s from the right. |
>> |
(Sign-propagating right-shift) Shifts the first operand in binary representation the |
|
number of bits to the right specified in the second operand, discarding bits shifted off. |
|= |
Bitwise OR with result assigned to the first operand. |
&= |
Bitwise AND with result assigned to the first operand. |
^= |
Bitwise XOR with result assigned to the first operand. |
<<= |
Left-shift with result assigned to the first operand. |
|
continued |
Team LRN
|
Torque Reference Tables |
737 |
|
|
|
>>= |
Sign-propagating right-shift with result assigned to the first operand. |
|
! |
Evaluates the opposite of the value specified. |
|
&& |
Requires both values to be true for the result to be true. |
|
|| |
Requires only one value to be true for the result to be true. |
|
== |
Left-hand value and right-hand value are equal. |
|
!= |
Left-hand value and right-hand value are not equal. |
|
< |
Left-hand value is less than right-hand value. |
|
> |
Left-hand value is greater than right-hand value. |
|
<= |
Left-hand value is less than or equal to right-hand value. |
|
>= |
Left-hand value is greater than or equal to right-hand value. |
|
$= |
Left-hand string is equal to right-hand string. |
|
!$= |
Left-hand string is not equal to right-hand string. |
|
// |
Comment operator—ignore all text from here to the end of the line. |
|
; |
Statement terminator. |
|
. |
Object/datablock method or property delimiter. |
|
|
|
|
Table A.5 Torque Script Operator Precedence
High Priority |
|
|
|
|
|
Low Priority |
( ) |
* |
/ |
% |
+ |
- |
= |
Table A.6 Torque Script Tokens
Token |
Description |
string constant |
A sequence of alphanumeric characters bracketed by single or double quotes. |
variable |
Prefixed with % for local variable or $ for global variable, which is then always |
|
followed by a letter character. After the initial letter character, there can be a series of |
|
alphanumeric characters, underscores, or colons; a variable cannot end with a colon. |
identifier |
An initial letter character followed by an optional sequence of alphanumeric |
|
characters or underscores. |
number |
A decimal integer or floating point number. Hexadecimal numbers can be used if |
|
the token begins with 0x (zero-x). |
Team LRN
