calculation engine
Formulas automate scoring rules.
Calculate values from conditions and relationships between parameters, from simple lap counters to complex scoring systems.
Quick start
Open a template
Create or open a template, add a numeric parameter and locate its starting-value formula field.
Reference game data
Type @ to see available parameters and system values, then select a suggestion or continue writing an expression.
Save and test
Start a test game. A dependent parameter is recalculated when referenced values change.
Supported operators
Arithmetic
+ −- addition, subtraction and numeric signs
* / %- multiplication, division and remainder
^- numeric power; XOR for Boolean values
( )- explicit evaluation order
Comparison
= ==- equal
!= <>- not equal
> <- greater and less
>= =>- greater than or equal
<= =<- less than or equal
Logic and conditions
!- logical NOT
& &&- logical AND
| ||- logical OR
^- logical XOR
condition ? yes : no- choose one of two results
Variables and keywords
var name = expression- local variable for the current formula
global name = expression- variable available to other formulas in the template
global var name = expression- equivalent extended global declaration
True / False- Boolean values
;- separates declarations and the final expression
Game data references
@Parameter namecurrent value of a regular or global parameter
@"Main score"safe reference for names containing spaces or punctuation
@Role.value1first option of a list parameter; value2 is the second
@dicedice result when dice are enabled in the template
@player_countnumber of players
@prev_valueprevious calculated value of the current parameter; alias of @system.prev_value
All functions
abs(value)absolute value
min(value, …)smallest value
max(value, …)largest value
sum(value, …)sum of values
avg(value, …)arithmetic mean; average is an alias
round(value, digits?)round to −12…12 decimal places
floor(value)round down
ceil(value)round up
trunc(value)remove the fractional part
sign(value)returns −1, 0 or 1
sqrt(value)square root of a non-negative number
pow(value, exponent)raise to a power
clamp(value, min, max)constrain a number to a range
approx(left, right, tolerance?)compare floating-point values with tolerance
if(condition, true, false)select a result by condition
switch(value, case, result, …, fallback)select a result from several cases
Using formulas in triggers
- A Boolean condition uses True or False directly and fires when it changes from false to true.
- For a numeric condition, a positive value is true; zero and negative values are false.
- A numeric threshold fires when the parameter crosses it in the configured direction.
- Text, Boolean and list values fire when the parameter first becomes exactly equal to the configured value.