Numeric expressions and literals

The numerical rules for maxScript is similar to C/C++.

numbers entered without a decimal are integer and follows integer mathematical rules.

7/2 is 3 (not 3.5)

8/3 is 2 (not 2.667, note the truncation, not rounded up)

if an expression contains both integers and floating point, result is a floating point value

8.0/3 is 2.667

expressions are evaluated according to order of expression rules and propagated in the same manner. In otherwords, follow order of operator rules, results are evaluated one operator at a time.

2.0 + 8/3 is 4.0 (8/3 is 2, add 2.0 to it gives 4.0)

operators:

operator what it does example (int only) example (float/int) args
+ addition 3+2 is 5 3.2+2.0 is 5.2
- subtraction 5-3 is 2 5.0 - 2 is 3.0
* multiplication 6 *2 is 12 2.0 * 2.0 is 4.0
/ division 8/3 is 2 8.0/2 is 2.667
^ exponent, base ^ power 2^3 is 8 4 ^ 0.5 is 2 (remember power of 0.5 is same as squareroot). 3 ^ 1.5 is 5, 3.0 ^ 1.5 is 5.19615

string literals:

string literals are enclosed in double quotes

"this is a string literal"

strings can be concatenated with + operator

"this is " + "added together with + operator"

results in

"this is added together with + operator"

boolean literals:

true
false
on  -- true
off  -- false

vector literals

as max deals in 3D, you will see a lot of vectors used in the code. a vector is declared as 3 comma separated values within []. For example, suppose you wanted to place an object at position x=0, y=0, z = 10, you would set the pos parameter to [0,0,10]

[1,2,3]