Roll20 uses cookies to improve your experience on our site. Cookies enable you to enjoy certain features, social sharing functionality, and tailor message and display ads to your interests on our site and others. They also help us understand how our site is being used. By continuing to use our site, you consent to our use of cookies. Update your cookie preferences .
×
Create a free account

[ScriptCards] [Help Requested] oWoD Storyteller d10 dice roller help requested.

... I am reposting this here from the ScriptCards discord asking for help... Hello folks, I am working on two projects and could use a bit of advice and guidance.  I am working to create a very specific layout and code for a World of Darkness (20th Anniversary/Revised).  Dice roller and output. I need the chat output to have sorted dice rolls from lowest to highest (left to right), have 1's and 10's on the dice and counted.  As well as a roll query for a difficulty threshold (defaults to 6).  I know an API dice roller exists, but when combined with roll queries the API badly and I would very much like the ability to have a chat output style of my own design.  I am hoping, I could get some advice, my current code is quite compact, so I am hoping that it will be clear enough to be reviewed.  !scriptcard {{     --/| === ScriptCard Layout for World of Darkness Rolls === |\--     --/| === System: World of Darkness / Storyteller       === |\--     --/| === Version 1.0                                   === |\--     --/| === Date: 05/11/2025                              === |\--     --/| Roll Queries / Lookup --|\     --=NumDice|?{How Many Dice?|1}     --=Diff|?{Difficulty?|6}            --/| ======== Sheet Workers Title/Subtitle Code ======== |\     --#nominmaxhighlight|1     --#title|Storyteller Roll         --#titlecardbackground|#993333     --#leftsub|Left     --#rightsub|Right              --+Rolling|[$NumDice.Total]d10        --=CountOnes|0     --=CountTens|0     --=TotalRoll|0     --&DieResults|     --%i|1;[$NumDice];1         --=ThisRoll|1d10         --=TotalRoll|[$TotalRoll] + [$ThisRoll]         --?[$ThisRoll] -eq 1|[             --=CountOnes|[$CountOnes] + 1             --&DieResults|+ [roll:f][$ThisRoll.Raw][/roll]         --]|[         --?[$ThisRoll] -eq 10|[             --=CountTens|[$CountTens] + 1             --&DieResults|+ [roll:c][$ThisRoll.Raw][/roll]         --]|[             --&DieResults|+ [roll][$ThisRoll.Raw][/roll]         --]|     --%|     --+[c] ● Results ●[/c]|     --+[&DieResults]|     --+Total|Total Dice [$TotalRoll] [b] Ones: [/b] [$CountOnes] [b] Tens: [/b] [$CountTens] [b] Total Success: [/b] [$CountSuccess] }} Thank you in advance for any help that it might be possible to give on this or related.  Feel free to reach out to me here on r20 or Discord.
Hey Toby,  I ran a CoD game not too long ago and used the below as a subroutine. It takes in the total number of dice rolled and can allow you to do things like 9-again rolls or do different difficulties. It will take away 1's from successes and reroll 10's as well to add to the success total. It even colors the dice based on what they roll; green for 10s, blue for successes and red for 1s. The rolls output as string variables &DiceRoll and &DiceReroll. --:GenerateRoll|Amount of Dice;Difficulty;Reroll Threshold;Character ID     --&ID|[%4%]     --=TotalDice|[%1%] + [[&ID]:wound_penalty]     --?[&StaminaRollForDamage] -eq Yes|=TotalDice;[$TotalDice] - [[&ID]:wound_penalty]     --=Difficulty|[%2%]     --=RerollNumber|[%3%]     --=NumberOfSuccesses|[$TotalDice]d10>[$Difficulty]     --~|array;define;DiceRoll;0     --=NumberOfRerolls|0     --=NumberOfBotches|0     --=RolledSuccesses|[$NumberOfSuccesses]     --%DiceRolled|1;[$TotalDice.Raw];1         --=DieResult|[$NumberOfSuccesses.RolledDice([&DiceRolled])]         --?[$DieResult.Raw] -eq 1|=NumberOfBotches;[$NumberOfBotches] + 1         --?[$DieResult.Raw] -ge [$RerollNumber.Raw]|=NumberOfRerolls;[$NumberOfRerolls] + 1         -->FormatDiceOutput|         --&DiceRoll([@DiceRoll(length)])|[&FormattedDie]     --%|     --~|array;removeat;DiceRoll;0     --~Rolls|array;stringify;DiceRoll;,     --=NumberOfRerolls|[$NumberOfRerolls] - [$NumberOfBotches]     --?[$NumberOfRerolls] -le 0|NoRerolls     --=RerollSuccesses|[$NumberOfRerolls]d10>[$Difficulty.Raw]     --~|array;define;DiceReroll;0     --%DiceRerolled|1;[$NumberOfRerolls.Raw];1         --=DieResult|[$RerollSuccesses.RolledDice([&DiceRerolled])]         -->FormatDiceOutput|         --&DiceReroll([@DiceReroll(length)])|[&FormattedDie]         --?[$DieResult.Raw] -ge [$RerollNumber]|>RerollAgain     --%|     --~|array;removeat;DiceReroll;0     --~Rerolls|array;stringify;DiceReroll;,     --:NoRerolls|     --=TotalSuccess|[$RolledSuccesses] + [$RerollSuccesses] - [$NumberOfBotches] --<|     --:RerollAgain|         --=Reroll|1d10         --=DieResult|[$Reroll.Raw]         --?[$Reroll.Raw] -gt [$Difficulty]|=RerollSuccesses;[$RerollSuccesses] + 1 -->FormatDiceOutput|         --&DiceReroll([@DiceReroll(length)])|[&FormattedDie]         --?[$Reroll.Raw] -ge [$RerollNumber]|RerollAgain         --<|     --:FormatDiceOutput|         --&FormattedDie|[#000000][$DieResult.Raw][/#]         --?[$DieResult] -eq 1|&FormattedDie;[#980000][$DieResult.Raw][/#]         --?[$DieResult] -gt [$Difficulty.Raw] -and [$DieResult] -lt [$RerollNumber.Raw]|&FormattedDie;[#0000ff][$DieResult.Raw][/#]         --?[$DieResult] -ge [$RerollNumber.Raw]|&FormattedDie;[#00ff00][$DieResult.Raw][/#]         --<|