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

[MathOps] [Bug] Space sensitivity in subtraction

Just encountered this minor bug. Description MathOps only likes subtraction when there are spaces around the operator. Attempting a calculation using a minus sign with no space around it returns an erroneous value. This behavior is not reproducible with addition - that works either way. Expected Behavior Mathematical operations should be space-agnostic. "3-1" should work identically to "3 - 1". Steps to Reproduce Environment Character sheet: D&D 5e by Roll20 Mods installed: ChatSetAttr, MathOps Process 1. Create a character sheet and manually assign the character 100gp in the @{gp} attribute 2. Enter into chat the following command: !setattr --sel --gp|{& math @{selected|gp}+8} Works as expected: The character has 108gp. 3. Paste the exact same command into chat but change the addition operator to a subtraction operator !setattr --sel --gp|{& math @{selected|gp}-8} Doesn't work. It sets @{gp} to the string "{& math 108-8}" 4. Manually reset the @{gp} attribute to 100 5.  Enter the previous command but add space around the operator !setattr --sel --gp|{& math @{selected|gp} - 8} Works as expected, @{gp} is now 92. Thanks!
1673228893
timmaugh
Pro
API Scripter
Can confirm I can replicate this bug. Thanks for the heads up, Snuh. Let me get it sorted...
1673234975
timmaugh
Pro
API Scripter
OK, got the fix in place. It's available in my repo and is in the 1-click pipeline to be merged this week. Thanks again for the catch!
Woohoo! Happy to help, thanks for all you do!