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

bar# macro use

I'm trying to use bar3 to store HP and then adjust that with another macro. Is it possible to change a bar value from a macro? Tried this: /me adjusted hitpoints to [[@{selected|bar3}-?{HP adjustment|0}]]  Definitely a newbie question. Trying to get a handle back on roll20.
1468033739

Edited 1468033768
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
You'll need  tokenmod  for that. The API is required to modify tokens and characters from within chat.
/me adjusted hitpoints to [[@{selected|bar3}-?{HP adjustment|0}]]  Remember that anything inside double brackets [[ ]] is a calculation that is done and then displayed; but it does not assign any new values. If you did [[@{selected|Str}+3]] it would show 3 + your Strength score, but it would not change the value of your strength score. Do, however, remember that you can just click on the number corresponding to the bar you want to change and alter it from there by typing the function you want done. For instance, If you have 50 HP and an attack takes away 10, just click on the 50, type "-10" and hit enter and it will do the calculation for you. I think in the long run, that would be easier than selecting a token, running the macro you're trying to make (even if you got it to work using tokenmod), and still having to type "-10" and then click "ok" on the pop-up prompt box. The built-in feature is solid and works great! Tokenmod is nice... but you don't need it to do what you want to do. Cheers!
Matt W. said: Do, however, remember that you can just click on the number corresponding to the bar you want to change and alter it from there by typing the function you want done. For instance, If you have 50 HP and an attack takes away 10, just click on the 50, type "-10" and hit enter and it will do the calculation for you. I think in the long run, that would be easier than selecting a token, running the macro you're trying to make (even if you got it to work using tokenmod), and still having to type "-10" and then click "ok" on the pop-up prompt box. Understood. I've used that before I was just looking for a macro version. It's just a bit more convenient for me tho after using it a while  we'll see if I still feel that way ;) 
1468095070

Edited 1468095174
Gold
Forum Champion
I tend to agree with what Matt advised on this (use the built-in circles above the token to -10 the HP). &nbsp;Scott is also on-point to recommend the excellent TokenMod community-created API. Celestian you will probably want to get TokenMod anyway, and learn how to trigger all the many things it can do. Very useful and powerful, and I know from previous discussions that you like to automate and program features. Third option, I believe it is possible to use Target macros to reduce a bar. Haven't done this myself but I think it can be done (though again I tend to agree with Matt that it's easier to reduce HP directly on the damaged-token's circle). Celestian you might want to look into how to code for Targeting, if you want the Attacker or your Monster to directly inflict the HP subtraction on the victim/target. Example behavior: My sword does .... [3] damage.... on [Choose target]. Wiki docs for this option, <a href="https://wiki.roll20.net/Macros#Using_a_Targeted_To" rel="nofollow">https://wiki.roll20.net/Macros#Using_a_Targeted_To</a>...
1468097053
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
Gold said: Third option, I believe it is possible to use Target macros to reduce a bar. Haven't done this myself but I think it can be done (though again I tend to agree with Matt that it's easier to reduce HP directly on the damaged-token's circle). Celestian you might want to look into how to code for Targeting, if you want the Attacker or your Monster to directly inflict the HP subtraction on the victim/target. Example behavior: My sword does .... [3] damage.... on [Choose target]. Wiki docs for this option, <a href="https://wiki.roll20.net/Macros#Using_a_Targeted_To" rel="nofollow">https://wiki.roll20.net/Macros#Using_a_Targeted_To</a>... Yep, although this will still require tokenmod as a straight-up macro cannot change anything, it can only report what the result is.