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

Use of !token-mod script request help

September 05 (8 years ago)
Hey I had this script saved, but somehow I lost it.  I want to use token-mod to increase bar1 by 12, but I don't want it to exceed the maximum allowable for bar1.  How can this be modified to not exceed bar1's maximum?

!token-mod {{
--set bar1_value|[[ {@{selected|bar1}+12,0}kh1 ]]
--ids @{selected|token_id}
}}

Thank you!
September 05 (8 years ago)
Use this in there [[{@{selected|bar1}+12+ 0d0,@{selected|bar1|max}+0d0}kl1]]
September 06 (8 years ago)
Thanks for the suggestion Ed S. but that script doesn't add 12 to bar 1. It does tell you in the chat window what bar 1 should equal after adding 12 to whatever value bar 1 currently has, which is cool, but not what I was hoping for.
September 06 (8 years ago)
Pat S.
Forum Champion
Sheet Author
If you go to your API scripts (game detail page>Setting button>API Scripts) you can install the Tokenmod script with the one click install or you can click on import and it will perform a manual install (won't check for dependencies that I know of) so you can see the actual script. If you just want to see the script in the github you can find it here (tokenmod). If this is what you are looking for, congrats. If it is not what you wanted then I would suggest asking for Aaron or another one of the script gurus to help you.
September 06 (8 years ago)
The Aaron
Pro
API Scripter
I believe Ed was just pointing out the alternative formula to pass as the value of bar1:
!token-mod {{
  --set bar1_value|[[{@{selected|bar1}+12+ 0d0,@{selected|bar1|max}+0d0}kl1]]
  --ids @{selected|token_id}
}}
September 06 (8 years ago)
Thank you Aaron!