Skip to Content
ReferenceFormula syntax

Formula syntax

Action formulas for Roll, Damage, and Heal use the same small language. This page is the complete reference. For how to write them in the app, see Actions.

Building blocks

SyntaxMeaningExample
Whole numbersA fixed value3
NdSRoll N dice with S sides and add them up2d6
dSSame as 1dSd20
@NameA Stat’s value for the acting character@Strength
[@Name With Spaces]A Stat whose name has spaces[@Spell Power]
+ - * /Add, subtract, multiply, divide1d8 + @Strength
( )Group(1 + @Level) * 2
value if @ConditionOnly counts when a true/false Stat is true1d6 if @Blessed

In the editor, typing @ suggests Stats as you type.

Order of operations

From loosest to tightest:

  1. if
  2. + and -
  3. * and /
  4. dice (d)
  5. a leading + or - sign

So 1d20 + @Strength * 2 doubles Strength and then adds the d20. Use parentheses to be explicit, especially with if: (1d6 if @Blessed) + 2 always adds 2, while 1d6 + 2 if @Blessed adds nothing at all when Blessed is false.

Dice

  • The number of dice can be calculated. (1 + 2)d6 rolls three d6. (@Strength / 2)d6 rolls half of Strength, rounded, in d6s.
  • @Strength d6 and @Strength * d6 are different. The first rolls Strength many d6. The second rolls one d6 and multiplies it by Strength.
  • Counts round to the nearest whole number, with halves rounding away from zero. Zero or negative counts roll nothing: -2d6 contributes 0.
  • Sides must be a fixed whole number, at least 2. 1d@Size isn’t allowed. Sides above 9,999 are treated as 9,999.
  • Dice can’t be used to count dice: (1d4)d6 isn’t allowed.
  • Each formula can roll at most 100 dice, used up from left to right. 80d6 + 40d8 rolls 80d6 and 20d8. The log shows 100 dice max when this happens.

True/false Stats

Stats that are true or false can only be used as conditions with if.

  • 1d6 if @Blessed rolls 1d6 when Blessed is true and contributes 0 (without rolling) when it’s false.
  • There is no else.
  • Numbers and true/false never convert into each other. @Blessed + 1 and 2 if @Strength are errors.
  • A formula’s final result must be a number.

Math and rounding

  • Math is exact until the end, including fractions from division.
  • The final total rounds to the nearest whole number, with halves away from zero: 5 / 2 gives 3 and -5 / 2 gives −3.
  • The final total is capped between −9,999 and 9,999.
  • Dividing by zero contributes 0 for that division: 10 / 0 + 2 gives 2.

Critical rolls

The base group is the first group of dice that actually rolls. A roll is critical when every die in the base group shows its highest face: a 20 on 1d20 + 5, or two 6s on 2d6 + 1d4. Bonuses, later dice, rounding, and caps don’t matter.

Damage and healing

Damage and healing formulas follow the same rules. Negative results stay visible in the log, but when the Owner applies them they change health by 0. Damage never takes health below 0.

Limits and errors

A formula can be up to 2,000 characters. The editor tells you what’s wrong:

MessageCause
Unknown Stat “x”.No Stat has that name
Stat name “x” is ambiguous.More than one Stat could match; use [@Full Name]
Missing closing stat bracket.[@Name without ]
Formula is incomplete.Something is missing, such as 1d20 +
Unexpected “x”.A character that doesn’t belong
Die sides must be a fixed whole number of at least 2.1d1 or 1d@Size
A condition must be true or false; numeric Stats are not conditions.1d6 if @Strength
Arithmetic and dice counts require numbers, not booleans.@Blessed + 1
An Action formula must produce a number, not a boolean.A formula that’s just @Blessed
Formula is too long (maximum 2000 characters). / Formula is too complex.Simplify it

Formulas refer to Stats by an internal ID, so renaming a Stat never breaks an action. The formula updates to show the new name.

Last updated on