Operators
The operators described below can be used to manipulate data.
Mathematical Operators
The following arithmetic operators are supported:
Operator | Example Use | Description |
---|---|---|
+ | p + q | Addition |
- | p - q | Subtraction |
- | -p | Returns the negative of a variable's value |
* | p * q | Multiplication |
/ | p / q | Division |
^ | p ^ q | Power |
Vector Operators
When using vectors the following operators apply:
Operator | Syntax | Example use | Description |
---|---|---|---|
x | V.x | fpItem.position.x | Returns the 1st component of a vector |
y | V.y | fpItem.position.y | Returns the 2nd component of a vector |
z | V.x | fpItem.position.z | Returns the 3rd component of a vector |
+ | V+W | fpItem.position + Object.position | Addition |
- | V-W | fpItem.position + Object.position | Subtraction |
* | V*W | fpItem.position * Object.position | Dot Product |
* | V*p | fpItem.position * 5 | Scalar Multiplication |
/ | V/p | fpItem.position / 2 | Scalar Division |
^ | V^W | fpItem.position^Object.position | Cross Product |
Comparative Operators
Forest effects includes an If function to allow you to create conditional rules.
This function uses the following syntax:
if(p,q,r)
Where p is a logic test which returns q if it returns true or r if it returns false.
To create the conditional tests for an IF function you use following operators:
Operator | Example Use | Description |
---|---|---|
== | p==q | Return true if p is equal to. |
< | p<q | Return true if p is less than. |
> | p>q | Return true if p is greater than. |
>= | p>=q | Return true if p is greater than or equal to q |
<= | p<=q | Return true if p is less than or equal to q |
| | p|q | Return true if p or q are true |
& | p&q | Returns true if p and q are true |