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

[BUG] Negative Values in Attributes When Used for Subtraction Causes Uncaught SyntaxError

1385525069

Edited 1385525975
Sam
Sheet Author
I was working with a macro today and wondering why it wasn't working at all. I would click on the roll button but nothing would happen. So my programmer side kicked in and I started looking to see what was happening. I experimented by removing sections of the macro until I got it working again and then built it up little by little until it broke again. What I found was when you have an attribute and supply it with a negative value and then use that attribute in a roll or inline roll with a subtraction operator then it fails and in chrome's inspector window's console a Uncaught SyntaxError: Unexpected number occurs. For the more visual people this is what I did. @{Kenshin|Power Attack} = -4 [[1d20 - @{Kenshin|Power Attack}]] or /r 1d20 - @{Kenshin|Power Attack} However, the system is successful at executing the roll while the attribute is still negative if you are doing addition as opposed to subtraction or if you explicitly surround the attribute in parentheses. [[1d20 + @{Kenshin|Power Attack}]] or /r 1d20 + @{Kenshin|Power Attack} or [[1d20 - (@{Kenshin|Power Attack})]] or /r 1d20 - (@{Kenshin|Power Attack}) It appears that when the attribute values are resolved and evaluated that parentheses are not automatically added in which then causes the error. In my opinion attributes should resolve to [[1d20 - (-4)]] as opposed to [[1d20 - -4]] which is how they appear to be resolving and which causes the Uncaught SyntaxError: Unexpected number . I know that it is easy to say "just always use addition" or "always use positive attributes and then do addition or subtraction in the roll" but if the attributes resolved to include parentheses around their values then it over comes any issues. System Specs: Operating System Windows Windows 7 Screen Resolution 1360 x 768 Web Browser Chrome 31.0.1650.57 Browser Size 1360 x 680 IP Address <deleted - Gauss> Color Depth 32 Javascript Enabled Flash Version 11.9.900 Cookies Enabled User Agent Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/31.0.1650.57 Safari/537.36
1385528534

Edited 1385528555
Gauss
Forum Champion
Thank you for reporting this. It is a known bug. I will add your thread to the bug report.