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

Rolltemplate Logic Functions not matching values 0 or below

1584140012
GiGs
Pro
Sheet Author
API Scripter
I'm having a weird issue on a character sheet I'm designing. A section looks like this {{#rollTotal() value -3}} 1 {{/rollTotal() value -3}} {{#rollTotal() value -2}} 2 {{/rollTotal() value -2}} {{#rollTotal() value -1}} 3 {{/rollTotal() value -1}} {{#rollTotal() value 0}} 4 {{/rollTotal() value 0}} {{#rollTotal() value 1}} 5  {{/rollTotal() value 1}} {{#rollTotal() value 2}} 6  {{/rollTotal() value 2}} {{#rollTotal() value 3}} 7  {{/rollTotal() value 3}} The positive numbers get displayed properly, but the 0 and below do not. Has anyone seen an issue like this before? I've checked the roll formula and  value  is being correctly calculated. If I have {{value}} in the template, it gets printed out properly even when value is 0 or below. It's just the logic functions are failing to match them if 0 or below. Is this a failing of the roll20 system? (I created an identical question in the character sheet forum, but realised I should be asking if it was a bug, so I reposted here.)
1586160880
GiGs
Pro
Sheet Author
API Scripter
Did this get missed? It's definitely a bug, and pretty easy to replicate. Just build a rolltemplate with logic that has to match values below 0.
I have not tested this (and maybe you have tried this already), but I wonder if enclosing the negative values in parentheses would help?
1586190514
GiGs
Pro
Sheet Author
API Scripter
Where do you mean to put the brackets? in the rolltemplate as above, or in the math expression that is being evaluated? I cant imagine why that would make a difference.
1586193423

Edited 1586193441
I was thinking in the template: {{#rollTotal() value (-3)}} 1 {{/rollTotal() value (-3)}} It's a longshot, hail mary, stab in the dark, but Roll20 does weird things sometimes. It may see the negative sign as an operand in an equation rather than part of the integer. The parens would make it explicit. Also, it is entirely possible that the roll templates cannot process negative numbers at all.
1586193867
GiGs
Pro
Sheet Author
API Scripter
I think they cant process negative numbers, but I'll give that a try when i get a chance. In the sheet where i had this problem, I added 10 to all the values so I didnt need to owrry about it, but anyone using the rolltemplate and seeing that +10 will find it weird.
Well, I tried parentheses, single quotes, double quotes, brackets, and braces, and none of them worked. I think your solution is the best workaround here, GiGs. Sounds like a nice enhancement request to suggest.
1586240860
GiGs
Pro
Sheet Author
API Scripter
Thanks for trying! I dont think an enhancements suggestion is the right call. This is a clear bug.