Game Development Community

TorqueScript documentation/Tutorial?

by Vern Jensen · in Torque Game Builder · 06/16/2006 (2:30 pm) · 4 replies

OKay, so I recently bought Torque Game Engine. Pretty cool. I've gone through 1 and 1/2 tutorials so far, and also skimmed most of the manual on TGE. However, I don't see anything that documents the syntax of TorqueScript. I'm a longtime C and Java programmer, so I'm not new to programming, but I'd like to know what the rules are for TorqueScript itself. Is there a reference for this?

For instance:

- Can I create variables local to a function?
- How about global variables?
- Arrays? 2D/3D arrays?
- Can functions return values?
- What's the difference between $foo and %foo?
- All the example code seems to use braces for everything, even for single statements, such as

if (something)
{
statement;
}

Are the braces required by TorqueScript, even if only one statement is used?

I know I could experiment to answer some of my questions, but I'd much rather read a "TorqueScript Reference". Does such a thing exist?

-Vern

#1
06/16/2006 (3:17 pm)
As it happens, A lot of these questions were answered just the other day: www.garagegames.com/mg/forums/result.thread.php?qt=45887
#2
06/16/2006 (5:59 pm)
Thanks. I also found this:

http://tdn.garagegames.com/wiki/TorqueScript_Quick_Reference

One more questions unanswered by that reference and the other forums though:

How do I create local variables? In C, you'd just do:

int myValue;
float whatever;

In TorqueScript, it seems like you just start using it, but then how does the script compiler know what type of variable it is?

-Vern
#3
06/16/2006 (6:30 pm)
I also just found this:

www.garagegames.com/docs/tge/general/ch05.html

-Vern
#4
06/16/2006 (6:59 pm)
Torque Script is typeless, so you can do

$var = 0;

or

$var = "blah";