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

Specific roll template question about dependencies

1510493975
Matthew C
Pro
Sheet Author
Hey all, I hope I am asking this in the right place and I hope that this has not been answered I am trying to make a roll template for attacks on my game, BUT I only want certain parts to show up depending on the choices of the attack For example we have the ability to use offence for attacks that do damage, but if you have a debuff you do not have damage <rolltemplate class="sheet-rolltemplate-WAR">     <div style="font-size:120%;padding-top:5px;margin-left:18px;margin-top:15px;background: #091623 ; color: #85d6ff ; width: 175px ; text-align: center ; min-height: 22px ; max-height: 22px">     W.A.R.     </div> <table style="width:190px;min-height:30px">     <tbody>         <tr>         <th style="text-align:center">{{rollname}}         </th>         </tr> </tbody> </table> <table>     <tbody>         <tr>             <td style="width:50%">{{type}}:                 </td>                 <td style="padding-right:30px;padding-left: 0px;text-align:center">({{typevalue}})                 </td>             </tr>             <tr>         <td style="width:50%">Roll:         </td>         <td style="padding-right:30px;padding-left: 0px;text-align:center">({{roll}})                 </td>             </tr>             {{^type Affliction}}             <tr>         <td style="width:50%">{{damageorhealing}}         </td>         <td style="padding-right:30px;padding-left: 0px;text-align:center">({{damageorhealingvalue}})                 </td>             </tr>             {{/type Affliction}} </tbody> </table> <table> <tr>      <td class="template_value"> Result: </td> </tr> <tr>     <td>         {{#rollTotal() roll 1}}             +0 Manoeuvre and -1 defence against first attack before your turn.          {{/rollTotal() roll 1}}          {{#rollTotal() roll 2}}         +0 Manoeuvre         {{/rollTotal() roll 2}}          {{#rollTotal() roll 3}}         +1 Manoeuvre         {{/rollTotal() roll 3}}          {{#rollTotal() roll 4}}         +1 Manoeuvre          {{/rollTotal() roll 4}}          {{#rollTotal() roll 5}}         +2 Manoeuvre          {{/rollTotal() roll 5}}          {{#rollTotal() roll 6}}         +2 Manoeuvre          {{/rollTotal() roll 6}}          {{#rollTotal() roll 7}}         +2 Manoeuvre          {{/rollTotal() roll 7}}          {{#rollTotal() roll 8}}         +3 Manoeuvre          {{/rollTotal() roll 8}}          {{#rollTotal() roll 9}}         +3 Manoeuvre          {{/rollTotal() roll 9}}          {{#rollTotal() roll 10}}         +3 Manoeuvre and +1 offence on the first attack          {{/rollTotal() roll 10}}     </td> </tr> </table> <table>     <tbody>             <tr>         <td>Effects: {{description}}         </td>         </tr> </tbody> </table> </rolltemplate> Above is my current work in progress, the ^type Affliction tag is how I was hoping to work with it, but that did not work...any ideas? I am really hoping this will work, otherwise I am at a loss on how to handle this, and I really want roll templates :p
1510505395
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
The #FIELDNAME and ^FIELDNAME helper functions do not check for a specific value in that field, they only check to see if there is anything after the "=" in that field, even a space counts for this I believe. There are a couple ways to handle what you are trying to do. The 5e OGL sheet, and most sheets, use multiple flag fields to determine what to show (see the always, normal, and (dis)advantage fields in the ogl templates). This would be done via: {{#FIELDNAME}} Conditionally displayed content {{/FIELDNAME}} You can however do this using any of the helper functions, a la crit detection in most sheets. In my WIP Starfinder HUD, I'm using #rollGreater() to allow for conditional display of multiple attacks: {{#rollGreater() fullattack 1}} Show attack 2 {{/rollGreater() fullattack 1}} {{#rollGreater() fullattack 2}} Show attack 3 {{/rollGreater() fullattack 2}} ... Note that this requires that the fullattack field contain an inline roll. For your use case, I would recommend setting up your repeating attack sections to have a checkbox/couple of radio buttons for affliction or no affliction. Then have a field in your macro text that is just {{afflictionflag=@{affliction_checkbox}}}. If you go the radio button method, then you could do something like this for the html of the radio buttons: <input type='radio' name='attr_affliction_checkbox' value='' checked='checked'> <input type='radio' name='attr_affliction_checkbox' value='affliction'> And then the following roll template helper function setup: {{#affliction}} What to display when there is an affliction {{/affliction}} {{^affliction}} What to display when there is no affliction {{/affliction}} Hope that helps, Scott
1510505653
Matthew C
Pro
Sheet Author
I think you may have just helped me, I am using a option field so the player can choose if the attack is offence or affliction. I did not know I could just add in a flag like that. But if the value of offence is offence and the value of affliction is affliction than I could just use what you put as the helper function? Will be trying it the moment I can
1510506174

Edited 1510506419
Matthew C
Pro
Sheet Author
This is the part of the roll template I have. I need it to show nothing if BOTH harmful and affliction are chosen. Something if harmful but NOT affliction and something if NOT harmful             {{#Harmful}}{{#Affliction}}             {{/Affliction}}{{/Harmful}}             {{#Harmful}}{{^Affliction}}             <tr>         <td style="width:50%">{{damageorhealing}}         </td>         <td style="padding-right:30px;padding-left: 0px;text-align:center">({{damageorhealingvalue}})                 </td>             </tr>             {{/Affliction}}{{/Harmful}}             {{^Harmful}}             <tr>         <td style="width:50%">{{damageorhealing}}         </td>         <td style="padding-right:30px;padding-left: 0px;text-align:center">({{damageorhealingvalue}}) test                 </td>             </tr>             {{/Harmful}} value="&{template:WAR} {{rollname=@{Slot2Name}}} {{typeflag=@{Slot2Type}}} {{type=@{Slot2OffenceAffliction}}} {{typevalue=[[@{Slot2OffenceAfflictionValue}]]}} {{roll=[[1d10+[[@{Slot2OffenceAfflictionValue}]]]]}} {{damageorhealing=@{Slot2DamageHealing}}} {{damageorhealingvalue=[[@{Slot2Damage}]]}} {{result}} {{description=@{Slot2Options}}}"  This is the button value, unfortunately it did not work :( the result I got was the line from {{^Harmful}} no matter what I chose Below is the select html with the values <select style="border:transparent;background:transparent;width: 100% ; color: black; font-family:Verdana;font-size:100%" name="attr_Slot2Type"> <option value="Choose" selected>     Choose     </option> <option value="Weapon">     Weapon     </option> <option value="Shield">     Shield     </option> <option value="Harmful">     Harmful     </option> <option value="Beneficial">     Beneficial     </option> </select> <select style="border:transparent;background:transparent;width: 100% ; font-weight:bold;color: black;      font-family:Verdana;font-size:100%"     name="attr_Slot2OffenceAffliction"> <option value="Choose" selected>     Choose     </option> <option value="Offence">     Offence     </option> <option value="Affliction">     Affliction     </option> </select>
1510508172
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
Right, so the flags have to actually be fields in your roll template, so you need a harmful and affliction field that will have content or not depending on whether it is harmful or an affliction. You need a way to have those selects result in an empty field when the select is not the thing that the flag should react to.
1510508613
Matthew C
Pro
Sheet Author
Hmm,  a little confused as how to make that work, but something I was fiddling around with did seem to work (maybe a little bit of a detour :p) but by changing the values from strings to integers I can actually make them an inline roll and then just use the rollTotal() function and then just use the integer values as the roll lookup
1510509053
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
Yep, that works.
1510509489
Matthew C
Pro
Sheet Author
hmm, that seems to have broken the chat in the end...             {{#rollTotal() type2 3}}{{#rollTotal() type 2}}             {{/rollTotal() type 2}}{{/rollTotal() type2 3}}             {{#rollTotal() type2 3}}{{#^rollTotal() type 2}}             <tr>         <td style="width:50%">{{damageorhealing}}         </td>         <td style="padding-right:30px;padding-left: 0px;text-align:center">({{damageorhealingvalue}})                 </td>             </tr>             {{/rollTotal() type 2}}{{/rollTotal() type2 3}}             {{#^rollTotal() type2 3}}             <tr>         <td style="width:50%">{{damageorhealing}}         </td>         <td style="padding-right:30px;padding-left: 0px;text-align:center">({{damageorhealingvalue}}) test                 </td>             </tr>             {{/rollTotal() type2 3}} am I writing it down incorrectly?
1510513402
Matthew C
Pro
Sheet Author
Nevermind, I just found out that I was closing the fields incorrectly