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

Token mod macro

Hi,  I'm trying a simple macro and can't get my head around it :  I want to set a selected token bar1_value to half of the hp_max of this selected token... (rounded up)  i tried this but with no success !token-mod --set bar1|[[ceil([[@{selected|hp_max}/2]])]] Anybody to help ?
The Aaron
Forum Champion
API Scripter
!token-mod --set bar1|[[ceil([[@{selected|hp|max}/2]])]] When debugging API commands, you should try running them without the leading ! so you can see what is being passed to the API.  If you did that with your original command, you'd see: SyntaxError: Expected "(", ".", "[", "abs(", "ceil(", "d", "floor(", "round(", "t", "{", [ |\t], [+|\-] or [0-9] but "/" found. Which would point you toward your arguments instead of the actual API script.  Accessing the max for an attribute is used by appending |max to it, not _max.  Making that change allows it to work as expected.
I did just that, debugging only the last part, but even with the error message I couldn't find the right synthax.... Thanks a lot for your help

Edited 1673442050
One thing though, it seems to set the bar1 max to the same amount of HP added...  EDIT : Found it, just needed to --set bar1_value instead bar1.. sorry for disturbance