rollSilent()
Roll dice and get the total back, with nothing written to chat.
Part of the Action API · Function reference
Signature
rollSilent(expression: string): number
Synchronous. Returns a number, not a promise — though await rollSilent(...)
is harmless if you prefer to write it that way.
Parameters
| Parameter | Type | Description |
|---|---|---|
expression |
string |
A dice expression, with the same grammar and property substitution as roll(). |
Returns
The total, with every modifier applied. 0 if the expression could not be
parsed.
Why it exists
roll() writes a dice row to chat, which is what you want when the
roll IS the message. A spell action usually wants the opposite: roll the damage,
apply it, and say one sentence about the whole thing rather than leave four raw
dice rows above it.
roll(expression, false) has always done this. rollSilent() is the same
behaviour with a name, because a positional boolean is not something you can
find by reading the code that uses it.
Choosing between the three
| Want | Use |
|---|---|
| A total, and the standard dice row in chat | roll() |
| A total, and nothing in chat | rollSilent() |
| The individual dice, and nothing in chat | rollDetailed() |
rollSilent(expr) is exactly rollDetailed(expr).total, so reach for
rollDetailed() when you need the faces and this when you need the number.
Examples
One sentence instead of four dice rows
const damage = rollSilent('2d6+3');
target.applyDamage(damage, 'fire');
return `${token.name} casts Scorching Ray at ${target.name} for ${damage} fire damage.`;
A roll the players should not see the working of
const stealth = rollSilent('1d20+dex');
if (stealth < 15) sendMessage(`Something has noticed ${token.name}.`);
Deciding before anything is announced
const attack = rollSilent('1d20+prof+str');
sendMessage(attack >= 15 ? 'A clean hit.' : 'Wide of the mark.');
Notes
- Property substitution still applies.
rollSilent('1d20+str')resolvesstragainst the acting token exactly asroll()does. - No 3D dice. Nothing is rolled on the table, because nothing is announced.
- A diceless expression is fine.
rollSilent('str')returns the modifier.