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

macro question concerning ChatSetAttr api script or anything else to lower an attribute by using a command

Hello all, I'm hoping that someone out there is familiar with this script. I am wanting to use this or another script to create a command that would lower an attribute such as strength by an amount.  My preference would be to be able to target a token and have a command to lower its strength by 1d4, or at least to be able to lower it by 2 if a roll is not possible.  Using ChatSetAttr, it seems only possible to set an attribute to a value.   !setattr --sel --Strength|15 Does anyone have any ideas? Thank you!
1576040037

Edited 1576040067
vÍnce
Pro
Sheet Author
Try this; !setattr --sel&nbsp;--modb&nbsp;--Strength|-[[1d4]] (more info: <a href="https://github.com/roll20/roll20-api-scripts/blob/master/ChatSetAttr/README.md" rel="nofollow">https://github.com/roll20/roll20-api-scripts/blob/master/ChatSetAttr/README.md</a> )
1576046459
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Would it be helpful (or possible) to have Chatsetattr write the original strength score to a placeholder attribute, ex. "OriginalStrength", so that later you can use: !setattr --sel --Strength|OriginalStrength or similar (not sure of the syntax). That could be in a macro to restore the original value.
Thank you Vince!&nbsp; Works well. Keithcurtis that would be great.