Roll AppDownload from RuStore
RU

Roll App guide

Formulas without guesswork

Automate calculations with the built-in mathematical engine. Formulas apply rules, conditions and relationships between parameters to simplify scores, resources and other values in games with complex scoring systems.

01 · Quick start

Your first formula in three steps

1

Open a template

Create or open a template, add a numeric parameter and locate its starting-value formula field.

2

Reference game data

Type @ to see available parameters and system values, then select a suggestion or continue writing an expression.

3

Save and test

Start a test game. A dependent parameter is recalculated when referenced values change.

02 · References

References and system values

@Parameter name

current value of a regular or global parameter

@"Main score"

safe reference for names containing spaces or punctuation

@Role.value1

first option of a list parameter; value2 is the second

@dice

dice result when dice are enabled in the template

@num_players

total players in the game, including eliminated players

@active_players

players currently participating in the game

@inactive_players

eliminated players in the game

@random_pick_count

times the current player was selected randomly; in a global formula, the total across all players

@prev_value

previous calculated value of the current parameter; alias of @system.prev_value

03 · Operators

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

04 · Functions

All functions

Functions shown: 16

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

05 · Examples

Template examples

Final score

Recalculates the total when any referenced parameter changes.

@Score + @Bonus - @Penalty

Constrained value

Keeps the result between 0 and 100.

clamp(@Health, 0, 100)

Conditional bonus

Returns 3 for ten points or more, otherwise 1.

@Score >= 10 ? 3 : 1

Result table

Tests ranges from left to right: +0 means at most zero, 1-3 includes both ends, and 6+ means at least six.

switch(@Roll, +0:-1, 1-3:1, 4-5:2, 6+:3)

Previous value

Uses the previous calculated value of the current parameter. For automatic recalculation, also reference a parameter that changes.

@system.prev_value + @Round

Local variable

The variable exists only inside this formula.

var base = @Score + @Bonus; round(base / 2)

Template-wide variable

Creates a value other formulas in the same template can use.

global round_bonus = 5; @Score + round_bonus

06 · Triggers

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 number in the threshold field is a threshold, not a Boolean condition. Crossing a threshold below the starting value fires on a decrease; otherwise it fires on an increase.
  • Text, Boolean and list values fire when the parameter first becomes exactly equal to the configured value.

07 · Details

What to know

  • True and False (also Истина and Ложь) behave as 1 and 0 in numeric arithmetic.
  • A decimal comma is accepted in ordinary expressions, such as 1,5 + 1. Inside function calls, a comma separates arguments; use a dot for decimals: round(2.345, 2).
  • Global variable names use Latin letters, digits and underscores and cannot start with a digit.
  • Loops, arbitrary JavaScript, device access and unknown functions are prohibited; expression complexity is limited.
  • Use approx(left, right, tolerance) when floating-point comparison needs tolerance. Exact equality such as 0.1 + 0.2 == 0.3 may be false because of floating-point representation.