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
| Syntax | Meaning | Example |
|---|---|---|
| Whole numbers | A fixed value | 3 |
NdS | Roll N dice with S sides and add them up | 2d6 |
dS | Same as 1dS | d20 |
@Name | A Stat’s value for the acting character | @Strength |
[@Name With Spaces] | A Stat whose name has spaces | [@Spell Power] |
+ - * / | Add, subtract, multiply, divide | 1d8 + @Strength |
( ) | Group | (1 + @Level) * 2 |
value if @Condition | Only counts when a true/false Stat is true | 1d6 if @Blessed |
In the editor, typing @ suggests Stats as you type.
Order of operations
From loosest to tightest:
if+and-*and/- dice (
d) - 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)d6rolls three d6.(@Strength / 2)d6rolls half of Strength, rounded, in d6s. @Strength d6and@Strength * d6are 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:
-2d6contributes 0. - Sides must be a fixed whole number, at least 2.
1d@Sizeisn’t allowed. Sides above 9,999 are treated as 9,999. - Dice can’t be used to count dice:
(1d4)d6isn’t allowed. - Each formula can roll at most 100 dice, used up from left to right.
80d6 + 40d8rolls 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 @Blessedrolls 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 + 1and2 if @Strengthare 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 / 2gives 3 and-5 / 2gives −3. - The final total is capped between −9,999 and 9,999.
- Dividing by zero contributes 0 for that division:
10 / 0 + 2gives 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:
| Message | Cause |
|---|---|
| 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.