You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Jason Godesky edited this page Jul 19, 2026
·
1 revision
check is a wrapper that rolls dice, passes the total to a callback function, and returns a boolean based on the result of that callback function.
Parameters
expr: string
A dice expression to roll (e.g., 2d6 or 1d20).
Note that this wrapper used the evaluateSync method, which can throw an error for certain complex expressions that require asynchronous behavior. In those cases, your needs are complex enough to warrant instantiating a Roll instance and handling it directly.
callback: (total: number) => boolean
A callback function to which the total is passed.
Returns
true if the total rolled passes the callback, or false if it did not.
Examples
import{roll}from'@revolutionarygamesco/common-foundryvtt'check('1d6',total=>total>4)// false if it rolls a 1, 2, 3, 4; true if it rolls a 5 or 6