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

Checking for Doubles and posting in chat

A search of the forums shows that this topic was asked about 9years ago. [Script] Conditionnal doubles, triples... So, I am hoping someone has already tackled this. First, my HTML code experience is limited, but... Second, I have converted the Arcane Codex character sheet for Bethorm RPG. That took some doing because I had to translate it from German and understand what the HTML was doing. After GiGs told me about using the Legacy switch the Bethorm character sheet turned out to be usable. Third, I would like to add a Bethorm Critical Success/Failure alert which is based on any doubles being rolled. I know about  2d10m, but you have to mouse over the numbers to check which is a procedure that I think could be automated instead. Here is the line that generates the dice roll: <!-- Physique --> <div class="sheet-eigenname"> <label>Physique</label> </div> <div class="sheet-eigenbase"> <input type="number" name="attr_strbase" value="8" title="Physique base"> </div> <div class="sheet-eigenboni"> <input type="number" name="attr_strboni" value="0" title="Physique temporary bonuses"> </div> <div class="sheet-eigentotal"> <input type="number" name="attr_strtotal" value=" [[ @{strbase}+@{strboni} ]] " title="Base Physique + Bonuses" disabled="true"> </div> <div class="sheet-eigenbonus"> <input type="number" name="attr_strbonus" value=" [[ @{strtotal}-10 ]] " title="Physiquemodifier" disabled="true"> </div> <div class="sheet-eigenwurf"> <button type="roll" name="roll_physroll" title="Physiqueroll" value="&{template:ArcaneCodex}{{wurf_name=@{character_name}s Physique roll}}{{wert1=Physiquemodifier}}{{wert1_num=@{strbonus}}}{{mod_num=?{Modifikator|0}}}{{wundmali= [[ @{malus} ]] }}{{ergebnis_name=Physiqueroll}}{{Check= [[ 2d10+@{strbonus}+?{Modifikator}+ [[ @{malus} ]] ]] }}" /> </div> </div> <!-- Physique --> So at the end of the button line is the  {{Check= [[ 2d10+...    which sends it to the rolltemplate to check for high/low criticals which isn't the Critical system in Bethorm. Criticals happen when doubles are rolled. The rolltemplate looks like this: <rolltemplate class="sheet-rolltemplate-ArcaneCodex"> <table> <tr> <th colspan="2">{{wurf_name}}</th> </tr> <tr><td colspan="2"><div class="sheet-rolltemplate-spacer"> </div></td></tr> <tr><td colspan="2"><div class="sheet-rolltemplate-sectionheading"><b>Values</b></div></td></tr> {{#text}} <tr> <td colspan="2" style="text-align: center"><b>{{text}}</b></td> </tr> {{/text}} {{#wert1}} <tr> <td>{{wert1}}</td> <td>{{wert1_num}}</td> </tr> {{/wert1}} {{#mod_num}} <tr> <td>Modifikator</td> <td>{{mod_num}}</td> </tr> {{/mod_num}} {{#wundmali}} <tr> <td>Wounds</td> <td>{{wundmali}}</td> </tr> {{/wundmali}} <!-- Critical Check --> {{#Check}} <tr><td colspan="2"><div class="sheet-rolltemplate-spacer"> </div></td></tr> <tr><td colspan="2"><div class="sheet-rolltemplate-sectionheading"><b>Result</b></div></td></tr> <tr> <td colspan="2" style="text-align: center"><b>{{Check}}</b></td> </tr> {{#rollWasCrit() Check}} <tr> <td colspan="2" style="text-align: center">Potentially Critical Success</td> </tr> {{/rollWasCrit() Check}} {{#rollWasFumble() Check}} <tr> <td colspan="2" style="text-align: center">Potentially Critical Failure</td> </tr> {{/rollWasFumble() Check}} {{/Check}} <!-- END Critical Check --> {{#damage_roll}} <tr><td colspan="2"><div class="sheet-rolltemplate-spacer"> </div></td></tr> <tr><td colspan="2"><div class="sheet-rolltemplate-sectionheading-schaden"><b>Damage</b></div></td></tr> {{#swert1}} <tr> <td><div class="sheet-rolltemplate-section-schaden">{{swert1}}</div></td> <td><div class="sheet-rolltemplate-section-schaden">{{swert1_num}}</div></td> </tr> {{/swert1}} {{#swert2}} <tr> <td><div class="sheet-rolltemplate-section-schaden">{{swert2}}</div></td> <td><div class="sheet-rolltemplate-section-schaden">{{swert2_num}}</div></td> </tr> {{/swert2}} {{#swert3}} <tr> <td><div class="sheet-rolltemplate-section-schaden">{{swert3}}</div></td> <td><div class="sheet-rolltemplate-section-schaden">{{swert3_num}}</div></td> </tr> {{/swert3}} {{#cause_damage}} <tr> <td><div class="sheet-rolltemplate-section-schaden">Basic damage</div></td> <td><div class="sheet-rolltemplate-section-schaden">{{cause_damage}}</div></td> </tr> {{/cause_damage}} {{#strbonus}} <tr> <td><div class="sheet-rolltemplate-section-schaden">Physiquemodifier</div></td> <td><div class="sheet-rolltemplate-section-schaden">{{strbonus}}</div></td> </tr> {{/strbonus}} {{#bonus_damage}} <tr> <td><div class="sheet-rolltemplate-section-schaden">Bonusdamage</div></td> <td><div class="sheet-rolltemplate-section-schaden">{{bonus_damage}}</div></td> </tr> <tr> <td><div class="sheet-rolltemplate-section-schaden"><b>Damage</b></div></td> <td><div class="sheet-rolltemplate-section-schaden"><b>{{damage_roll}}</b></div></td> </tr> {{/bonus_damage}} {{/damage_roll}} {{#description}} <tr><td colspan="2"><div class="sheet-rolltemplate-spacer"> </div></td></tr> <tr><td colspan="2"><div class="sheet-rolltemplate-sectionheading-description"><b>Description</b></div></td></tr> <tr> <td colspan="2"><div class="sheet-rolltemplate-description">{{description}}</div></td> </tr> {{/description}} </table> </rolltemplate> I've tried different things with replacing the regular critical check with {{roll1=1d10}} {{roll2=1d10}} and various permutations. And then I even tried to use JavaScript. Not exactly this <script type="text/worker"> function compareRolls() { const roll1 = [[1d10]]; const roll2 = [[1d10]]; const totalroll = results.results.roll1.result +@{strbonus}+?{Modifikator}+ [[ @{malus} ]] const isDoubles = roll1 === roll2; document.getElementById('result').innerHTML = `Roll 1: ${roll1} <br> Roll 2: ${roll2} <br> Total: ${total} <br> Doubles: ${isDoubles ? 'Yes' : 'No'}`; } </script> I just don't understand how variables are passed and calculated between JS and HTML even with my limited coding experience. What I am trying to achieve in the Chat window: 1. Show each die roll. or 2. Post alert "Critical Rolled" when doubles are rolled. or both.
1725588385
GiGs
Pro
Sheet Author
API Scripter
What you asking for cannot be done through normal roll20 dice rolls. You could do something like what you want with a Mod Script (to analyse the roll and create custom output) or Custom Roll Parsing (which is a sheet worker plus a custom roll template - yours can be used but probably needs a few changes).
I'm not sure how useful this is for your sheet, but conditionally showing text on doubles is doable with some template tech. Here's two examples using different methods: &{template:default} {{[0](#)=Critical}}{{[1](#)=}} {{[[[{[[1d10]],[[1d10]]}mt]]](#)= $[[0]]+$[[1]][eraser](#" style=" display:none; class="showtip" title=)}} &{template:default} $[[$[[2]]]] [[[ [[ {[[1d10]],[[1d10]]}mt * 3 ]] ]]] {{=$[[0]]+$[[1]]}} [[[0 [[0]] {{=$[[0]]+$[[1]] Critical!}} {{Bonus Section}}]]]
1725622588
GiGs
Pro
Sheet Author
API Scripter
I havent looked closely at your example, Tuo, but dies it account for the fact that OP wants to show text on doubles and generate a normal total and use that in a different way? That's why I said it couldn't be done - you can't use yje same roll in two different ways.
1725627158
Finderski
Pro
Sheet Author
Compendium Curator
As GiGs mentioned, Custom Roll Parsing is probably the easiest. If you'd rather not use Custom Roll, you can probably  do it with Roll Template Helper functions, but it's going to be be tedious and complex.  You'd need to use two different rolls instead of just a 2dX type format, and then in your Crit Check area of the roll template, you'd need to start doing thing like... {{#rollTotal() roll1 1}}{{#rollTotal() roll2 1}}You got a Crit!{{/rollTotal() 2 1}}{{/rollTotal() roll1 1}} And then you'd have to do that for every possible number.