Closed tyhayescreative closed 1 year ago
I think we need something along these lines. But even the stargate system doesn't seem to implement a TD that is rollable from the chat log at least, so I don't have a pattern for how to do this.
game.settings.register("StargateTyHayesCreative", "td", { name: "Tension Die", hint: "The tension die", scope: "world", // This specifies a client-stored setting config: true, // This specifies that the setting appears in the configuration view type: object, choices: { // If choices are defined, the resulting setting will be a select menu "d4": new Die({faces: 4, number: 1}).evaluate(); "d6": "new Die({faces: 6, number: 1}).evaluate(); "d8": new Die({faces: 8, number: 1}).evaluate(); "d10": new Die({faces: 10, number: 1}).evaluate(); "d12": new Die({faces: 12, number: 1}).evaluate(); }, default: "d6", // The default value for the setting onChange: value => { // A callback function which triggers when the setting is changed console.log(value) } });
It's definitely got something to do with https://foundryvtt.com/api/DiceTerm.html too
Also consider looking in systems (but stargate doesn't make /roll 1td work, at least from the chat log) or digging into the foundry source itself
maybe a hook that intercepts rolls and parses the roll formula replacing "td" with the actual die.
The actual die should be set in a module setting: https://foundryvtt.wiki/en/development/guides/handling-data
implemented in v0.1a
This needs to be at the world level.