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

Help! Using Turn Tracker to tally used actions, encountered unexpected precision issue

1605189425

Edited 1605189497
I'm setting up my campaign to run the Alien RPG and writing macros to streamline gameplay, but I ran into an unexpected behavior when it comes to the turn tracker...  Goal & Steps Taken In the Alien RPG, initiative is drawn from a deck (1-10), so there are no ties (as in D&D). Since that frees up the decimal places in the turn tracker, I figured I'd use them to track which actions each combatant has taken:  For a fast action, add .1 For a slow action, add .01 For a reactive action, add .001 This should allow each decimal place to function as an at-a-glance tally of actions taken each round. For example, if Cham has initiative five and has taken two fast actions , his initiative should be 5.2 . Once he takes a reactive action , it should appear as 5.201 . To accomplish this, I starting writing Token Action macros using the documentation found on the wiki under Turn Tracker > Adding Values , and this is what I came up with: /w gm @{selected|token_name} performs a **fast** action [[0.1 &{tracker:+}]] The Problem At first, it worked as expected. I selected Cham, activated #xFast, and his tracker incremented to 5.1 . The problem appeared when I activated it a second time, and rather than increasing to 5.2, the tracker showed 5.19999999 (see screen grab below). This is obviously not what I expected, and seems to indicate some sort of precision issue with the way decimal numbers are calculated in Roll20. I repeated the operation several more times and got similar results.  Ideally, I'd love to get help correcting this issue so my action tally idea can work, but I'd also appreciate an explanation as to why this happened in the first place. It really caught me by surprise! I didn't think adding decimals was especially complex or taxing, but maybe there's some quirk to how Roll20 works (or how I wrote the macro) that I'm unaware of.  Thanks in advance for any help!