Aller au contenu principal

Dice Notations

The bot uses the dice roller1 library for dice rolls and supports its syntax. However, there are some differences as Dicelette aims to be more flexible and display dice roll results in a more readable way.

Differences with Dice Roller

Extended Syntax for Comments

Dicelette extends the Dice Roller syntax by taking inspiration from Dice Parser:

  • The use of # comment in addition to the basic syntax for comments.
  • The ability to use [comment] to annotate a shared dice roll, providing context for each result line.

Comparators

By default, when a comparison sign (>, <, =, etc.) is present, the bot will consider the total and the compared value (while rolling and/or calculating if necessary) and indicate whether the roll is a failure or a success:

Success1d20[20] = [20] > 10

However, some systems require counting the number of rolls above (or below) a value rather than comparing the total result. To maintain compatibility between Dicelette and Dice Roller, the roll must be enclosed in curly braces {}, such as {3d12>20}.

{3d12>20} ⟶ {[11, 9, 7]} = [0]

In these specific cases, the bot will not display success, failure, or critical text, and does the same when using target failure.

remarque
  • {1d3}>20 will yield the same result as 1d3>20
  • But not {1d3,1d6}>20, which retains the default Dice Roller syntax. To compare the total to a value, use 1d3+1d6>20.
TL;DR
  • If you want to count the number of dice passing a comparison, you must enclose the die and comparator in curly braces {}.
  • If you want to use target failures, you must retain the Dice Roller syntax.

Critical Successes and Failures

You can define thresholds for critical successes and failures in dice rolls using the following syntax:

  • Critical Failure: {cf:[sign](value)}
  • Critical Success: {cs:[sign](value)}

This expression can be placed anywhere in the dice roll, except after a comment, and must be attached directly to the die (no space between the die and the expression).

Where:

  • sign is the comparison operator (>, <, =, etc.).
  • value can be a number, a die, a math expression, or a statistic (just like custom criticals).
  • * (optional) allows comparison only on the natural die (the first dice roll), not the total.
Critical Failure1d20>=20{cf:>10}[20] = 20 > 10
Critical Success{cs:<2}1d20<=1[1] = 1 < 2
astuce

The full formula syntax is: {c[f|s]:[>=<!]+(text)}

This method is not compatible with the exceptions mentioned in the previous section.

Mathematical Expressions with MathJS

The bot uses the mathjs library to evaluate mathematical expressions. You can use complex mathematical expressions when they are enclosed in {{ and }}.

Depending on the commands, you can use:

  • $: Represents the value of the used statistic.
  • The name of a statistic (which will be replaced by its value).
  • Dice combinations (like 1d6).
  • {exp}: This syntax allows you to directly insert an expression into the die, reusing the calculated part of the command. A default value can be specified using the syntax {exp||default} (e.g., {exp||2}). Otherwise, the default value will be 1.

Expressions are generally used in:

  • success_threshold: Success threshold for dice rolls in the /dbroll command.
  • expression: For the /calc, /dbroll, and /dbd commands.
  • opposition: For the /dbroll and /dbd commands.

Examples of Mathematical Expressions

  • 1d6 + {{ceil($ / 2)}}
  • 1d6 > {{ceil($ / 2)}}

Shared Unique Rolls (Reusing Results)

You can use the syntax die;&+x;µ*y to roll a single die and apply different formulas to the same die, displaying the result of each formula. The & represents the die result.

Attention

You must not have spaces before or after the separator between formulas, otherwise the bot will treat the rest as comments.

Example

/roll 1d20;&+5;&*2 Will display the result as:

  ※ `1d20` ⟶ `[10]` = ` 10 `  
◈ `[1d20]+5` ⟶ `[10]+5` = ` 15 `
◈ `[1d20]×2` ⟶ `[10]×2` = ` 20 `

:::

astuce

You can use dice in the formulas, but only the first die will be saved and reused.

1d20;&+1d4;&*2
  ※ `1d20` ⟶ `[7]` = ` 7 `  
◈ `[1d20]+1d4` ⟶ `7+[1]` = ` 8 `
◈ `[1d20]×2` ⟶ `[7]×2` = ` 14 `

To comment between each roll, use the [comment] syntax. A global comment should use the # comment syntax at the end of the dice.

1d20;&-2[hp loss]

1d20[2] = 2
hp loss[1d20]-2[2]-2 = 0

Finally, it is possible to hide the first die using the syntax (die):

(1d20);&>100;&+2

Failure[1d20]>100[12]>100 = 12<100
[1d20]+2[12]+2 = 14

It is not possible to use bulk dice in this syntax.

Bulk Rolls

The bot also supports the x#(dice) notation, inspired by rollem for "bulk rolls".

4#2d10

2d10[2, 7] = [9]
2d10[2, 8] = [10]
2d10[4, 3] = [7]
2d10[8, 9] = [17]

Footnotes

  1. Dice Roller itself uses random-js for random generation, not math.random which is pseudo-random. So it's not possible to cheat on dice results (unless you're a cryptomancer or can see the future... Or both.).