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

Conditional rolltemplate lines

1614145416
Eric
Sheet Author
Hi, Is there a way to conditionally display a line in the rolltemplate depending on the value of an attribute? I know about the  {{#<property>}} , however I want to check if a attribute has a value greater than zero and if so then show a line.  For example, "wounds".  I want to show a line "You have x wounds" if the attr_wounds is greater than zero.   
1614180977

Edited 1614181000
Kraynic
Pro
Sheet Author
I'm not sure how you are working your wounds attribute, but if the entry is blank (not zero) when there are no wounds, then that property should be hidden in chat.
1614185348
Richard T.
Pro
Marketplace Creator
Sheet Author
Compendium Curator
I think if you output the attribute as a roll you can use {{#rollGreater()}} that displays sections based on roll results. 
1614190951

Edited 1614190975
In the roll button u need to put ur attribute between brackets: {{wounds=[[@{place-the-wound-attribute-here}]]} Then you will be abble to compare it inside roll template: {{#rollGreater() wounds 0}}     <span> :D </span> {{/#rollGreater() wounds 0}} This should work
1614233672
Eric
Sheet Author
Hey thanks, Kraynic ... your tip to have it as a blank is what works for me. Thanks to the other suggestions, however this wasn't an attribute being rolled against. I just needed this as an informational line, which using as a blank makes the {{#property}} work perfect.
1614247327
Finderski
Pro
Sheet Author
Compendium Curator
Eric said: Thanks to the other suggestions, however this wasn't an attribute being rolled against. I just needed this as an informational line, which using as a blank makes the {{#property}} work perfect. You'll still want to remember this tip, because there may be times when you want to display something if the value is greater than 0, or less than 5, etc. In that case, you can put the attribute in a roll (even though it's not a real roll and doesn't affect the game directly). Putting the attribute as a roll like ARNOLDO B shows allows you to do that with a roll template.
1614473213
Eric
Sheet Author
@Finderski ... your right.  Actually it turns out to be a better approach than blanking the attribute. Blanking it out caused me more workarounds whereas just have the zero value worked better. The reason I felt it wouldn't work is because I didn't understand how the attribute would be a roll, as you referred to it. I thought .. "my wounds not a roll". But now I realize that having the attribute  surrounded by square brackets makes it work with the roll helper functions. I did have to add a specific 'd' dice specifier, otherwise it would not work for me. {{wounded=[[d0+@{wounded}]]}} Wounded is a checkbox attribute with 0 or 1 value. If I didn't include the fake d0 then it didn't work. Either way, this is great now I understand this approach.  Thanks!