Skip to main content
Version: 1.1

Genesys Dice Picker

This module has all the same features as Dice Picker. There are only a few UI differences to accommodate this unique dice set. Just tap away at the dice you want to roll.

note

This module is for use with the Genesys dice theme. The main intention of this module is to function as an example of how to create your own UI interface for the Dice Box.

Genesys Dice Picker Screenshot

Install

Add the dice-ui module using

npm install @3d-dice/dice-ui

Setup

Then create a new instance of the picker

import { GenesysDicePicker } from '@3d-dice/dice-ui'

const dicePicker = new GenesysDicePicker()

Config Options

The GenesysDicePicker only has one argument which is a config object

OptiontypedefaultDescription
targetstring :dom node selectordocument.bodyThe target DOM node to inject the roller into
onSubmitfunctionnoopcallback triggered on form submit, after notation has been parsed
onClearfunctionnoopcallback triggered when form reset event is triggered
onRerollfunctionnoopcallback triggered when FDP returns reroll results
onResultsfunctionnoopcallback triggered when there are no reRoll results and the final result object has been parsed by FDP

Methods

MethodArgumentsDescription
submitFormevent :event - form submitTake the submit event and passes the input notation to FDP. Calls onSubmit callback with results.
clearnoneClears the current notation and any values stored in FDP. Calls the onClear callback
setNotationnotation :objectSet the default values for tossing, sort of like placeholder values
handleResultsresults :objectPasses roll results object to FDP to check for rerolls. Gets the final parsed results from FDP. Calls onResults callback

setNotation example:

dicePicker.setNotation({
ability: {
count: 0
},
boost: {
count: 0
},
challenge: {
count: 0
},
difficulty: {
count: 0
},
proficiency: {
count: 0
},
setback: {
count: 0
}
})

Screenshot with notation set:

Set Notation