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.
After trying to figure out how to implement your suggestions in to my character sheet so I could learn. I realize I just don't have enough of an understanding between roll20 html and jscript. Is anyone willing to add this function to my character sheet for $20?
1727311511

Edited 1727311576
GiGs
Pro
Sheet Author
API Scripter
Maybe. Does your first post describe what you need: 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. If so, what dice is rolled (is it always 2d10?), and how do you determine success or failure? Does this matter for displaying Criticals? What does a typical roll use, and what are all the roll20 attribute names? The rolltemplate seems to have a bunch of rows - what are they all for?
Hi GiGs, Thanks for your consideration. Yes, the original post is correct. Also, it is a roll LOW system to succeed. Here is a quote from the system: To successfully use an attribute or skill, a character must roll equal to or less than his skill score on 2d10. This target number may be modified by the GM to reflect any of several different factors (described below). A roll of 2 always succeeds and a roll of 20 always fails regardless of the final adjusted target number. The relative complexity or amount of precision needed to accomplish a task is reflected in its Difficulty Modifier. Consult the table below: Difficulty: Modifier: Near Impossible -8, Formidable -4, Challenging -2, Difficult 0, Routine +2, Easy +4, Simple +8 Typically the target number is the Attribute + Skill Level (generally in the 10-20 range). The roll20 sheet HTML was converted from&nbsp; Arcane Codex character sheet written in German, so I don't really know exactly. But as I understand the rolltemplates are to include modifiers for various items and weapons towards the total Target Number. Here is the link to my gitHUB repository: yasashiitora/Bethorm and my roll20 campaign test game: <a href="https://app.roll20.net/join/18054320/qkIa1g" rel="nofollow">https://app.roll20.net/join/18054320/qkIa1g</a>
1727410081

Edited 1727471086
GiGs
Pro
Sheet Author
API Scripter
I'd use Custom Roll Parsing to solve this problem, but CRP replaces your existing roll buttons with action buttons and replaces the existing rolls. It can use the existing roll template. Your rolls are very complex, the rolltemplate has a LOT of things in it. {{wurt1}} to {{wurt10}} and the _num versions, {{swurt1-3}}, {{cause_damage}} and many more. Are any of those things relevant to the roll?
characteristics, attributes and traits are used interchangeably. "wert" translates to&nbsp; "value" wert1 =&nbsp; characteristic(trait bonus)&nbsp; values or skill value or initiative or Attack value or Total bonus wert2 = weapon bonus value or trait bonus&nbsp;&nbsp; wert3 = burden value (negative) or Range value wert4 = load time value wert5 = burden value or inputted modifier wert6 = magic food wert7 = time required wert8 = range wert9 = spell duration wert10= burden value Looks like the "wert" variables are placeholders depending on what&nbsp; basic task roll &nbsp;is being rolled. Many of these are being outputted to the chatbox for player info. YES, they are relevant to the basic task roll. The "swert" series are related to weapon information which gets displayed in the chatbox. Therefore, these variables are not needed for basic task rolls. but will be included in the output.