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 .
×
If you opened a D&D 2024 character on July 17 between 2:20 PM ET and 4:40 PM ET, and now see that your character data is missing/blank, please make a copy of your game and perform a rollback. Rollbacks have been enabled for all users during this period.
Create a free account

Rolltemplate acting weird

1749055911

Edited 1749056172
Fred
Pro
Hello fellows Roll20ers !  I noticed that my sheet rolltemplate is acting weird and. To make it short, the rolltemplate displays wrong results when it comes to the quality of success / failure : a d100 is rolled and if the result is 30 or less below the target, it's a special success, if it's 30 or above the target, it's a special failure. (Example : if the target is 50,  a roll of 80 or above is a special failure, a roll of 20 or below is a special success. Below is the code of the button and the rolltemplate               Button :    <div class="thead"><button type="roll" class="bcar" name="COM" title="Jet d'habileté" value="&{template:tmpl} {{pc=@{character_name}}} {{name=Habileté (HAB)}} {{roll=[[1d100]]}} {{target=[[@{HAB}+(?{Bonus(+)/Malus(-)|0})[Bonus/Malus]]]}} {{E30=[[@{HAB}+(29)+(?{Bonus(+)/Malus(-)|0})[Bonus/Malus]]]}} {{R30=[[@{HAB}-(29)+(?{Bonus(+)/Malus(-)|0})[Bonus/Malus]]]}}">HAB</button></div> Rolltemplate :  <rolltemplate class="sheet-rolltemplate-tmpl">   <div class="tplmain">      <div class="pc">{{name}}</div>      <div style="display: table;">   {{#target}}         <div style="display: table-row;">            <div class="jet"><span style="font-family: dicefontd10;font-size: x-large;">t</span> {{roll}} ≤ {{target}} <span style="font-size: larger;">➔</span></div>            <div class="jet">             {{#rollGreater() roll target}}                 <span class="failure">Échec</span>                 {{/rollGreater() roll target}}               {{#rollGreater() roll E30}}               <span class="failure">30+</span>               {{/rollGreater() roll E30}}                {{#rollTotal() roll target}}                 <span class="success">Réussite</span>                 {{/rollTotal() roll target}}                 {{#rollLess() roll target}}                 <span class="success">Réussite</span>                 {{/rollLess() roll target}}             {{#rollLess() roll R30}}               <span class="success">30+</span>               {{/rollLess() roll R30}}                         <div class="jet" style="display: table-row;">          {{#rollTotal() roll 10}}         <span class="special">Critique !</span>        {{/rollTotal() roll 10}}  {{#rollTotal() roll 20}}         <span class="special">Critique !</span>        {{/rollTotal() roll 20}}  {{#rollTotal() roll 30}}         <span class="special">Critique !</span>        {{/rollTotal() roll 30}}  {{#rollTotal() roll 40}}         <span class=pecial">Critique !</span>        {{/rollTotal() roll 40}}         {{#rollTotal() roll 50}}         <span class="special">Critique !</span>        {{/rollTotal() roll 50}}          {{#rollTotal() roll 60}}         <span class="special">Critique !</span>        {{/rollTotal() roll 60}}          {{#rollTotal() roll 70}}         <span class="special">Critique !</span>        {{/rollTotal() roll 70}}          {{#rollTotal() roll 80}}         <span class="special">Critique !</span>        {{/rollTotal() roll 80}}          {{#rollTotal() roll 90}}         <span class="special">Critique !</span>        {{/rollTotal() roll 90}}          {{#rollTotal() roll 100}}         <span class="special">Critique !</span>        {{/rollTotal() roll 100}}          </div>         </div>           </div>         {{/target}}     </div>      <div class="jetnom">{{pc}}</div>   </div> </rolltemplate> But  I'm pretty sure it's not related to the code, because 1) it has been working flawlessly for months and 2) the same roll score will display different results in a few minutes !  Below are screenshots taken in the same game, same sheet, same button :  It displays a Failure 30+ which is wrong because 74 is not 30 above the target (50) 2 minutes later, I roll another 74 and here is the result : normal failure, which is correct : 
1749060705

Edited 1749060753
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
Not sure if it's causing this issue as I'm not sure what code changes you may have made in between those two rolls, but you have a syntax error in your html. This section: {{#rollTotal() roll 40}} <span class=pecial">Critique !</span> {{/rollTotal() roll 40}} is missing a quotation mark at the start of the class (and the s in special). This could cause various issues with the resolution of the roll template.
1749062441

Edited 1749063745
Fred
Pro
Thank you Scott, well spotted. It turns out it's a fumble in my forum copy paste, the sheet code has no typo :  {{#rollTotal() roll 40}}         <span class="special">Critique !</span>        {{/rollTotal() roll 40}} As per code changes between the two rolls : there were none, same code, same sheet, same campaign, same game session. I just rolled until an incorrect result was displayed, and then rolled again until I rolled exactly the same score...and it displayed a different result.
1749064622
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
hmm, ok then. There's nothing wrong in your roll template or button, so that leads me to think that there might be an issue with the attributes being called or some other thing that's causing an issue with the roll resolution. Let's try to narrow down where the 30+ is coming from exactly. Can you change the two versions of it (the greater and less) to specify which one they are? e.g. something like E30+ and R30+ as their respective texts?
1749065126

Edited 1749065213
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
Also, can you add display of the E30 and R30 fields to the template so that you can easily see what they resolved to? EDIT: And a second thing, if you clear the inspector console log, and then run the tests, do you get any errors showing up there?
1749111080

Edited 1749111613
Fred
Pro
Thanks Scott, I modified the code so it displays the information needed, in bold below. It now displays Target/E30/R30 and, if it's a special result (30+), whether it's a E30+ or a R30+  <rolltemplate class="sheet-rolltemplate-tmpl">   <div class="tplmain">      <div class="pc">{{name}}</div>      <div style="display: table;">   {{#target}}         <div style="display: table-row;">            <div class="jet"><span style="font-family: dicefontd10;font-size: x-large;">t</span> {{roll}} ≤ {{target}} {{R30}} {{E30}} <span style="font-size: larger;">➔</span></div>            <div class="jet">             {{#rollGreater() roll target}}                 <span class="failure">Échec</span>                 {{/rollGreater() roll target}}               {{#rollGreater() roll E30}}               <span class="failure"> E 30+</span>               {{/rollGreater() roll E30}}                {{#rollTotal() roll target}}                 <span class="success">Réussite</span>                 {{/rollTotal() roll target}}                 {{#rollLess() roll target}}                 <span class="success">Réussite</span>                 {{/rollLess() roll target}}             {{#rollLess() roll R30}}               <span class="success"> R 30+</span>               {{/rollLess() roll R30}}                         <div class="jet" style="display: table-row;">          {{#rollTotal() roll 10}}         <span class="special">Critique !</span>        {{/rollTotal() roll 10}}  {{#rollTotal() roll 20}}         <span class="special">Critique !</span>        {{/rollTotal() roll 20}}  {{#rollTotal() roll 30}}         <span class="special">Critique !</span>        {{/rollTotal() roll 30}}  {{#rollTotal() roll 40}}         <span class="special">Critique !</span>        {{/rollTotal() roll 40}}         {{#rollTotal() roll 50}}         <span class="special">Critique !</span>        {{/rollTotal() roll 50}}          {{#rollTotal() roll 60}}         <span class="special">Critique !</span>        {{/rollTotal() roll 60}}          {{#rollTotal() roll 70}}         <span class="special">Critique !</span>        {{/rollTotal() roll 70}}          {{#rollTotal() roll 80}}         <span class="special">Critique !</span>        {{/rollTotal() roll 80}}          {{#rollTotal() roll 90}}         <span class="special">Critique !</span>        {{/rollTotal() roll 90}}          {{#rollTotal() roll 100}}         <span class="special">Critique !</span>        {{/rollTotal() roll 100}}          </div>         </div>           </div>         {{/target}}     </div>      <div class="jetnom">{{pc}}</div>   </div> </rolltemplate> and then made some rolls until an incorrect result appeared (that's more or less 40 rolls). On this screenshot we see that the 3rd roll (42) is incorrect : for some reason, both the E30 and R30 calculations are off.
1749133662
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
Hmm, interesting. What shows up when you hover over the e30 and r30 numbers in the incorrect one?
It shows  : Rolling 35-(29)+()[Bonus/Malus]=35  and :  Rolling 35+(29)+()[Bonus/Malus]=35 compared to a correct display, it should display : Rolling 35-(29)+()[Bonus/Malus]=35-(29)+(0) or   Rolling 35-(29)+()[Bonus/Malus]=35-(29)+(0) I also checked the browser inspector, here's how an incorrect display compares to a correct display :  Normal 0 21 false false false FR X-NONE X-NONE /* Style Definitions */ table.MsoNormalTable {mso-style-name:"Tableau Normal"; mso-tstyle-rowband-size:0; mso-tstyle-colband-size:0; mso-style-noshow:yes; mso-style-priority:99; mso-style-parent:""; mso-padding-alt:0cm 5.4pt 0cm 5.4pt; mso-para-margin-top:0cm; mso-para-margin-right:0cm; mso-para-margin-bottom:8.0pt; mso-para-margin-left:0cm; line-height:107%; mso-pagination:widow-orphan; font-size:11.0pt; font-family:"Aptos",sans-serif; mso-ascii-font-family:Aptos; mso-ascii-theme-font:minor-latin; mso-hansi-font-family:Aptos; mso-hansi-theme-font:minor-latin; mso-font-kerning:1.0pt; mso-ligatures:standardcontextual; mso-fareast-language:EN-US;} incorrect : <span class="inlinerollresult showtip tipsy-n-right" original-title="Rolling 35-(29)+()[Bonus/Malus] = 35">35</span>   correct : <span class="inlinerollresult showtip tipsy-n-right" original-title="Rolling 35-(29)+(0)[Bonus/Malus] = 35-(29)+(0)">6</span> I suspect that the bug might occur when I make a fast succession of rolls : I click on the roll button then on Enter in the Mod (Bonus Malus) pop up window, which is set to zero by default. Maybe it's too fast and Roll20 misses the bonus malus input then bugs.  I can make a succession of rolls, but a bit slower, what do you think ?
1749146998

Edited 1749147046
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
Ok, so the problem is due to the roll query's default value getting wiped sometimes. This then makes for an invalid expression and the roll handler bails when it can't parse it and just returns the first number in the expression (35). There's a variety of ways to fix this, but the easiest is probably to just put a 0  in front of any calls to the roll query in the inline roll: <button type="roll" class="bcar" name="COM" title="Jet d'habileté" value="&{template:tmpl} {{pc=@{character_name}}} {{name=Habileté (HAB)}} {{roll=[[1d100]]}} {{target=[[@{HAB}+(?{Bonus(+)/Malus(-)|0})[Bonus/Malus]]]}} {{E30=[[@{HAB}+(29)+(0?{Bonus(+)/Malus(-)|0})[Bonus/Malus]]]}} {{R30=[[@{HAB}-(29)+(0?{Bonus(+)/Malus(-)|0})[Bonus/Malus]]]}}">HAB</button> This will fix the issue of someone accidentally entering just an empty string as the value of the roll query. When they do enter a valid number, it will just get a 0 before it, which won't have any effect on the value (e.g. 06 === 6). It will still be possible for the user to cause an error, but it will be much harder and require more than an accidental deletion of the default.
1749190642

Edited 1749190658
Fred
Pro
I did the changes and after a few tests (click-enter inputs at high speed), it looks like the problem is solved !  Thank you very much Scott !