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

Dices values AND matching dices

1623850110
Divers
Pro
Sheet Author
I want to list dices values, AND to highlight matching dices. For the dices values, I got many interesting answers : <a href="https://app.roll20.net/forum/post/10063101/list-dices-values" rel="nofollow">https://app.roll20.net/forum/post/10063101/list-dices-values</a> But : I don't want API since it is a published cs, intended to be used by free accounts. Or is it allowed to embed an API in a published cs ? the solution I implemented yet rolls n dices separately [[1d10]] [[1d10]]... and shows it separately $[[0]] $[[1]]... =&gt; it can not highlight matches What I managed to achieve : Send "{{myRoll=[[@{dicenumber}d10m]]}}" to my template, but the player have to get his mouse over the result to view the dices writing "/r 4d10m" in the chat, which gives me the dices values in the chat. But it is not launched from a roll button, and it doesn't use the roll template It is a published Character Sheet for the game Ynn Pryddein (french). My request is usefull as in the game, the player rolls 1 to 5 d10, then he chooses the dices he wants (using some rules and cases I don't want to implement), then removes matching dices. Any advice ?
1623851242
Kraynic
Pro
Sheet Author
You might want to check out how the roll template for Zweihander works.&nbsp; I know that is a d100 system that treats matches as criticals (success if below a target number or failure if above), so there might be something you could steal from that sheet's code.&nbsp; I have only played that game once, so I'm not real familiar with the sheet/system but hopefully it has something you can use.
1623858698
GiGs
Pro
Sheet Author
API Scripter
To build a roll template to show possible matches for up to 5 d10 is probably possible - but would likely be massive (potentially having 100,000 lines of code). If you describe exactly how the dice system works, in full , leaving out no details, we might be able to come up with a method that works. Otherwise we are left flailing in the dark trying to guess which parts of our roll20 system knowledge can make this job easier. (Fair warning: when I've asked people to do this, and they give vague answers that are obviously missing details, I stop contributing to the thread. I can't help without the details I ask for. Someone else might be willing to.) To answer this question: I don't want API since it is a published cs, intended to be used by free accounts. Or is it allowed to embed an API in a published cs ? You can embed an API in a custom sheet, but it must be as an option. The sheet must be fully usable by people who don't have access to the API. And really, that's the way you want it - the vast majority of the userbase don't have the API, and you want your sheet to be used by as many people as possible.
1623929930
Divers
Pro
Sheet Author
Thank you to both of you. To Kraynic : I'll give it a look. Isn't it the case as well for Eclipse Phase ? I think some games use matching d10 on a roll 100 as criticals. I thought it was a roll20 dice roller feature. I will investigate this direction. To GIGs : wow, that would be a lot of lines ^^ I guess this would check each case or something ? Indeed there&nbsp; are 111110 possible combinations (1 to 5 dices, by 10 faces). Well, ok, I understand. Let me explain the roll : roll 1 to 5 d10 choose 3 dices (or keep them if you roll 1 to 3 dices). (the "best" combination if there is an advantage, the worst if there is a diadvantage. "Best" means "the one I choose to get the lowest final value at the step 5) add or substract some points if you spend "chance/destiny" resource points keep only 1 dice if there are matching dices add the dices values. The goal is to get the lower value. To get a succes you may go under a threshold determined by a calculation of values on your character sheet. As it depends largely on the context, I'll give it out of the description ;-) An example : I roll 2, 4, 6, 7 with an advantage I choose 2, 6 ,7 I spend "chance" to turn 7 into 6 I get 2, 6, 6 : with the matching sixes I discard one of them, to get 2, 6 my result is 8. I compare this 8 to some calculations obtained from my character sheet (caracteristic, magic, name,&nbsp; carrer...) depending on the context I am sure I don't want to implement that ;-) From now on, I show the dice values to the GM and the player. And they have to choose. To help a little, I intend to show matching dices. Thanks for the explanation for the API embeded in a sheet. I don't want that :-)
1623930253
Divers
Pro
Sheet Author
For what I understand, the rule is far too complex to be implemented. I want to help the player in the process. Ordering the roll by values of the dices would be nice. Maybe better than hightlight the matching dices. Can we get ordered a roll like this one ? 3d10s wouldn't work as there are 3 independent rolls. &amp;{template:default} {{name=Raw Roll}} [[ [[1d10]] [[1d10]] [[1d10]] ]] {{Rolling 3d6=$[[0]], $[[1]], $[[2]]}}
1623930863
Divers
Pro
Sheet Author
An additionnal point: I tested the macro /r 3d10sm (3 to be replaced by the "input number dice_number") I think it is more usefull to the player than &amp;{template:default} {{name=Raw Roll}} [[ [[1d10]] [[1d10]] [[1d10]] ]] {{Rolling 3d6=$[[0]], $[[1]], $[[2]]}} It would be nice to : embed the macro in the character sheet and rolled from a button get it more beautiful. Using a roll template would be the best
1623933417
Divers
Pro
Sheet Author
Another way to say it : If I have a button &lt;button type="roll" name="roll_attRoll" value="&amp;{template:YnnPryddein} {{nom=@{name}}} {{numberOfDice=@{dicenumber3}}} [[ [[3d10]] ]] {{myRoll=[[@{dicenumber3}d10sm]]}}"&gt;&lt;/button&gt; The roll is ok, but the usefull information is in the tooltip. Is there a way to show the tooltip in the chat ? (without API) Should I create another post "How to show the roll tooltip in the chat?"
1623936507
David M.
Pro
API Scripter
Divers, if you are interested in an api macro solution, here is a Scriptcard that at least does the sorting part for you for an arbitrary number of d10's using a classic bubble sort algorithm. You could add logic to possibly perform additional automation using conditionals, procedures, etc. as the script has its own procedural language.&nbsp; !scriptcards {{ --#title|Roll Sorting Example --=NumDice|?{How many dice?|1} --:CREATE ROLL VARIABLES WITH A LOOP| --=i|0 --:RollLoop| --=i|[$i]+1 --=Roll[$i]|1d10 --?[$i] -lt [$NumDice]|RollLoop --:DISPLAY ROLLS UNSORTED| appends rolls to a string variable for output on one line --=i|0 --:UnsortedLoop| --=i|[$i]+1 --&amp;AllRolls|+[$Roll[$i.Total]] --?[$i] -lt [$NumDice]|UnsortedLoop --+Unsorted Rolls| --+|[&amp;AllRolls] --:PERFORM A BUBBLE SORT| --=i|0 --=max_i|[$NumDice]-1 --:OuterLoop| --=i|[$i]+1 --=j|[$i] --:InnerLoop| --=j|[$j]+1 --?[$Roll[$i.Total]] -gt [$Roll[$j.Total]] |&gt;BubbleUp;[$i.Total];[$j.Total] --?[$j.Total] -lt [$NumDice.Total]|InnerLoop --?[$i.Total] -lt [$max_i.Total]|OuterLoop --:DISPLAY ROLLS SORTED| appends rolls to a string variable for output on one line --=i|0 --&amp;AllRolls| --:SortedLoop| --=i|[$i]+1 --&amp;AllRolls|+[$Roll[$i.Total]] --?[$i] -lt [$NumDice]|SortedLoop --+Rolls sorted ascending| --+|[&amp;AllRolls] --X| --:FUNCTIONS| --:BubbleUp| accepts i, j as parameters. Swaps Roll[i] &amp; Roll[j] --=Temp|[$Roll[%2%]] --=Roll[%2%]|[$Roll[%1%]] --=Roll[%1%]|[$Temp] --&lt;| }}
1623937419
Divers
Pro
Sheet Author
Thank you David M. !! Your solution is nice :-) But, I am looking for a non API solution. I wish everybody could use this Character Sheet :-)
1623938258
David M.
Pro
API Scripter
Ah yes, I forgot this was for a character sheet. I can't be expected to remember information from 12 hrs ago, haha! :)&nbsp; Disregard.
1623939642
Divers
Pro
Sheet Author
;-)
1623939793
Divers
Pro
Sheet Author
I am wondering if the best is not to roll like this : ... and point out in the chat "Get your mouse over this", instead of "Résultat" ;-)
1623941139
timmaugh
Pro
API Scripter
Might it be that you have to build your own dice generator and parser? Can you do that on a character sheet? Then you can build your own custom roll template and present all of the data to the players. Instead of waiting for the Roll20 parser to produce the inline roll, you handle it internally. Your available equation options are fairly narrow: number of d10: 1-5 advantage/disadvantage So you could do roll equations of: 3a 4d 4?{Advantage?|Yes,a|No,d} 5@{advantage_toggle} You could maybe even skip the advantage/disadvantage bit and just present both numbers: =================================== | Base Roll | |=================================| | 1, 6, 7, 8 | |---------------------------------| | Adv &nbsp; | &nbsp; Disadv | | 14 | 21 | |=================================| Hell, if you're going that far, you might do a little combination jiggery and give a table of options to your players, to let them choose how many "destiny" points they want to spend: ============================================ | Base Roll | | 1, 6, 7, 8 | |==========================================| | Chance | Adv &nbsp; | &nbsp; Disadv | |------------------------------------------| | 0 | 14 | 21 | | 1 | 7 | 13 | | 2 | 6 | 12 | | 3 | 5 | 6 | |==========================================| You could probably handle the combinations on a reduce() function to get your lines of code down to a reasonable number (think 100 as compared to 100,000), and you could probably use math to limit the number of calculations you have to perform (if the gap between two rolled results is greater than the amount of chance expenditure you're calculating, don't worry about further combinations... just subtract the chance from the total, keeping some minimum value --&nbsp; at least 1 or non-negative, whatever the system calls for). Sheet authors will have to tell me if this sort of javascript is available *on* a character sheet.
1623941268
timmaugh
Pro
API Scripter
oh... except now I see you are using a pre-built sheet, not building your own. I thought you were putting this together yourself. My suggestion may end up in the "disregard" pile with David's. =D
1623942011
Divers
Pro
Sheet Author
Thanks timmaugh ! I don't understand everything. I will spend some time to proceed this ;-) I am building and publishing the Sheet. It is publicly available. But I am not the game creator. As far as I know, from a button we can call a "roll" or an "action". But unfortunately Action buttons can be used as events to trigger Sheetworkers , and cannot be used for send messages to the q Text Chat . (from <a href="https://wiki.roll20.net/Button#Action_Button" rel="nofollow">https://wiki.roll20.net/Button#Action_Button</a> ) Or may I trick the button ? like one clic to launch the worker and get hidden information second clic as a roll button to send it to the chat Well, not so user friendly. But getting the tooltip with the mouse is not so friendly neither...
1623942390
Divers
Pro
Sheet Author
I am not sure this is a good idea to compute advantage/disadvantage automatically : 4, 6, 6, 6 + adv =&gt; 6 (keeping highest dices (6, 6, 6) 4, 6, 6, 7 +adv =&gt; 10 (keeping (4, 6, 6). with 1 "chance point" =&gt; 6 (keeping 6, 6, 7-1) I ma pretty sure there are too many combinations, and that I can not call Matlab/ Maple/ R/ Mathematica/ Julia Combinatorial Optimizer in a Sheet with a Free account ;-)
1623943692
GiGs
Pro
Sheet Author
API Scripter
Divers said: For what I understand, the rule is far too complex to be implemented. I want to help the player in the process. Ordering the roll by values of the dices would be nice. Maybe better than hightlight the matching dices. Can we get ordered a roll like this one ? 3d10s wouldn't work as there are 3 independent rolls. &amp;{template:default} {{name=Raw Roll}} [[ [[1d10]] [[1d10]] [[1d10]] ]] {{Rolling 3d6=$[[0]], $[[1]], $[[2]]}} wow, this is a fast moving thread :) Yes, this does look tough. I'll think about it in the morning, but the problem isn't really the complexity, it's the two steps where players make choices that interrupt the flow. Roll20's mechanics aren't really good at handling that. An SPI script solution could handle it, buy printing an intermediate stage in chat, and then a player could click that result to be prompted to make their choices. But offhand I don't see a way to handle this without the API. Tim's suggestion of printing a button into chat might be possible, if users of the sheet are instructed to create a set of specific macros before using the sheet.
1623943759
GiGs
Pro
Sheet Author
API Scripter
Divers said: Or may I trick the button ? like one clic to launch the worker and get hidden information second clic as a roll button to send it to the chat Well, not so user friendly. But getting the tooltip with the mouse is not so friendly neither... You're right, it's not very userfriendly, but it is the only way to combine an action button a roll button.
1623943848

Edited 1623944490
GiGs
Pro
Sheet Author
API Scripter
Divers said: Thank you to both of you. To Kraynic : I'll give it a look. Isn't it the case as well for Eclipse Phase ? I think some games use matching d10 on a roll 100 as criticals. I thought it was a roll20 dice roller feature. I will investigate this direction. To GIGs : wow, that would be a lot of lines ^^ I guess this would check each case or something ? Indeed there&nbsp; are 111110 possible combinations (1 to 5 dices, by 10 faces). Well, ok, I understand. Let me explain the roll : roll 1 to 5 d10 choose 3 dices (or keep them if you roll 1 to 3 dices). (the "best" combination if there is an advantage, the worst if there is a diadvantage. "Best" means "the one I choose to get the lowest final value at the step 5) add or substract some points if you spend "chance/destiny" resource points keep only 1 dice if there are matching dices add the dices values. The goal is to get the lower value. To get a succes you may go under a threshold determined by a calculation of values on your character sheet. As it depends largely on the context, I'll give it out of the description ;-) An example : I roll 2, 4, 6, 7 with an advantage I choose 2, 6 ,7 I spend "chance" to turn 7 into 6 I get 2, 6, 6 : with the matching sixes I discard one of them, to get 2, 6 my result is 8. I compare this 8 to some calculations obtained from my character sheet (caracteristic, magic, name,&nbsp; carrer...) depending on the context I am sure I don't want to implement that ;-) From now on, I show the dice values to the GM and the player. And they have to choose. To help a little, I intend to show matching dices. Thanks for the explanation for the API embeded in a sheet. I don't want that :-) Thanks, thats a lot of information. I have a question: how do you judge what is a good roll? In your example you kept the 2, 6, and 7, whereas I'd have expected you to keep the 4, 6, and 7. Edit: Oh never mind - I see best is lowest total. Actually that raises two more questions: Is it always better to roll less than 3 dice? Why didn't you keep the 2 and the 4?
1623944921
Divers
Pro
Sheet Author
Well... a "good" roll is the one you think is the best for you :D The goal is to achieve the lowest sum at the end . But ! you could choose bigger values in order to change them with "chance point ", so they match and then disappear, and then get a lower sum... So, that's why my idea is to show the raw numbers. With a helper (matchings, sorted) to get the minimal cognitive load for the player ;-)
1623945385
GiGs
Pro
Sheet Author
API Scripter
aha, that makes sense. That does add quite a bit of complexity. Yes, for a system like this you need to show players the raw dice, so can then choose which dice to use and how to spend their chance points. Are lower scores better than higher scores (so rolling 2 dice is better than rolling 3 dice)?
1623946059
Divers
Pro
Sheet Author
Are lower scores better than higher scores (so rolling 2 dice is better than rolling 3 dice)? Lower scores "at the end" is better. I think that rolling less dices leads always to "at the end" lower scores. But choosing lower values doesn't lead always to lower scores. Even without changing values with "chance" : 2, 4, 6, 6 =&gt; choosing 4, 6, 6 = 10 is better than 2, 4, 6 = 12
1623946448
Divers
Pro
Sheet Author
I can only imagine a Combinatorial Optimizer to show to the player "N is the best you can achieve if you spend n "chance"" : [N0,0], [N1,1], [N2,2]... And I am sure if I have to implement that kind of Combinatorial Optimizer, I'll go for Julia+JuMP+GLPK ;-)
1623948980
Finderski
Pro
Sheet Author
Compendium Curator
you could have a sheet worker that build the roll formula for a Roll Template and then a roll template that groups the rolls using the rollTotal() helper function. &nbsp;This isn't actual code, but it would look something like this... {{#rollTotal() firstDie 1}}{{firstDie}}{{/rollTotal() firstDie 1}}{{#rollTotal() secondDie 1}}{{secondDie}}{{/rollTotal() secondDie 1}}...{{#rollTotal() fifthDie 1}}{{fifthDie}}{{/rollTotal() fifthDie 1}}
1623953031

Edited 1623953123
GiGs
Pro
Sheet Author
API Scripter
Finderski, that's the kind of method I was alluding to earlier when I said it could take around 100,000 lines of code... There might be shortcuts to significantly reduce that, but it's still going to be a lot .
1623959099

Edited 1623959410
timmaugh
Pro
API Scripter
Not sure how much js can be in a sheet, but here is the "best" side of a roll, generated for using 0, 1, 2, and 3 chance points... NOTE: I wrote this to be a console proof-of-concept version, so I didn't use Roll20 functions like log() and randomInteger() ... especially since I'm not sure which of those map over to the character sheet environment. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 const getD10 = () =&gt; { return 1 + Math .floor( Math .random()* 10 );}; let numD10 = 5 ; let baseroll = [... Array (numD10)].map((e, i) =&gt; 1 + Math .floor( Math .random()* 10 )).sort((a,b) =&gt; a - b); console.log(baseroll); const getBest = (a, k = 3 , curbest = baseroll.length * 10 ) =&gt; { let o = a.reduce((m,v) =&gt; { m[v] = (m[v] || 0 ) + 1 ; return m; },{}); const buildbest = (key = 0 ) =&gt; { let avkeys = Object .keys(o); let w = o[avkeys[key]]; let total = parseInt (avkeys[key]); avkeys = avkeys.filter((e,i) =&gt; i !== key); while (w &lt; k) { w += parseInt (o[avkeys[ 0 ]]); total += parseInt (avkeys.shift()); } return total; }; let best = baseroll.reduce((m,v,i) =&gt; { if (i &gt; Object .keys(o).length- 1 ) return m; let temp = buildbest(i); return temp &lt; m ? temp : m; },curbest); return best; }; const chanceBest = (chance) =&gt; { let rollSet = []; const permutaterolls = (c, r = baseroll) =&gt; { if (c=== 0 ) return ; r.forEach((e,i) =&gt; { let [incr, decr] = [[...r],[...r]]; incr[i] = ++incr[i]; rollSet.push(incr); permutaterolls(c- 1 , incr) decr[i] = --decr[i]; rollSet.push(decr); permutaterolls(c- 1 , decr); }); }; permutaterolls(chance); let rollSetObj = rollSet .filter(e =&gt; e.reduce((m,e1) =&gt; { m = m &amp;&amp; (e1 &gt;= 1 &amp;&amp; e1 &lt;= 10 ); return m; }, true )) .map(e =&gt; e.sort((a,b) =&gt; a - b)) .reduce((m,e) =&gt; { m[e.join( '' )] = e; return m; }, {}); return Object .keys(rollSetObj).map(e=&gt;rollSetObj[e]); }; const Results = () =&gt; { let best0 = getBest(baseroll); let best1 = chanceBest( 1 ).reduce((m,v) =&gt; { let temp = getBest(v); return temp &lt; m ? temp : m; },best0); let best2 = chanceBest( 2 ).reduce((m,v) =&gt; { let temp = getBest(v); return temp &lt; m ? temp : m; },best1); let best3 = chanceBest( 3 ).reduce((m,v) =&gt; { let temp = getBest(v); return temp &lt; m ? temp : m; },best2); return { Best0: best0, Best1: best1, Best2: best2, Best3: best3 }; }; console.log(Results()); Drop that into your console (or your favorite emulator), and run it a bunch of times. It will give you the best option for the roll with each increment of chance you spend. Even given my log statements, blank lines, and the generation of the roll, it's still only 77 lines. I'll leave it to you to reverse it for the "worst" option.
1623959660
timmaugh
Pro
API Scripter
Example Rolls &amp; Outputs: &gt; Array [1, 2, 5, 7, 8] &gt; Object { Best0: 8, Best1: 6, Best2: 5, Best3: 3 } &gt; Array [1, 8, 8, 8, 9] &gt; Object { Best0: 8, Best1: 8, Best2: 8, Best3: 7 } &gt; Array [2, 2, 2, 6, 10] &gt; Object { Best0: 2, Best1: 2, Best2: 2, Best3: 1 } &gt; Array [3, 8, 8, 10, 10] &gt; Object { Best0: 11, Best1: 10, Best2: 8, Best3: 8 } &gt; Array [1, 1, 3, 4, 10] &gt; Object { Best0: 4, Best1: 3, Best2: 1, Best3: 1 }
1623963203

Edited 1623963259
Finderski
Pro
Sheet Author
Compendium Curator
It could be that I'm missing something, but why would it need to be more than this: &lt;div class="group1s"&gt; {{#rollTotal() firstDie 1}}{{firstDie}}{{/rollTotal() firstDie 1}} {{#rollTotal() secondDie 1}}{{secondDie}}{{/rollTotal() secondDie 1}} {{#rollTotal() thirdDie 1}}{{thirdDie}}{{/rollTotal() thirdDie 1}} {{#rollTotal() fourthDie 1}}{{fourthDie}}{{/rollTotal() fourthDie 1}} {{#rollTotal() fifthDie 1}}{{fifthDie}}{{/rollTotal() fifthDie 1}} &lt;/div&gt; &lt;div class="group2s"&gt; {{#rollTotal() firstDie 2}}{{firstDie}}{{/rollTotal() firstDie 2}} {{#rollTotal() secondDie 2}}{{secondDie}}{{/rollTotal() secondDie 2}} {{#rollTotal() thirdDie 2}}{{thirdDie}}{{/rollTotal() thirdDie 2}} {{#rollTotal() fourthDie 2}}{{fourthDie}}{{/rollTotal() fourthDie 2}} {{#rollTotal() fifthDie 2}}{{fifthDie}}{{/rollTotal() fifthDie 2}} &lt;/div&gt; &lt;div class="group3s"&gt; {{#rollTotal() firstDie 3}}{{firstDie}}{{/rollTotal() firstDie 3}} {{#rollTotal() secondDie 3}}{{secondDie}}{{/rollTotal() secondDie 3}} {{#rollTotal() thirdDie 3}}{{thirdDie}}{{/rollTotal() thirdDie 3}} {{#rollTotal() fourthDie 3}}{{fourthDie}}{{/rollTotal() fourthDie 3}} {{#rollTotal() fifthDie 3}}{{fifthDie}}{{/rollTotal() fifthDie 3}} &lt;/div&gt; &lt;div class="group4s"&gt; {{#rollTotal() firstDie 4}}{{firstDie}}{{/rollTotal() firstDie 4}} {{#rollTotal() secondDie 4}}{{secondDie}}{{/rollTotal() secondDie 4}} {{#rollTotal() thirdDie 4}}{{thirdDie}}{{/rollTotal() thirdDie 4}} {{#rollTotal() fourthDie 4}}{{fourthDie}}{{/rollTotal() fourthDie 4}} {{#rollTotal() fifthDie 4}}{{fifthDie}}{{/rollTotal() fifthDie 4}} &lt;/div&gt; &lt;div class="group5s"&gt; {{#rollTotal() firstDie 5}}{{firstDie}}{{/rollTotal() firstDie 5}} {{#rollTotal() secondDie 5}}{{secondDie}}{{/rollTotal() secondDie 5}} {{#rollTotal() thirdDie 5}}{{thirdDie}}{{/rollTotal() thirdDie 5}} {{#rollTotal() fourthDie 5}}{{fourthDie}}{{/rollTotal() fourthDie 5}} {{#rollTotal() fifthDie 5}}{{fifthDie}}{{/rollTotal() fifthDie 5}} &lt;/div&gt; &lt;div class="group6s"&gt; {{#rollTotal() firstDie 6}}{{firstDie}}{{/rollTotal() firstDie 6}} {{#rollTotal() secondDie 6}}{{secondDie}}{{/rollTotal() secondDie 6}} {{#rollTotal() thirdDie 6}}{{thirdDie}}{{/rollTotal() thirdDie 6}} {{#rollTotal() fourthDie 6}}{{fourthDie}}{{/rollTotal() fourthDie 6}} {{#rollTotal() fifthDie 6}}{{fifthDie}}{{/rollTotal() fifthDie 6}} &lt;/div&gt; &lt;div class="group7s"&gt; {{#rollTotal() firstDie 7}}{{firstDie}}{{/rollTotal() firstDie 7}} {{#rollTotal() secondDie 7}}{{secondDie}}{{/rollTotal() secondDie 7}} {{#rollTotal() thirdDie 7}}{{thirdDie}}{{/rollTotal() thirdDie 7}} {{#rollTotal() fourthDie 7}}{{fourthDie}}{{/rollTotal() fourthDie 7}} {{#rollTotal() fifthDie 7}}{{fifthDie}}{{/rollTotal() fifthDie 7}} &lt;/div&gt; &lt;div class="group8s"&gt; {{#rollTotal() firstDie 8}}{{firstDie}}{{/rollTotal() firstDie 8}} {{#rollTotal() secondDie 8}}{{secondDie}}{{/rollTotal() secondDie 8}} {{#rollTotal() thirdDie 8}}{{thirdDie}}{{/rollTotal() thirdDie 8}} {{#rollTotal() fourthDie 8}}{{fourthDie}}{{/rollTotal() fourthDie 8}} {{#rollTotal() fifthDie 8}}{{fifthDie}}{{/rollTotal() fifthDie 8}} &lt;/div&gt; &lt;div class="group9s"&gt; {{#rollTotal() firstDie 9}}{{firstDie}}{{/rollTotal() firstDie 9}} {{#rollTotal() secondDie 9}}{{secondDie}}{{/rollTotal() secondDie 9}} {{#rollTotal() thirdDie 9}}{{thirdDie}}{{/rollTotal() thirdDie 9}} {{#rollTotal() fourthDie 9}}{{fourthDie}}{{/rollTotal() fourthDie 9}} {{#rollTotal() fifthDie 9}}{{fifthDie}}{{/rollTotal() fifthDie 9}} &lt;/div&gt; &lt;div class="group10s"&gt; {{#rollTotal() firstDie 10}}{{firstDie}}{{/rollTotal() firstDie 10}} {{#rollTotal() secondDie 10}}{{secondDie}}{{/rollTotal() secondDie 10}} {{#rollTotal() thirdDie 10}}{{thirdDie}}{{/rollTotal() thirdDie 10}} {{#rollTotal() fourthDie 10}}{{fourthDie}}{{/rollTotal() fourthDie 10}} {{#rollTotal() fifthDie 10}}{{fifthDie}}{{/rollTotal() fifthDie 10}} &lt;/div&gt; The sheet worker would be pretty small, too, because it's simply taking the number of dice to roll and cycling through that number and appending information to a string, so the final attribute would be something like: {{firstDie=[[1d10]]}} {{secondDie=[[1d10]]}} I'm not talking about a full implementation, just the very basics of being able to use a roll template and group the rolls for easy reading. All that other stuff of spending points, etc would still be fully manual. Admittedly, I'm probably missing something pretty obvious at the moment...
1623970424
Divers
Pro
Sheet Author
Wow, that's a lot of answers !! :-) Great thanks ! I'll give it a look tomorrow. Big thanks again.
1623971394
Divers
Pro
Sheet Author
timmaugh said: Example Rolls &amp; Outputs: &gt; Array [1, 2, 5, 7, 8] &gt; Object { Best0: 8, Best1: 6, Best2: 5, Best3: 3 } ... As far as I understand the result, this seems to be good ! It's impressively clever ^^ I don"t understand the js code right now. It's too late ;-)
1623971589
Divers
Pro
Sheet Author
Finderski said: It could be that I'm missing something, but why would it need to be more than this: &lt;div class="group1s"&gt; {{#rollTotal() firstDie 1}}{{firstDie}}{{/rollTotal() firstDie 1}} {{#rollTotal() secondDie 1}}{{secondDie}}{{/rollTotal() secondDie 1}} ... I don't understand everything. But actually, if I'm not wrong this should sort dices and highlight matchings... I will check tomorrow if this solves my "raw values sorted and matchings" to the chat request :-)
1623999498

Edited 1624000469
GiGs
Pro
Sheet Author
API Scripter
Finderski said: It could be that I'm missing something, but why would it need to be more than this: &lt;div class="group1s"&gt; {{#rollTotal() firstDie 1}}{{firstDie}}{{/rollTotal() firstDie 1}} {{#rollTotal() secondDie 1}}{{secondDie}}{{/rollTotal() secondDie 1}} {{#rollTotal() thirdDie 1}}{{thirdDie}}{{/rollTotal() thirdDie 1}} {{#rollTotal() fourthDie 1}}{{fourthDie}}{{/rollTotal() fourthDie 1}} {{#rollTotal() fifthDie 1}}{{fifthDie}}{{/rollTotal() fifthDie 1}} &lt;/div&gt; &lt;div class="group2s"&gt; {{#rollTotal() firstDie 2}}{{firstDie}}{{/rollTotal() firstDie 2}} {{#rollTotal() secondDie 2}}{{secondDie}}{{/rollTotal() secondDie 2}} {{#rollTotal() thirdDie 2}}{{thirdDie}}{{/rollTotal() thirdDie 2}} {{#rollTotal() fourthDie 2}}{{fourthDie}}{{/rollTotal() fourthDie 2}} {{#rollTotal() fifthDie 2}}{{fifthDie}}{{/rollTotal() fifthDie 2}} &lt;/div&gt; &lt;div class="group3s"&gt; {{#rollTotal() firstDie 3}}{{firstDie}}{{/rollTotal() firstDie 3}} {{#rollTotal() secondDie 3}}{{secondDie}}{{/rollTotal() secondDie 3}} {{#rollTotal() thirdDie 3}}{{thirdDie}}{{/rollTotal() thirdDie 3}} {{#rollTotal() fourthDie 3}}{{fourthDie}}{{/rollTotal() fourthDie 3}} {{#rollTotal() fifthDie 3}}{{fifthDie}}{{/rollTotal() fifthDie 3}} &lt;/div&gt; &lt;div class="group4s"&gt; {{#rollTotal() firstDie 4}}{{firstDie}}{{/rollTotal() firstDie 4}} {{#rollTotal() secondDie 4}}{{secondDie}}{{/rollTotal() secondDie 4}} {{#rollTotal() thirdDie 4}}{{thirdDie}}{{/rollTotal() thirdDie 4}} {{#rollTotal() fourthDie 4}}{{fourthDie}}{{/rollTotal() fourthDie 4}} {{#rollTotal() fifthDie 4}}{{fifthDie}}{{/rollTotal() fifthDie 4}} &lt;/div&gt; &lt;div class="group5s"&gt; {{#rollTotal() firstDie 5}}{{firstDie}}{{/rollTotal() firstDie 5}} {{#rollTotal() secondDie 5}}{{secondDie}}{{/rollTotal() secondDie 5}} {{#rollTotal() thirdDie 5}}{{thirdDie}}{{/rollTotal() thirdDie 5}} {{#rollTotal() fourthDie 5}}{{fourthDie}}{{/rollTotal() fourthDie 5}} {{#rollTotal() fifthDie 5}}{{fifthDie}}{{/rollTotal() fifthDie 5}} &lt;/div&gt; &lt;div class="group6s"&gt; {{#rollTotal() firstDie 6}}{{firstDie}}{{/rollTotal() firstDie 6}} {{#rollTotal() secondDie 6}}{{secondDie}}{{/rollTotal() secondDie 6}} {{#rollTotal() thirdDie 6}}{{thirdDie}}{{/rollTotal() thirdDie 6}} {{#rollTotal() fourthDie 6}}{{fourthDie}}{{/rollTotal() fourthDie 6}} {{#rollTotal() fifthDie 6}}{{fifthDie}}{{/rollTotal() fifthDie 6}} &lt;/div&gt; &lt;div class="group7s"&gt; {{#rollTotal() firstDie 7}}{{firstDie}}{{/rollTotal() firstDie 7}} {{#rollTotal() secondDie 7}}{{secondDie}}{{/rollTotal() secondDie 7}} {{#rollTotal() thirdDie 7}}{{thirdDie}}{{/rollTotal() thirdDie 7}} {{#rollTotal() fourthDie 7}}{{fourthDie}}{{/rollTotal() fourthDie 7}} {{#rollTotal() fifthDie 7}}{{fifthDie}}{{/rollTotal() fifthDie 7}} &lt;/div&gt; &lt;div class="group8s"&gt; {{#rollTotal() firstDie 8}}{{firstDie}}{{/rollTotal() firstDie 8}} {{#rollTotal() secondDie 8}}{{secondDie}}{{/rollTotal() secondDie 8}} {{#rollTotal() thirdDie 8}}{{thirdDie}}{{/rollTotal() thirdDie 8}} {{#rollTotal() fourthDie 8}}{{fourthDie}}{{/rollTotal() fourthDie 8}} {{#rollTotal() fifthDie 8}}{{fifthDie}}{{/rollTotal() fifthDie 8}} &lt;/div&gt; &lt;div class="group9s"&gt; {{#rollTotal() firstDie 9}}{{firstDie}}{{/rollTotal() firstDie 9}} {{#rollTotal() secondDie 9}}{{secondDie}}{{/rollTotal() secondDie 9}} {{#rollTotal() thirdDie 9}}{{thirdDie}}{{/rollTotal() thirdDie 9}} {{#rollTotal() fourthDie 9}}{{fourthDie}}{{/rollTotal() fourthDie 9}} {{#rollTotal() fifthDie 9}}{{fifthDie}}{{/rollTotal() fifthDie 9}} &lt;/div&gt; &lt;div class="group10s"&gt; {{#rollTotal() firstDie 10}}{{firstDie}}{{/rollTotal() firstDie 10}} {{#rollTotal() secondDie 10}}{{secondDie}}{{/rollTotal() secondDie 10}} {{#rollTotal() thirdDie 10}}{{thirdDie}}{{/rollTotal() thirdDie 10}} {{#rollTotal() fourthDie 10}}{{fourthDie}}{{/rollTotal() fourthDie 10}} {{#rollTotal() fifthDie 10}}{{fifthDie}}{{/rollTotal() fifthDie 10}} &lt;/div&gt; The sheet worker would be pretty small, too, because it's simply taking the number of dice to roll and cycling through that number and appending information to a string, so the final attribute would be something like: {{firstDie=[[1d10]]}} {{secondDie=[[1d10]]}} I'm not talking about a full implementation, just the very basics of being able to use a roll template and group the rolls for easy reading. All that other stuff of spending points, etc would still be fully manual. Admittedly, I'm probably missing something pretty obvious at the moment... Unless I'm missing something (perfectly possible, I just woke up!), that code doesnt handle situations where you roll, say, 3, 4, 5, 6, 6. Nor situations where you are only rolling 1, 2, 3, or 4 dice.
1623999932

Edited 1623999958
GiGs
Pro
Sheet Author
API Scripter
The problem with Timmaugh's code is it's not really appropriate for a sheet worker. You can generate all the dice charsheet side, but that's only visible to the owner of the character sheet, and there are a bunch of problems with that. If you wanted to generate the roll to display on the character sheet, and then have another button to print it to chat, you could do that. That's probably not the experience people want though. (Also, a player could just keep clicking the roll button till they got what they wanted, then print that result to chat.) Note to Timmaugh: randomInteger isn't available in sheet workers, so it's okay you didn't use that.
1624003556
Divers
Pro
Sheet Author
:crying: Thank you for those remarks GIGs, you ruined my yesterday evening expectations ;-) GiGs said: &nbsp;(Also, a player could just keep clicking the roll button till they got what they wanted, then print that result to chat.) Should I generate a hidden intermediate result to solve this unwanted player behavior? That will not solve the "clic twice" experience.
1624009282
Finderski
Pro
Sheet Author
Compendium Curator
GiGs said: Unless I'm missing something (perfectly possible, I just woke up!), that code doesnt handle situations where you roll, say, 3, 4, 5, 6, 6. Nor situations where you are only rolling 1, 2, 3, or 4 dice. It handles all of those, because it's only displaying things that meet the requirement. If nothing's passed it, it doesn't meet the requirement so wouldn't be displayed anyway. Here's the macro I used for that (I just kept adding additional dice each roll): &amp;{template:roll} {{firstDie=[[1d10]] }} {{secondDie=[[1d10]] }} {{thirdDie=[[1d10]] }} {{fourthDie=[[1d10]] }} {{fifthDie=[[1d10]] }} And here's the roll template &lt;rolltemplate class="sheet-rolltemplate-roll"&gt; &lt;h1&gt;Roll&lt;/h1&gt; &lt;div class="group1s"&gt; &lt;span&gt;Group 1s&lt;br&gt; {{#rollTotal() firstDie 1}}{{firstDie}}{{/rollTotal() firstDie 1}} {{#rollTotal() secondDie 1}}{{secondDie}}{{/rollTotal() secondDie 1}} {{#rollTotal() thirdDie 1}}{{thirdDie}}{{/rollTotal() thirdDie 1}} {{#rollTotal() fourthDie 1}}{{fourthDie}}{{/rollTotal() fourthDie 1}} {{#rollTotal() fifthDie 1}}{{fifthDie}}{{/rollTotal() fifthDie 1}} &lt;/span&gt; &lt;/div&gt; &lt;div class="group2s"&gt; &lt;span&gt;Group 2s&lt;br&gt; {{#rollTotal() firstDie 2}}{{firstDie}}{{/rollTotal() firstDie 2}} {{#rollTotal() secondDie 2}}{{secondDie}}{{/rollTotal() secondDie 2}} {{#rollTotal() thirdDie 2}}{{thirdDie}}{{/rollTotal() thirdDie 2}} {{#rollTotal() fourthDie 2}}{{fourthDie}}{{/rollTotal() fourthDie 2}} {{#rollTotal() fifthDie 2}}{{fifthDie}}{{/rollTotal() fifthDie 2}} &lt;/span&gt; &lt;/div&gt; &lt;div class="group3s"&gt; &lt;span&gt;Group 3s&lt;br&gt; {{#rollTotal() firstDie 3}}{{firstDie}}{{/rollTotal() firstDie 3}} {{#rollTotal() secondDie 3}}{{secondDie}}{{/rollTotal() secondDie 3}} {{#rollTotal() thirdDie 3}}{{thirdDie}}{{/rollTotal() thirdDie 3}} {{#rollTotal() fourthDie 3}}{{fourthDie}}{{/rollTotal() fourthDie 3}} {{#rollTotal() fifthDie 3}}{{fifthDie}}{{/rollTotal() fifthDie 3}} &lt;/span&gt; &lt;/div&gt; &lt;div class="group4s"&gt; &lt;span&gt;Group 4s&lt;br&gt; {{#rollTotal() firstDie 4}}{{firstDie}}{{/rollTotal() firstDie 4}} {{#rollTotal() secondDie 4}}{{secondDie}}{{/rollTotal() secondDie 4}} {{#rollTotal() thirdDie 4}}{{thirdDie}}{{/rollTotal() thirdDie 4}} {{#rollTotal() fourthDie 4}}{{fourthDie}}{{/rollTotal() fourthDie 4}} {{#rollTotal() fifthDie 4}}{{fifthDie}}{{/rollTotal() fifthDie 4}} &lt;/span&gt; &lt;/div&gt; &lt;div class="group5s"&gt; &lt;span&gt;Group 5s&lt;br&gt; {{#rollTotal() firstDie 5}}{{firstDie}}{{/rollTotal() firstDie 5}} {{#rollTotal() secondDie 5}}{{secondDie}}{{/rollTotal() secondDie 5}} {{#rollTotal() thirdDie 5}}{{thirdDie}}{{/rollTotal() thirdDie 5}} {{#rollTotal() fourthDie 5}}{{fourthDie}}{{/rollTotal() fourthDie 5}} {{#rollTotal() fifthDie 5}}{{fifthDie}}{{/rollTotal() fifthDie 5}} &lt;/span&gt; &lt;/div&gt; &lt;div class="group6s"&gt; &lt;span&gt;Group 6s&lt;br&gt; {{#rollTotal() firstDie 6}}{{firstDie}}{{/rollTotal() firstDie 6}} {{#rollTotal() secondDie 6}}{{secondDie}}{{/rollTotal() secondDie 6}} {{#rollTotal() thirdDie 6}}{{thirdDie}}{{/rollTotal() thirdDie 6}} {{#rollTotal() fourthDie 6}}{{fourthDie}}{{/rollTotal() fourthDie 6}} {{#rollTotal() fifthDie 6}}{{fifthDie}}{{/rollTotal() fifthDie 6}} &lt;/span&gt; &lt;/div&gt; &lt;div class="group7s"&gt; &lt;span&gt;Group 7s&lt;br&gt; {{#rollTotal() firstDie 7}}{{firstDie}}{{/rollTotal() firstDie 7}} {{#rollTotal() secondDie 7}}{{secondDie}}{{/rollTotal() secondDie 7}} {{#rollTotal() thirdDie 7}}{{thirdDie}}{{/rollTotal() thirdDie 7}} {{#rollTotal() fourthDie 7}}{{fourthDie}}{{/rollTotal() fourthDie 7}} {{#rollTotal() fifthDie 7}}{{fifthDie}}{{/rollTotal() fifthDie 7}} &lt;/span&gt; &lt;/div&gt; &lt;div class="group8s"&gt; &lt;span&gt;Group 8s&lt;br&gt; {{#rollTotal() firstDie 8}}{{firstDie}}{{/rollTotal() firstDie 8}} {{#rollTotal() secondDie 8}}{{secondDie}}{{/rollTotal() secondDie 8}} {{#rollTotal() thirdDie 8}}{{thirdDie}}{{/rollTotal() thirdDie 8}} {{#rollTotal() fourthDie 8}}{{fourthDie}}{{/rollTotal() fourthDie 8}} {{#rollTotal() fifthDie 8}}{{fifthDie}}{{/rollTotal() fifthDie 8}} &lt;/span&gt; &lt;/div&gt; &lt;div class="group9s"&gt; &lt;span&gt;Group 9s&lt;br&gt; {{#rollTotal() firstDie 9}}{{firstDie}}{{/rollTotal() firstDie 9}} {{#rollTotal() secondDie 9}}{{secondDie}}{{/rollTotal() secondDie 9}} {{#rollTotal() thirdDie 9}}{{thirdDie}}{{/rollTotal() thirdDie 9}} {{#rollTotal() fourthDie 9}}{{fourthDie}}{{/rollTotal() fourthDie 9}} {{#rollTotal() fifthDie 9}}{{fifthDie}}{{/rollTotal() fifthDie 9}} &lt;/span&gt; &lt;/div&gt; &lt;div class="group10s"&gt; &lt;span&gt;Group 10s&lt;br&gt; {{#rollTotal() firstDie 10}}{{firstDie}}{{/rollTotal() firstDie 10}} {{#rollTotal() secondDie 10}}{{secondDie}}{{/rollTotal() secondDie 10}} {{#rollTotal() thirdDie 10}}{{thirdDie}}{{/rollTotal() thirdDie 10}} {{#rollTotal() fourthDie 10}}{{fourthDie}}{{/rollTotal() fourthDie 10}} {{#rollTotal() fifthDie 10}}{{fifthDie}}{{/rollTotal() fifthDie 10}} &lt;/span&gt; &lt;/div&gt; &lt;/rolltemplate&gt; Personally, I'd remove the Group #s text, because it's not needed...I just added it to make sure I was getting the roll template and that things were going where they should.
1624017635
GiGs
Pro
Sheet Author
API Scripter
Sorry Divers! And oh! Finderski, I misunderstood what you were doing. I missed your explanation of the code at the end. As a way of sorting the dice, it seems like a great solution. I'm a bit rusty on rolltemplates - wouldn't you need to do something for when there are fewer than 5 dice? If so, the roll macro could assign them each a value of 0 or 11, so they'd be ignored in the output.
1624017954
Finderski
Pro
Sheet Author
Compendium Curator
iGs said: I'm a bit rusty on rolltemplates - wouldn't you need to do something for when there are fewer than 5 dice? If so, the roll macro could assign them each a value of 0 or 11, so they'd be ignored in the output. Nope, the rollTotal helper functions already cares for it. The above roll template and macro work. I just modified the macro to add and remove die rolls, so the first time I only sent in the firstDie bit, the second roll (in the screen shot) was just firstDie and secondDie, and so. However, you could totally always send five and just make the ones not used equal 0, as you suggest.
1624020278
timmaugh
Pro
API Scripter
Ah, well... If you build the sheet right, you could offer an optional API plugin. The sheet works for everyone, it just requires a little thought on the part of the player to determine the best course. But if the API is available it reduces some of the cognitive load. A sheet like Hero 6E has a "Additional Action" field attached to its powers, letting you run another character sheet item or send an API command or a character ability (which has an API command). If you want to fly with a different roller than the one built into the sheet, you can zero-out the original power information and just put an API command line into the Additional Action field.
1624268043

Edited 1624268059
Divers
Pro
Sheet Author
Many thanks to all of you. That's a lot of information for me, and a lot to test. I will try your suggestions, and keep you informed. I expect to do it sometimes during the week. Thanks&nbsp; again :-)