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

Very odd behavior with Token Mod and Hit Points (Status Bar)

After nearly an hour of trying, this is the best I could do. My apologies for how disjointed this will appear to most of you. See the (third?) post below for details. EDIT: This post is not complete yet. I am posting it incomplete due to the known issues with including images in forum posts. I will be adding images as needed, and making multiple edits to do so. This line will be removed when all needed images are uploaded properly. EDIT: As expected, the images are failing to upload properly. I will clean this up when I have completed my post. Thank you for your patience. This began with the "Get A New Look" update, and nothing in my system has changed recently, so please don't suggest the problem is on my end. It concerns negative hit points on the token's status bars (Bar 1, green), which is a known bug, so it's obviously related to that. I haven't seen any other reports of this, so here goes: When using the Token Mod API script to reduce hit points below zero, a strange result occurs, as demonstrated below: First off, a token with maximum hit points shown: Then, an example of reducing hit points, which works properly: image 1 and 2 posted successfully on first attempt Now an example of reducing the token's HP to zero, which works as expected: image posted successfully on third attempt And here's the bug. Watch as I use TokenMod to reduce the HP by ONE, and get an unexpected result: Six attempts to post this, no success. I will skip it for now. And then, I shall do so again, once more reducing the HP by ONE: Failed. One more try: Failed again. Previous images worked properly after a matter of seconds. This time I waited 5 minutes (yes I timed it). I shall try another method: Responding to my own post. See below. And again: And again: And finally, adding 99, which does work as expected: This is not the behavior I expect to see, and indicates a serious issue somewhere in the coding for the status bars. Again, it worked properly for years, up to the day the "Get a New Look" 'update' was put in place, with its known bug regarding negative values. As such, I can no longer use this API script in my games. Please look into this. Thank you.
The compiled version loaded successfully elsewhere. Let's try it again here. OK Fine. This is the best I'm going to get after nearly an hour, so be it. Simply click the above image to enlarge, then right-click and *save as* to download a readable version. Thank you for your patience.
Ok, so let me describe the issue, as shown in the compiled image above. 1) Token shown with full health 2) Token shown with reduced health, expected behavior. 3) Token shown with further reduced health, resulting in a value of zero, expected behavior. 4) Token shown has health reduced by 1, resulting in a value of -2. Unexpected. 5) Oops, mistake on my part. Same image as #4. I'm really not in the mood to try to fix it at this point. 6) Token shown has health reduced by 1, resulting in a value of -8. Even more unexpected. 7) Token shown has health reduced by 1, resulting in a value of -26. What the heck? 8) Token shown has health reduced by 1, resulting in a value of -80. This makes no sense at all! 9) Token shown has health INCREASED by 99, resulting in a value of 19. This is the expected behavior. I have experimented with this, and the value change increased every time. I have gotten absolutely ridiculous results, which I won't even try to post here. Don't try to tell me the problem is on my end, please. We all know it's not. Thank you for your patience, and again, I'm sorry this post is so ugly. I have made it as pretty as I can, given the limitations. I leave the error log (deleted to most viewers) as a secondary bug post re: images. -Phnord, aka Barth the Bartender, 6 year PRO subscriber and person who more than halfway expects a ban or otherwise nasty response for this entire thread.
Hi Phnord, I am getting similar unexpected behavior except without the API script. In my testing my values ended up being doubled (i.e. -1 >> -2 >> -4 >> -8 >> so on). I have queried the devs to see if this is a known issue that is already in the works for a fix. Thank you for catching this!
1550333459
vÍnce
Pro
Sheet Author
(forum image insert bug; I feel your pain) Does the linked bar react as expected when you click on the token's bar directly and manually subtract an amount? You might have better luck nailing down the issue in the API forum.  At least Aaron would probably verify if it's a script issue or, more than likely, an issue related to the last round of updates.
1550333487
vÍnce
Pro
Sheet Author
Sniped
1550334597
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Thanks for the report and warning. In the effort to reduce frustration with the image uploading process, I do have a workaround with a so far 100% success rate. The bug seems to be related to uploading from your local hard drive. Using an image URL has yet to fail me. I have a dump folder on Imgur. If I need to upload an image to the forum, I drop it in that folder, click on it to get the direct URL (it's a button you can press), and use that instead of choosing a file. Yes, it's a tedious addition of several steps, but it does save time in the long run because it beats multiple click-waiting-failing cycles. I also have an extension for Chrome that will either send any online image to chrome and fill your clipboard with the URL with a single right click, or allow you to do the same with a screen capture.
1550336418
vÍnce
Pro
Sheet Author
keithcurtis said: Thanks for the report and warning. In the effort to reduce frustration with the image uploading process, I do have a workaround with a so far 100% success rate. The bug seems to be related to uploading from your local hard drive. Using an image URL has yet to fail me. I have a dump folder on Imgur. If I need to upload an image to the forum, I drop it in that folder, click on it to get the direct URL (it's a button you can press), and use that instead of choosing a file. Yes, it's a tedious addition of several steps, but it does save time in the long run because it beats multiple click-waiting-failing cycles. I also have an extension for Chrome that will either send any online image to chrome and fill your clipboard with the URL with a single right click, or allow you to do the same with a screen capture. Thank you Keith. I know.  I know...  and all of us forum users appreciate the tip. That said, I almost wish there wasn't an alternate method so that this would finally  (this bug and others were introduced over 7 months back during the text-editor updates...) get fixed . ;-P Cheers
Drespar said: Hi Phnord, I am getting similar unexpected behavior except without the API script. In my testing my values ended up being doubled (i.e. -1 >> -2 >> -4 >> -8 >> so on). I have queried the devs to see if this is a known issue that is already in the works for a fix. Thank you for catching this! Drespar, how are you entering your values? I just tried (by clicking the green circle, entering -1, and hitting enter) and got the expected results, ie -1, -2, -3, etc. Vince said: Does the linked bar react as expected when you click on the token's bar directly and manually subtract an amount? It sure does. See above. keithcurtis said: In the effort to reduce frustration with the image uploading process, I do have a workaround with a so far 100% success rate.  Works like a charm, keithcurtis! Thanks! Vince said: , I almost wish there wasn't an alternate method so that this would finally  (this bug and others were introduced over 7 months back during the text-editor updates...) get fixed . ;-P Not to go on a rant here, but... Roll20 seems to want us to use third-party programs! Images won't work properly, unless we use a third party. Video and voice won't work properly, unless we use a third party. Music was based on third-party systems. Now that it's moving internally, I fear for the future. Heck, even being able to make a post like this one wasn't possible until over 60,000 people responded on a third-party site! Edit: Oh, and maps are officially not supposed to be made in Roll20, but rather created by a third-party program and imported!
1550338398
The Aaron
Roll20 Production Team
API Scripter
What version of TokenMod?
Phnord Prephect said: Drespar, how are you entering your values? I just tried (by clicking the green circle, entering -1, and hitting enter) and got the expected results, ie -1, -2, -3, etc. The bars (bubbles) support some basic math functions such as subtraction and addition. I used a token with 45HP and simply input "45-5" to get 40. At the 0 point, subsequent attempts to subtract 1 into the negatives yielded the doubling results from use of the math functionality.
The Aaron  said: What version of TokenMod? It's an older one; why, does the newer one work properly? (Digs thru api script for a minute) It appears to be 0.8.18, dated 1454855624. Drespar  said: The bars (bubbles) support some basic math functions such as subtraction and addition. I used a token with 45HP and simply input "45-5" to get 40. At the 0 point, subsequent attempts to subtract 1 into the negatives yielded the doubling results from use of the math functionality. Yes, I'm aware. Are you typing into the green circle "0-1" or are you just typing "-1"? The first seems odd to me; why would you enter the current value? Edit: Yes, I tried and got (mostly) expected results. Initial value 0, enter -1, got -1. Initial value 0, entered 0-1, got -1. Initial value -5, entered -5-5, got -10. Can't seem to replicate your results, Drespar.
At first glace the issue seems like a computation error, checking the subtraction and addition functions in both negative and positive domains was the goal of inputting "0-1" etc.
1550339447
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
I'm not seeing any incorrect results with any of these tests, either by Tokenmod ("!token-mod --set bar1_value|-1"), inputting formulas ("0-1"), or bare operations ("-1")
Drespar said: At first glace the issue seems like a computation error, checking the subtraction and addition functions in both negative and positive domains was the goal of inputting "0-1" etc. I'm still not clear on exactly what you're doing, or where. keithcurtis said: I'm not seeing any incorrect results with any of these tests, either by Tokenmod ("!token-mod --set bar1_value|-1"), inputting formulas ("0-1"), or bare operations ("-1") Try it with a macro, this is the one I'm using: !token-mod {{    --set bar1_value|[[ {@{selected|bar1} + [[?{How Much}]], @{selected|bar1|max}}kl1 ]]     --ids @{selected|token_id} }} Edit: Which means this could be my fault after all, except that Drespar seems able to get a similar result. Edit: Tried it with your code directly, and it works as expected. Hmmm...
May as well contribute my findings for the ticket :) So far so good
Drespar, by putting in the current value, followed by the desired reduction, you're reducing your value by the current value! In other words, it's only parsing the first part (-4) and ignoring the second (-1) in a request of (-4-1). This is the expected result, a doubling of the absolute value. ((-x)+(-x) = -2x) Edit: How did you manage to upload those images so easily?!
1550341957
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Drespar, that's what you would get if the parser were truncating the second operator on an initial value. In other words: [40]-1-1 yields 39 [-40]-1-1 yields -41 Formulas act differently (this is only with an initial blank value): 40-1-1 yields 38 0-1-1 yields -2 -1-1-1 yields -1 So if there is an initial value in the bubble, it only takes the first operation. so your [-4]-4-1 is being parsed to -4-4 I believe this is correct behavior. A + or - after an initial value indicates a change. If you put in -4-1 after an existing value, it should subtract the first and ignore the second. It could be parsed to do multiple operations, but it is never going to tak "-4" as the initial value, only as an operand.
1550341986
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Or what Phnord said
Ah ha! Figured there was something fishy from my end! I will be the first to admit I was unaware that it was stored in cases where original value was appended as opposed to "wiped" when operating in my examples. Professors said that doing math in my head would eventually come back to bite me :) Phnord, Regarding image uploads: I simply use Gyazo and copy the images from there for most image posting.
1550343676

Edited 1550343755
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
It looks like token mod is assuming that the negative value in the set bar is an actual negative value and not an operand. In other words, it is behaving as if the = sign is in there. This works:    --set bar1_value|=[[@{selected|bar1} + ?{How Much}]] since that no longer gibes with a roll command (kl1), I'd make that a second line in the macro to set the bar to the lowest of whatever it is and the max.
1550433499
The Aaron
Roll20 Production Team
API Scripter
That’s exactly the case, Kieth.