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

How do I get my macro to set a health bar to a specific number?

Here's what I'm wondering: Is it possible for my macro to roll a random number and set a particular token bar to that? Next, could that bar then be read by a macro to do another function? Example: Roll 2d12 (example roll (6) Set the green bar to (6) Read the green bar for the next (or same) macro Thanks, Jay H ..
1420431029
DXWarlock
Sheet Author
API Scripter
Cant do any attribute changes, token changes or such with macros. You would need an API script for it. :\
1420432285
vÍnce
Pro
Sheet Author
I believe Aaron's TokenMod script can set a status bar with a roll. example: Set hit points with this (sets both bar2_value and bar2_max to the result of the expression): !token-mod --set bar2|[[3d8+4]] Then you could take the value of bar2 and do something else...
1420445441
The Aaron
Pro
API Scripter
If you're willing to use the API, you can certainly accomplish the first two as Vince pointed out. To do the third is harder. When you execute macros, all attribute references are replaced before the comands are executed. That means a reference to the green bar in the third line would get the value of that bar before any of the comands are executed. This can be worked around with the API, but it's a pretty custom thing. I have a few scripts that will do this for HB's PowerCards, if that's what you're after.