Skip to content

Parse for dice and dice callback features #137

Answered by valentine195
Zkaij asked this question in Q&A
Discussion options

You must be logged in to vote

Yes, the automatic dice parsing looks for specific text patterns to replace with dice.

The dice callback expects you to return an array of strings or objects, that it will then combine into a combination of text and dice rollers.

The object is:

interface DiceCallbackObject {
    text: string //string to be parsed into a dice roll
    original?: string //optional. will be placed after the dice roll in parenthesis
}

For example:

return ["The monster has: ", { text: "1d20 + 2" }];

will result in "The monster has <dice roll 1d20 + 2>"

also, yeah, there’s no documentation around this, sorry!

Replies: 2 comments 4 replies

Comment options

You must be logged in to vote
1 reply
@Zkaij
Comment options

Comment options

You must be logged in to vote
3 replies
@Zkaij
Comment options

@valentine195
Comment options

@valentine195
Comment options

Answer selected by Zkaij
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants