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

Trouble with damage calculation using Token Mod

Trying to do a likely simple damage macro using Token Mod for the AGE system, but I am running into a probable syntax issue.  !token-mod --set bar1_value|[[{@{Selected|bar1}-(?{How much Damage?|}- ?{Standard, Pierce armor stunt, Penetrating?|Standard, @{selected|Armor}| Pierced armor Stunt/Penetrating Armor training mastery, floor(@{selected|Armor}/2)| Penetrating, 0})}, 0}kh1]]} --report gm:control|"{bar1_value:change} health gone" --ids @{selected|token_id} The macro works wonderfully until the damage goes into negative values. Ideally, I would have the value reach 0 and stop, but the above macro seems to have the value "bounce back" after hitting a negative value. For example, at HP of 10, 20 damage is suffered, and the creature has 3 armor, dealing 17 damage total. However, the health afterwards comes up as 3 hp. with the report function saying 7 damage has been done. The other choices in the armor question in the macro yield similar results, with different numbers. Any help would be appreciated! 
1586478726
The Aaron
Roll20 Production Team
API Scripter
It's often easiest to diagnose problems like this by taking the ! off the front of the command.  That will show you precisely what is being passed to the API script, so you can see the way rolls were worked out. If you could do that and post it, it would be easier to work it out. =D
token-mod --set bar1_value| -7 } --report gm|"{bar1_value:change} health gone" --ids -M4WVYCi4gXOMYnOg1eL
1586479714
The Aaron
Roll20 Production Team
API Scripter
Try this: !token-mod --set bar1_value|=[[{@{Selected|bar1}-(?{How much Damage?|}- ?{Standard, Pierce armor stunt, Penetrating?|Standard, @{selected|Armor}| Pierced armor Stunt/Penetrating Armor training mastery, floor(@{selected|Armor}/2)| Penetrating, 0})}, 0}kh1]]} --report gm:control|"{bar1_value:change} health gone" --ids @{selected|token_id}
token-mod --set bar1_value|= -7 } --report gm:control|"{bar1_value:change} health gone" --ids -M4WVYCi4gXOMYnOg1eL Great, it goes into negative without bouncing back. Which I can definitely work with, but now that that's fixed, can the drop/keep function prevent it from being a negative number, and just have it stop at 0?   
1586482226
The Aaron
Roll20 Production Team
API Scripter
That's going to come down to the contents of that inline roll.  There were some strange things with it which I tried to adjust below: !token-mod {{ --set bar1_value|=[[{(@{Selected|bar1}-(?{How much Damage?|}- ?{Standard, Pierce armor stunt, Penetrating?|Standard, @{selected|Armor}| Pierced armor Stunt/Penetrating Armor training mastery, floor(@{selected|Armor}/2)| Penetrating, 0})), 0}kh1]] --report gm:control|"{bar1_value:change} health gone" --ids @{selected|token_id} }} You can try just rolling it: [[{(@{Selected|bar1}-(?{How much Damage?|}- ?{Standard, Pierce armor stunt, Penetrating?|Standard, @{selected|Armor}| Pierced armor Stunt/Penetrating Armor training mastery, floor(@{selected|Armor}/2)| Penetrating, 0})), 0}kh1]] and adjust it until you get it to show 0.
The adjustment seems to have done it! Thank you so much. 
1586483874
The Aaron
Roll20 Production Team
API Scripter
Sweet. =D