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.