Programming Help by Programmer's hub

Torquescript programming language

Torquescript is a scripting language developed specifically for the torque technology. Scripts written in the Torquescripting language are stored in .cs files, which are compiled and executed by a binary compiled via the C++ engine. Torquescript is a high level programming language and easy to learn then the C and C++. The extension of the torquescript is .cs shows that it is similar to C script and programming style resembles to C programming. Like most other scripting languages, such as Python or Java Script, TorqueScript is a high-level programming language interpreted by Torque 2D at run time. Unlike C++, you can write your code in script and run it without recompiling your game.

Torquescript programming code example

%fish = new Sprite()
    Animation = "AquariumToy:Angelfish";
    class = "FishClass";
    position = "0 0";
    size = "5 5";
    SceneLayer = "2";
    SceneGroup = "14";
    CollisionCallback = true;


Operator Name Example Explanation
* multiplication $a * $b Multiply $a and $b
/ division $a / $b Divide $a by $b
% modulo $a % $b Remainder of $a divided by $b
+ addition $a + $b Add $a and $b
- subtraction $a - $b Subtract $b from $a
++ auto-increment  $a++ Increment $a