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

Query to Roll HP_Formula or Enter a Custom Value for NPC HP

1669598630

Edited 1669620576
[edit to add: I solved the custom HP portion of the query!  If someone has ideas about how to get the MAX HP from hp_formula, and the option to either get the average HP or leave the existing value unchanged, that would be appreciated!] Here's the corrected macro: !token-mod {{ --set bar1_link|none --set bar1|?{Enter HP Value| Roll HP,[[@{selected|npc_hpformula}]]| Custom HP,?{Custom HP Value}|} }} [edit to add:  I'm using the 5e by Roll20 sheet] I'm toying around with Token Mod, just trying to learn what it can do and I'm a little stuck.  I can get it to prompt me for a value and then apply that to bar1 on the NPC token, and I can get it to roll the hp_formula and apply that to bar1 on the NPC token, and I can even get it to query me for whether I want to roll or enter a value, but I'm stuck on how to configure the query to give me a space to put the custom value when it's a two-part query.  Here's what I have, with a recreation of me screaming at my screen at the problem area: !token-mod {{ --set bar1_link|none --set bar1|?{Enter HP Value| Roll HP,[[@{selected|npc_hpformula}]]| Custom HP,  WHAT GOES HERE TO MAKE YOU WORK??! } }} I had originally set out to make this a three-part query:  Max HP Value derived from the hp_formula, Average HP Value derived from the hp_formula (or somehow just keep the value that exists in the NPC sheet), and Custom HP Value (prompt to enter a value).  However, I got stuck on the max and average/keep existing value parts so I moved on to what I thought would be easier but got stuck anyhow. Any help would be appreciated, thanks in advance!
1669641405
timmaugh
Forum Champion
API Scripter
You need a sub roll-query, but it requires escaping the characters that help to control a query -- otherwise the outer query will think that those characters belong to it... so something like this: !token-mod {{ --set bar1_link|none --set bar1|?{Enter HP Value| Roll HP,[[@{selected|npc_hpformula}]]| Custom HP,?{Enter Custom Amount|}} }} Characters you have to escape for a sub-query: | (pipe) } (right brace) -- EXCEPT for those involved in character attribute retrieval , (comma)