Aller au contenu principal

Mathematical Expressions

Mathematical Expressions with MathJS

The bot uses the mathjs library to evaluate mathematical expressions. You can use complex mathematical expressions when enclosed within {{ and }}. Depending on the commands, you can use:

  • $: Represents the value of the statistic used.
  • The name of a statistic (which will be replaced by its value).
  • Dice combinations (like 1d6).

Expressions are typically used in:

  • seuil_reussite: Success threshold for dice rolls in the /dbroll command.
  • expression: For the /calc, /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 & symbol represents the die's result.

Note

You must avoid spaces before and after the separator between formulas, or the bot will interpret the remainder as comments.

Example
/roll 1d20;&+5;&*2

Displays 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.

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

To add comments between rolls, use the syntax [comment]. For a global comment, use the # comment syntax at the end of the dice roll.

Example

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

Finally, you can hide the first die using the syntax (die):

Example

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

Mass dice rolls cannot be used with this syntax.

Bulk Rolls

The bot also supports the x#(dice) notation for "bulk rolls," allowing you to save time during your gaming sessions.