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

Aura/Tint HealthColors with healing macro not working properly

1710923951

Edited 1710924019
I have the following macro for drinking a healing potion: &{template:default} {{name=Healing Potion}} {{  ?{Potion|  Regular, Healing Potion Used: [[2d4+2]]|  Greater, Greater Healing Potion Used: [[4d4+4]]|  Superior, Superior Healing Potion Used: [[8d4+8]]|  Supreme, Supreme Healing Potion Used: [[10d4+20]]  }   HP recovered }}!modbattr --charid @{selected|character_id} --silent --hp|$[[0]]!!! Im also using the Aura/Tint HealthColors script which works great, however, the one issue im seeing is if I heal with this macro, it doesnt update the token to reflect its current hps color/tint/aura. Example: token is dead with the red x on the token -> drink potion with macro -> Healthbar goes up to full, but the red x stays on the token instead of being removed and adding the green aura. If i just manually change the hp to full, it fixes itself, so im assuming its something with the macro. For some reason the token change isnt being triggered for the script to register the hp change. Anyone have any ideas with this one? Or if there is something i can add to the end of this script to trigger a "token change" for the aura script to catch it?
Hi Adam P., I think this happen to me with another macro I have to heal. Check what happen if you move the token. To me it happened the same but when I move the token it remove the red X and tint the token.
1710941329
timmaugh
Forum Champion
API Scripter
The issue, I think, is that script-generated events don't propagate to other scripts... the event handling of the sandbox isn't sophisticated enough to process those events without running the risk of an infinite loop. We can add metascript conditionals to check the state of things and then conditionally use TokenMod to assign proper markers. This is specific to this one case, so it's up to you to recognize other places where a script might affect some value while ATCH would be blind... !{{   &{template:default} ({)name=Healing Potion(}) ({)  ?{Potion|  Regular, Healing Potion Used: [[2d4+2]]|  Greater, Greater Healing Potion Used: [[4d4+4]]|  Superior, Superior Healing Potion Used: [[8d4+8]]|  Supreme, Supreme Healing Potion Used: [[10d4+20]]  }   HP recovered (})   !modbattr --charid @{selected|character_id} --silent --hp|$[[0]]   (^)!{^&if @^(@{selected|character_id}.hp > 0 && @^(@{selected|character_id}.status.dead.is) = yes }token-mod --set statusmarkers|-dead {^&end}{^&delay 1} }} That's air-coded, but I think it's correct. The idea is (and the modifications are): 1) use ZeroFrame batching to get multiple command lines; that will let us delay them independently to make sure the previous ones have resolved before we rely on the result 1b) because we use ZF batching, we can lose the three bangs to close the ChatSetAttr command -- it is now its own fully-fledged message; we also have to modify the double-braces of the template parts (both the {{ and the }} ) so they don't interfere with the ZF batching 2) use ZeroFrame batch deferral (the caret: ^ ) to make sure that the conditionals in the last message don't resolve until that line is dispatched 3) use a {&delay} tag in that same line to make sure ChatSetAttr has time to resolve the change to the character 4) use APILogic conditionals and a a couple of Fetch constructions (all deferred) to check whether the token is currently marked as dead but has hp greater than 0... if so, we run the TokenMod line to remove the "dead" marker. REQUIRED SCRIPTS: ChatSetAttr, TokenMod, MetaScriptToolbox
1710941430
timmaugh
Forum Champion
API Scripter
Warlord said: Hi Adam P., I think this happen to me with another macro I have to heal. Check what happen if you move the token. To me it happened the same but when I move the token it remove the red X and tint the token. This makes sense; it could be that ATHC, knowing it might be blind to script-generated changes, would monitor token movements to initiate a check of the token at that point (and correct its current state). If you don't want to have to touch the token, however, you could try the suggestion from my previous post.