Skip to main content

Math

Control Flow​

If Math Expression​

Conditionally execute part of the script if the specified math expression evaluates to true.

If Math Expression
Condition
6 * $health
True
Add Event
Else
  • Condition: The condition to evaluate.
  • True: The script to run if the condition is true.
  • False: The script to run if the condition is false.

Loop While Math Expression​

Run part of the script in a loop while an expression is true.

Loop While Math Expression
Condition
6 * $health
Add Event
  • Condition: The condition to evaluate.

Random​

Seed Random Number Generator​

Place this to run in response to user input to ensure random numbers change between playthroughs.

Seed Random Number Generator
Place this to run in response to user input to ensure random numbers change between playthroughs

Variables​

Evaluate Math Expression​

Set a variable to the result of evaluating a math expression.

References
/docs/scripting/math-expressions

Evaluate Math Expression
Variable
$Variable0
Expression
e.g. 5 + (6 * $health)...
  • Variable: The variable to use.
  • Expression: The expression to evaluate.

Math Functions​

Allows you to perform various maths functions on a variable to add/subtract/multiply/divide/modulus a value/variable/random number.

Math Functions
Variable
$Variable0
Operation
Set To
Value
True
  • Variable: The variable to use.
  • Operation: The operation to use for modifying the variable value.
  • Value: The value to combine with the variable using the selected operation.