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

Changing color in a roll template for a specific display

I have the following info : {{ margin = $[[1]] }}, resulting from a previous calculation I'm using rolltemplate-custom a little customized My pb is quite simple, i want to display the key/value in green when value is >=0, and in red when value <0 I have tried to use {{#rollGreater() margin -1}} and {{#rollLess() margin 0}} to be able to set the style color to green or red But it seems not working, may be because margin is not directly a roll result, or that margin is not anymore a number but a text now So there is probably another way to do :)
1612898245
GiGs
Pro
Sheet Author
API Scripter
Its most likely because roll template logic functions dont work with negative values for some bizarre reason.
1612903768

Edited 1612903936
JPL
Pro
Ok, i try the following       {{#margin}}         <span>victory</span>           {{/margin}} I got the victory message Then i reverse the -1 condition with the not like this       {{#rollLess() margin 0}}         <span>victory2</span>                 {{/rollLess() margin 0}}       {{^#rollLess() margin 0}}         <span>victory3</span>       {{/^rollLess() margin 0}} And that's the drama. Nothing print, and even worst, the other attributes disappear also, so code in bold makes the issue, which i dont' understand why reading the web doc Important to note also that the msg seems OK : {"content":" { ... $[[1]]]] {{roll=$[[0]]}} {{margin=$[[1]]}} ... <--- as wanted
1612904299
GiGs
Pro
Sheet Author
API Scripter
You have the caret ^ in the wrong place in one of these lines:     {{^#rollLess() margin 0}}         <span>victory3</span>       {{/^rollLess() margin 0}} It should be either     {{#^rollLess() margin 0}}         <span>victory3</span>       {{/^rollLess() margin 0}} or     {{^#rollLess() margin 0}}         <span>victory3</span>       {{^/rollLess() margin 0}} I can never remember which one is right without checking the documentation.
God ! So a problem between the keyboard and the chair :) Thanks for finding. I was in debugging mode and change to rollTotal that was working so i was becoming crazy :)