Math
Use Cases
Currency systems
Resource management
Health and life counter systems
Damage systems
Upgrade systems
Leveling up and scaling
Set Broadcast Type to All or Rules to send messages from objects to the Rules System.
Reduce a numerical variable with a negative value.
Math

Perform basic math operations with time and number variables using one versatile rule.
A timer must be paused in order for the Math rule to work correctly with a time variable.

Required Message
Select the incoming message to trigger the rule.
Operand 1
Select one of the following:
Variable will allow you to select an existing numerical variable or create a new one.
Fixed value will allow you to enter a constant numerical value.
Message Argument will allow you to use an argument sent within the Required Message that triggered the rule. The message has to be created with an argument of the number type for it to be selectable here. A dropdown menu will appear to select the message argument.
Operator
Select the mathematical operator for the calculation (e.g., add, multiply, etc).
Operand 2
Select variable, fixed value, or message argument (see Operand 1).
Result
Select a number or decimal variable to staore the result of the calculation.
Message to Send
Select the message that will be sent after the calculation.
Add/Subtract Number Continuously
Add or subtract from a numerical variable repeatedly for a set time period. Optional: Set a maximum and minimum value for the variable used.
A timer must be paused in order for the Add/Subtract Number Continuously rule to work correctly with a time variable.

Add/Subtract number continuously
Required message
The message to activate this tree. Every time this message is broadcast the tree will be triggered.
Time variable
This defines the time variable, that is used to measure time in this tree.
Duration
There are three modes to define the time between each increase/decrease:
Variable will allow you to define an existing variable to modify the timer. This variable can be modified elsewhere using the Roll a Random Number, Add/Subtract number or Set number value Rules. A dropdown menu will appear to select a variable.
Fix value will allow you to set up a constant value. An input field will appear to enter the number value.
Message Argument will allow you to use an argument sent within the message. The message has to be created with an argument of the number type for it to be selectable here. A dropdown menu will appear to select the message argument.
Number variable
This defines the number variable that is modified by this rule. This could be a players score or stat like hunger.
Value change
There are three modes to define how much time will be added to the number:
Variable will allow you to define an existing variable to modify the number. This variable can be modified elsewhere using the Roll a Random Number, Add/Subtract number or Set number value Rules. A dropdown menu will appear to select a variable.
Fix value will allow you to set up a constant value. An input field will appear to enter the number value.
Message Argument will allow you to use an argument sent within the message. The message has to be created with an argument of the number type for it to be selectable here. A dropdown menu will appear to select the message argument.
Minimum Value
There are three modes to define the minimal value. The number variable won’t be lower than this value.
Variable will allow you to define an existing variable to modify the number. This variable can be modified elsewhere using the Roll a Random Number, Add/Subtract number or Set number value Rules. A dropdown menu will appear to select a variable.
Fix value will allow you to set up a constant value. An input field will appear to enter the number value.
Message Argument will allow you to use an argument sent within the message. The message has to be created with an argument of the number type for it to be selectable here. A dropdown menu will appear to select the message argument.
Maximum Value
There are three modes to define the maximal value. The number variable won’t be higher than this value.
Variable will allow you to define an existing variable to modify the number. This variable can be modified elsewhere using the Roll a Random Number, Add/Subtract number or Set number value Rules. A dropdown menu will appear to select a variable.
Fix value will allow you to set up a constant value. An input field will appear to enter the number value.
Message Argument will allow you to use an argument sent within the message. The message has to be created with an argument of the number type for it to be selectable here. A dropdown menu will appear to select the message argument.
Message to stop the rule
This message is stop the rule from running.
Last updated
Was this helpful?

