Skip to content

Latest commit

 

History

History
71 lines (39 loc) · 3.69 KB

variable_assignment.md

File metadata and controls

71 lines (39 loc) · 3.69 KB

Lionhead Challenge Language Documentation

Back to index.

5 Variable Assigment

Variables are where you store values or game objects. Assignments are followed by expressions.

5.1 Variables

A variable is the token you use to refer to something in the script, which you can then use in statements to perform tasks etc on the said reference stored in the token..

  1. identifier
  2. constant of object

5.2 Assigns

Operators that assign values to variables.

  1. = expression
  2. += expression
  3. -= expression
  4. *= expression
  5. /= expression
  6. %= expression
  7. ++
  8. --

5.1.1 identifier

The user defined token the script programmer uses as a reference to script references.

5.1.2 constant of object

At the time of this document a game object can have a property enquired or set, depending on what makes sense. The implemented choices are found in scriptenums.h NB. If you are setting the SPEED of an object you should do it before you set it moving.

SCRIPT_OBJECT_PROPERTY_TYPE_AGE of LostBrother = 21

5.2.1 = expression

Assigns the expression on the right of the operator to the variable on the left.

5.2.2 += expression

Adds the expression on the right of the operator to the variable on the left and assigns this value to the variable on the left. A += B is the same as writing A = (A + B)

5.2.3 -= expression

Subtracts the expression on the right of the operator from the variable of the left and assigns this value to the variable on the left. A -= B is the same as writing A = (A - B)

5.2.4 *= expression

Multiples the variable on the left of the operator by the expression on the right then assigns the value to the variable on the left. A = B is the same as writing A = (AB)

5.2.5 /= expression

Divides the variable on the left of the operator by the expression on the right then assigns the value to the variable on the left. A /= B is the same as writing A = (A/B)

5.2.6 %= expression

Divides the variable on the left of the operator by the expression on the right and assigns the remainder to the variable on the left. A %= B is the same as writing A = (A%B)

5.2.7 ++

Increases the value to the left of the operator by one. A++ is the same as writing A = (A + 1)

5.2.8 --

Decreases the value to the left of the operator by one. A-- is the same as writing A = (A - 1)