Torquescript programming language

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";

    className = "FishClass";

    position = "0 0";

    size = "5 5";

    SceneLayer = "2";

    SceneGroup = "14";

    CollisionCallback = true;

};
`}
..

Operators

OperatorNameExampleExplanation
*multiplication$a * $bMultiply $a and $b
/division$a / $bDivide $a by $b
%modulo$a % $bRemainder of $a divided by $b
+addition$a + $bAdd $a and $b
-subtraction$a - $bSubtract $b from $a
++auto-increment $a++Increment $a