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

Roll template that triggers on changing number

1590438708
Eli N.
Pro
Compendium Curator
So currently I have my attack and defense rolls set up like 1d20cs>19cf19 to recognize when a 20, 19 or 1 are rolled. The template also states "fumble" or "critical" or "near perfect hit".  However there is also a thing called fatigue. Where if a defense roll naturally rolls a 1 or under the fatigue score then the character has gotten fatigued. This is how it currently looks.          {{#def_roll}}             <tr><td><span class="tcat">Defense Roll: </span>{{def_roll}}</td></tr>             {{#rollWasCrit() def_roll}}{{#^rollWasFumble() def_roll}}                     <tr><td><span class="tcat">Perfect Defense!</span></td></tr>             {{/^rollWasFumble() def_roll}}{{/rollWasCrit() def_roll}}                          {{#rollWasCrit() def_roll}}{{#rollWasFumble() def_roll}}                     <tr><td><span class="tcat">Near-Perfect Defense!</span></td></tr>             {{/rollWasFumble() def_roll}}{{/rollWasCrit() def_roll}}                      {{#rollWasFumble() def_roll}}{{#^rollWasCrit() def_roll}}                 <tr><td><span class="tcat">Fumble!</span></td></tr>             {{/^rollWasCrit() def_roll}}{{/rollWasFumble() def_roll}}         {{/def_roll}} So how do I modify this template so that if it rolls under fatigue (which can change during combat) it says "fatigue gained" 
1590439262
GiGs
Pro
Sheet Author
API Scripter
If fatigue is a different thing from fumbling, you will probably need to have that entered in the roll, adding something like {{fatigue=[[1]]}}  Then in the rolltemplate, you can use {{#^rollGreater() def_roll fatigue}}     fatigue gained {{/^rollGreater() def_roll fatigue}} Exactly where you place it and what styling to use, I'll leave you to figure out, but this will compare def_roll against the fatigue target, and if it is equal or less, it will show the fatigue gained text.
1590439618
Eli N.
Pro
Compendium Curator
And this will trigger on the natural dice roll and not on the total of the dice roll and it's bonuses? 
1590440316
GiGs
Pro
Sheet Author
API Scripter
Not by default, no. You;ll have to construct it in the roll macro to do that. Without seeing your macro, it's hard to say excatly how to do it so here is a simple example. Say your standard roll is d20+@{BAB}+@{strength}, and the fatigue target is 3,  {{def_roll=[[d20+@{BAB}+@{strength}]]}} {{fatigue=[[3+@{BAB}+@{strength}]]}} By adding the same bonuses to the fatigue threshold as apply on the attack, you effectively get the natural roll.
1590440582
Eli N.
Pro
Compendium Curator
My defense roll currently looks like this <div class="sheet-col-1-16"><button type='roll' name='roll_weapon_defense' value='&{template:hm_std} {{name=@{character_name} defends!!}}{{def_roll=[[ @{defence_dice} +@{weapon_defense_mod_total}]]}} {{dr=[[@{dr}]]}} {{sdr=[[@{shield_dr}]]}}'>DEF</button></div> The current fatigue is just an attribute called current_fatigue.  So you are proposing adding a line to the defense roll that says {{Fatigue= @{current_fatigue}}} Is there anyway to hide that? 
1590442853

Edited 1590444772
Eli N.
Pro
Compendium Curator
I guess I am just a little confused as to where this goes {{#^rollGreater() def_roll fatigue}} &nbsp; &nbsp; fatigue gained {{/^rollGreater() def_roll fatigue}} The full roll template I have is&nbsp; &lt;rolltemplate class="sheet-rolltemplate-hm_std"&gt; &nbsp; &nbsp; &lt;table&gt; &nbsp; &nbsp; &nbsp; &nbsp; {{#name}}&lt;tr&gt;&lt;th&gt;{{name}}&lt;/th&gt;&lt;/tr&gt;{{/name}} &nbsp; &nbsp; &nbsp; &nbsp; {{#weapon}}&lt;tr&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;td&gt;&lt;span class="tcat"&gt;Weapon: &lt;/span&gt;{{weapon}}&lt;/td&gt; &nbsp; &nbsp; &nbsp; &nbsp; &lt;/tr&gt;{{/weapon}} &nbsp; &nbsp; &nbsp; &nbsp; &lt;tr&gt;&lt;td&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {{#speed}}&lt;span class="tcat"&gt;Speed: &lt;/span&gt;{{speed}}{{/speed}} &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {{#reach}}&lt;span class="tcat"&gt;Reach: &lt;/span&gt;{{reach}}{{/reach}} &nbsp; &nbsp; &nbsp; &nbsp; &lt;/td&gt;&lt;/tr&gt; &lt;!-- Roll dice in the form of 1d20cs&gt;19cf19 for nat19 detection. --&gt; &nbsp; &nbsp; &nbsp; &nbsp; {{#atk_roll}} &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;tr&gt;&lt;td&gt;&lt;span class="tcat"&gt;Attack Roll: &lt;/span&gt;{{atk_roll}}&lt;/td&gt;&lt;/tr&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {{#rollWasCrit() atk_roll}}{{#^rollWasFumble() atk_roll}} &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;tr&gt;&lt;td&gt;&lt;span class="tcat"&gt;Critical Hit!&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {{/^rollWasFumble() atk_roll}}{{/rollWasCrit() atk_roll}} &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {{#rollWasCrit() atk_roll}}{{#rollWasFumble() atk_roll}} &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;tr&gt;&lt;td&gt;&lt;span class="tcat"&gt;Near-Perfect Attack!&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {{/rollWasFumble() atk_roll}}{{/rollWasCrit() atk_roll}} &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {{#rollWasFumble() atk_roll}}{{#^rollWasCrit() atk_roll}} &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;tr&gt;&lt;td&gt;&lt;span class="tcat"&gt;Fumble!&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {{/^rollWasCrit() atk_roll}}{{/rollWasFumble() atk_roll}} &nbsp; &nbsp; &nbsp; &nbsp; {{/atk_roll}} &nbsp; &nbsp; &nbsp; &nbsp; {{#def_roll}} &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;tr&gt;&lt;td&gt;&lt;span class="tcat"&gt;Defense Roll: &lt;/span&gt;{{def_roll}}&lt;/td&gt;&lt;/tr&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {{#rollWasCrit() def_roll}}{{#^rollWasFumble() def_roll}} &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;tr&gt;&lt;td&gt;&lt;span class="tcat"&gt;Perfect Defense!&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {{/^rollWasFumble() def_roll}}{{/rollWasCrit() def_roll}} &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {{#rollWasCrit() def_roll}}{{#rollWasFumble() def_roll}} &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;tr&gt;&lt;td&gt;&lt;span class="tcat"&gt;Near-Perfect Defense!&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {{/rollWasFumble() def_roll}}{{/rollWasCrit() def_roll}} &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {{#rollWasFumble() def_roll}}{{#^rollWasCrit() def_roll}} &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;tr&gt;&lt;td&gt;&lt;span class="tcat"&gt;Fumble!&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {{/^rollWasCrit() def_roll}}{{/rollWasFumble() def_roll}} &nbsp; &nbsp; &nbsp; &nbsp; {{/def_roll}} {{#damage}} &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;tr&gt;&lt;td&gt;&lt;span class="tcat"&gt;Damage Roll: &lt;/span&gt;{{damage}}&lt;img src="<a href="https://i.imgur.com/N8POrfv.png&quot;&gt;&lt;/td&gt;&lt;/tr" rel="nofollow">https://i.imgur.com/N8POrfv.png"&gt;&lt;/td&gt;&lt;/tr</a>&gt; &nbsp; &nbsp; &nbsp; &nbsp; {{/damage}} {{#dr}} &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;tr&gt;&lt;td&gt;&lt;span class="tcat"&gt;DR: &lt;/span&gt;{{dr}}{{#sdr}} + {{sdr}}&lt;img src="<a href="https://i.imgur.com/AYeAO4C.png&quot;&gt;{{/sdr}}&lt;/td&gt;&lt;/tr" rel="nofollow">https://i.imgur.com/AYeAO4C.png"&gt;{{/sdr}}&lt;/td&gt;&lt;/tr</a>&gt; &nbsp; &nbsp; &nbsp; &nbsp; {{/dr}} &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {{#allprops() name weapon speed reach atk_roll def_roll damage dr sdr}} &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;tr&gt;&lt;td&gt;&lt;span class="tcat"&gt;{{key}}: &lt;/span&gt;{{value}}&lt;/td&gt;&lt;/tr&gt; &nbsp; &nbsp; &nbsp; &nbsp; {{/allprops() name weapon speed reach atk_roll def_roll damage dr sdr}} &nbsp; &nbsp; &lt;/table&gt; &lt;/rolltemplate&gt;
1590504124
GiGs
Pro
Sheet Author
API Scripter
Eli N. said: My defense roll currently looks like this &lt;div class="sheet-col-1-16"&gt;&lt;button type='roll' name='roll_weapon_defense' value='&amp;{template:hm_std} {{name=@{character_name} defends!!}}{{def_roll=[[ @{defence_dice} +@{weapon_defense_mod_total}]]}} {{dr=[[@{dr}]]}} {{sdr=[[@{shield_dr}]]}}'&gt;DEF&lt;/button&gt;&lt;/div&gt; The current fatigue is just an attribute called current_fatigue.&nbsp; So you are proposing adding a line to the defense roll that says {{Fatigue= @{current_fatigue}}} Is there anyway to hide that?&nbsp; There's no way to hide it, but it doesnt get printed to chat unless you make the rolletemplate it print it. Roll template buttons often have lots of things in them that aren't seen by the user. I guess I am just a little confused as to where this goes {{#^rollGreater() def_roll fatigue}} &nbsp; &nbsp; fatigue gained {{/^rollGreater() def_roll fatigue}} This works exactly like your rollwasCrit and rollWasFumble sections of the rolltemplate. I cant tell you where to put it because I dont know how or where you want it to appear in the output. I only used def_roll because that was visible in your code earlier. Maybe you want a different fatigue score for each of def and att, i don't know. But if it's just for defence, it looks like it would go in here (with the styling to match the others): &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{{#def_roll}} &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;tr&gt;&lt;td&gt;&lt;span class="tcat"&gt;Defense Roll: &lt;/span&gt;{{def_roll}}&lt;/td&gt;&lt;/tr&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {{#rollWasCrit() def_roll}}{{#^rollWasFumble() def_roll}} &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;tr&gt;&lt;td&gt;&lt;span class="tcat"&gt;Perfect Defense!&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {{/^rollWasFumble() def_roll}}{{/rollWasCrit() def_roll}} &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {{#rollWasCrit() def_roll}}{{#rollWasFumble() def_roll}} &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;tr&gt;&lt;td&gt;&lt;span class="tcat"&gt;Near-Perfect Defense!&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {{/rollWasFumble() def_roll}}{{/rollWasCrit() def_roll}} &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {{#rollWasFumble() def_roll}}{{#^rollWasCrit() def_roll}} &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;tr&gt;&lt;td&gt;&lt;span class="tcat"&gt;Fumble!&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {{/^rollWasCrit() def_roll}}{{/rollWasFumble() def_roll}} &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{{#^rollGreater() def_roll fatigue}} &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;tr&gt;&lt;td&gt;&lt;span class="tcat"&gt;Fatigue Gained!&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{{/^rollGreater() def_roll fatigue}} &nbsp; &nbsp; &nbsp; &nbsp; {{/def_roll}}
1590507534
Eli N.
Pro
Compendium Curator
So I added that bit to the rolltemplate, and it definitely worked. I tried to include the fatigue in the roll but only as a whisper and it failed. There is no way to hide it anywhere?&nbsp;
1590509820
GiGs
Pro
Sheet Author
API Scripter
You need to add it to allprops at the end of the rolltemplate &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{{#allprops() name weapon speed reach atk_roll def_roll damage dr sdr fatigue}} &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;tr&gt;&lt;td&gt;&lt;span class="tcat"&gt;{{key}}: &lt;/span&gt;{{value}}&lt;/td&gt;&lt;/tr&gt; &nbsp; &nbsp; &nbsp; &nbsp; {{/allprops() name weapon speed reach atk_roll def_roll damage dr sdr fatigue}} Any things in the section dont get printed.
1590521319
Eli N.
Pro
Compendium Curator
Awesome thanks!
1590521455
GiGs
Pro
Sheet Author
API Scripter
you're welcome :)