Dice Roller
Instructions
This skill produces an interactive dice roller embedded in the chat. Once rendered, the user can press "Re-roll" inside the frame to get new values without sending another message.
When the user asks to roll dice:
Extract the dice notation from the user's query in the standard
NdS[+/-M][khK|klK]shorthand:"1d6"— one six-sided die (default if only "roll a die")"2d6"— two six-sided dice"3d20"— three twenty-sided dice"1d100"— percentile"2d6+3"— two d6 plus a flat modifier"2d20kh1"— advantage (two d20, keep highest)"4d6kh3"— D&D stat roll (four d6, drop lowest)
Call
run_skill_scriptwith:skill_name:dice-rollerscript:render_dice.pyparameters:{"notation": "<extracted notation>"}
Present the returned frame with a concise one-sentence caption.
Supported die sizes: 4, 6, 8, 10, 12, 20, 100.
Fallback parsing
If the notation you pass contains extra words (for example the full user sentence "lance 2d6 pour moi"), the script is tolerant and extracts the first valid dice notation it finds in the string — but for best results always pass the clean notation alone.
Output Contract
Returns text + frame.html:
text: one-line caption with the total result of the initial roll.frame.html: the animated dice frame with a Re-roll button — subsequent re-rolls are handled client-side (no backend round-trip).
Ressources disponibles
- scripts/render_dice.py — Parses the notation, seeds the initial roll and emits the interactive frame (crypto.getRandomValues for re-rolls).