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 conditionals based on attributes (not rolls)

1608626283
Richard
Pro
Marketplace Creator
Sheet Author
API Scripter
Compendium Curator
Hi folks, I'm trying to modify a roll template to include text conditionally based on a numerical range of a passed attribute. In Dungeon Crawl Classics, if you have 5 Stamina or lower, you take double damage from poison. I'd like to put this as a reminder when a Fortitude save is made: <rolltemplate class="sheet-rolltemplate-fortsave"> <div>Fort save: {{savingthrow}}</div> {{#stamina <= 5}} <div>Stamina is less than 5! Take double damage from poison</div> {{/stamina <= 5}} </rolltemplate> But I can't seem to find an operator to make it work. I thought maybe in the roll itself we could perform the test and pass the result: <button type="roll" name="roll_fortsave" value="&{template:fortsave} {{savingthrow=[[1d20]]}} {{isStaminaLow=@{stamina} <= 5}}> Fort Save </button> And then operate on whether the attribute is present or not: <rolltemplate class="sheet-rolltemplate-fortsave"> <div>Fort save: {{savingthrow}}</div> {{#isStaminaLow}} <div>Stamina is less than 5! Take double damage from poison</div> {{/isStaminaLow}} </rolltemplate> (I know what I've written above exactly isn't possible; it illustrates what I'm trying to achieve) Is there some way I could do this? 
1608628901

Edited 1608629157
Oosh
Sheet Author
API Scripter
I'm not a sheet author, so take this with a grain of salt: I think those helper functions need an actual inline roll. So if you edit your second attempt there but with: {{isStaminaLow=[[@{stamina}]]}} and then {{#rollLess() isStaminaLow 5}} <div>Stamina is less than 5! Take double damage from poison</div> {{/rollLess() isStaminaLow 5}} ... I think that should work? I can't remember if those helpers are "less than" or "less than or equal to" ... you may need to change it to 4. Whether or not the helper function works on a property which is sent from a roll button but not defined in the template, I have no idea. You're about to find out though!
1608630845
Richard
Pro
Marketplace Creator
Sheet Author
API Scripter
Compendium Curator
Thank you Oosh! You are right. That worked! my problem was I was reading the out of date docs on the wiki, not the newer ones on zendesk. The old ones state that the `rollLess` etc functions only work on the first inline roll. Cheers!
1608648805
Andreas J.
Forum Champion
Sheet Author
Translator
Richard said: my problem was I was reading the out of date docs on the wiki , not the newer ones on zendesk. The old ones state that the `rollLess` etc functions only work on the first inline roll. The Character sheet creation documentation on the Community Wiki is categorically superior than the one available on zendesk , and don't think there exist anything on zendesk that isn't on the community wiki(when it comes to character sheets). Can you point out exactly where there is an discrepancy between them, where community wiki page is incorrect? Zendesk version on Char Sheet is basically a 6month old copy of Community Wiki stuff, missing tons of things added there since. Zendesk is good for general Roll20 use and features, but not for character sheet creation or in-depth/comprehensive macro creation . The community collaborates and updates those parts of the wiki every now and then, while the zendesk side is only updated if new features are added. You can take my word on this, as even the Zendesk page for Building Char Sheets credits me as a major contributor to those pages, and I's saying they are now a pale copy,  as those pages don't keep up with the community updates. If you actually took any amount of time to compare any two page on Char sheet Creation between the two, you should clearly see that the community wiki version has more info.
1608680253
Oosh
Sheet Author
API Scripter
I think OP has just slightly misunderstood what it says: Note: All helper functions will only check the first inline roll found in a property. Maybe they read that as "first inline roll found in a template"?
1608715880
Richard
Pro
Marketplace Creator
Sheet Author
API Scripter
Compendium Curator
Oosh said: I think OP has just slightly misunderstood what it says: Note: All helper functions will only check the first inline roll found in a property. Maybe they read that as "first inline roll found in a template"? This is 100% correct, and is what I was thinking when I asked my question, combined with me being totally oblivious to the parameter passed to the function call (ie. `rollname` in `{{#rollWasFumble() <rollname>}}`). ᐰndreas J. said: The Character sheet creation documentation on the Community Wiki is categorically superior than the one available on zendesk , and don't think there exist anything on zendesk that isn't on the community wiki(when it comes to character sheets). Can you point out exactly where there is an discrepancy between them, where community wiki page is incorrect? Zendesk version on Char Sheet is basically a 6month old copy of Community Wiki stuff, missing tons of things added there since. Zendesk is good for general Roll20 use and features, but not for character sheet creation or in-depth/comprehensive macro creation . The community collaborates and updates those parts of the wiki every now and then, while the zendesk side is only updated if new features are added. You can take my word on this, as even the Zendesk page for Building Char Sheets credits me as a major contributor to those pages, and I's saying they are now a pale copy,  as those pages don't keep up with the community updates. If you actually took any amount of time to compare any two page on Char sheet Creation between the two, you should clearly see that the community wiki version has more info. Thank you for the explanation - that is the opposite of what I had expected! But I see no discrepancy now, just a lack of reading comprehension on my behalf :) Thank you for clearing it up