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 .
×
Advertisement Create a free account

Roll Template

1609682332
Hey guys! Im having a little problems with my roll template and hope you can help me. So i have 2 modifying dices that i want to add to rolls, but only when a checkbox for each is checked.  So my problem is that i only want its show in the roll when the checkbox is ticked, but it always shows even when there is no value in edge_num or diff_num. So this is my roll template code for that section: {{#edge}}         {{#diff_num}}          < tr >< td >< div   class = "sheet-rolltemplate-spacer" >   </ div ></ td ></ tr >          < tr >< td >< div   class = "sheet-rolltemplate-sectionheading" > Modifiers </ div ></ td ></ tr >          < tr >               < td >< div   class = "sheet-rolltemplate-limit" > > Edge({{edge_num}}) </ div ></ td >          </ tr >          < tr >              < td >< div   class = "sheet-rolltemplate-limit" > > Difficulty({{diff_num}}) </ div ></ td >         </ tr >         {{/diff_num}}         {{/edge}}   And this is the part of my roll code with that part: {{edge=@{edge_dice}}}{{edge_num=@{edgeroll}}}{{diff=@{diff_dice}}}{{diff_num=[[@{diffroll}]]}} diffroll and edgeroll are the checkbox, and diff_dice and edge_dice are the what type of dice to use. Hope someone can help me out a little! Thanks!
1609711889
GiGs
Pro
Sheet Author
API Scripter
Which ones are the checkboxes, and what are the checkboxes possible values? You will probably need to use the logic rolltemplate helper functions. You can use rollGreater like {{#rollGreater() edge 0}}         {{#diff_num}}         <tr><td><div class="sheet-rolltemplate-spacer"> </div></td></tr>         <tr><td><div class="sheet-rolltemplate-sectionheading">Modifiers</div></td></tr>         <tr>              <td><div class="sheet-rolltemplate-limit">> Edge({{edge_num}})</div></td>         </tr>         <tr>             <td><div class="sheet-rolltemplate-limit">> Difficulty({{diff_num}})</div></td>        </tr>         {{/diff_num}} {{/rollGreater() edge 0}}   And then the above section will only show when edge is greater than 0.
1609714652

Edited 1609714732
Im just gonna split them up, because its 2 different modifiers. But they are identical. So i have a checkbox "attr_edgeroll", at the moment its the value off the dice type (1d6,1d8 ect) but it can also just be 1. It gets its value from "attr_edge_dice". What type off dice is selected in "attr_edge_dice" is what i wanna show in edge in my roll, when the checkbox is ticked. If that makes seens?  So i tried with #rollGreater, but i think i did it wrong... {{#rollGreater() edge 0}}          < tr >< td >< div   class = "sheet-rolltemplate-spacer" >   </ div ></ td ></ tr >          < tr >< td >< div   class = "sheet-rolltemplate-sectionheading" > Modifiers </ div ></ td ></ tr >          < tr >               < td >< div   class = "sheet-rolltemplate-limit" > > Edge({{edge_num}}) </ div ></ td >          </ tr > {{/rollGreater() edge 0}} And this in my roll: {{edge_num=@{edgeroll}}} Thanks a lot for helping me out!!
1609721551
GiGs
Pro
Sheet Author
API Scripter
Probably the above code should be using edge_num? Also, your checkbox ideally should have a value of 1. How the value is being set might be messing things up.
1610073034
.... Feel a little stupid that i didnt see that myself!  But thanks alot for the help!!