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

TokenMod? Rnd HP Set to Attribute Roll

1671862365

Edited 1671862861
D G.
Pro
Hello. I've been trying to figure this out for a bit and what searches I have done haven't revealed an answer. I hope the big brains can help even if its a "no can do". I have attributes containing dice values IE 800d10 for an HP range. I've been trying to have TokenMod reference the attribute and set max to the randomly rolled number then the reset command to set the value of the bar to the randomly rolled maximum. I have been getting a "TypeError: Xe is undefined" which I've been interpreting as a reference error. Below is one of the attempts. I have also tried it without the "=" and having @{Selected|forehull} [[@{forehull} ]] and a few other variations. !token-mod  {{ -set    bar3_max | =[[@{forehull} ]]  bar3_reset  bar2_max |=[[@{midhull} ]]  bar2_reset  bar1_max |=[[@{afthull} ]]  bar1_reset   }} Thank you in advance with any assistance or other form of answer.
1. I'm not sure if the space between bar#_max and the vertical pipe is affecting anything or not, but it might be. 2. The only time you can use an attribute reference without a character or token ID, 'selected', or 'target' is when the macro is an ability on a character sheet and you want to reference an attribute from that character. 3. bar#_reset needs to have a vertical pipe if used. 4. If you want to set the bar#_value and bar#_max to the same value, you can simply use 'bar#' .  This should work (untested - and I don't think you need the braces [[ ]] around the hull values): !token-mod  {{ -set    bar3|[[@{selected|forehull}]]  bar2|[[@{selected|midhull}]]  bar1|[[@{selected|afthull}]]   }}
1671893635
The Aaron
Roll20 Production Team
API Scripter
Jarren is right! One thing more though, should have --set instead of -set.  !token-mod  {{ --set    bar3|[[@{selected|forehull}]]  bar2|[[@{selected|midhull}]]  bar1|[[@{selected|afthull}]] }}
Thank you both, Jarren and The Aaron.  I just tested it and worked. This will make off the cuff encounters, 'call downs' and derelicts happen with a minimal impact on pacing. Enjoy your local festivities and once again thank you.