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

Roll Query inside API argument call to TokenMod

Is it possible to include a Roll query in the call to an API for choosing an argument? I'm trying to set up my TokenMod call and I seem to be stumbling with it a bit. Today I have 4 macros that I do this like so. !token-mod {{ --set bar1_link| bar2_link| bar3_link| bar1| bar2| bar3| --set light_radius|light_dimradius| --off light_hassight --off showname --set bar3|[[@{selected|npc_hpformula}]] --set bar2_value|@{selected|npc_ac} --set bar1_value|[[10 + [[@{selected|npc_perception}]]]] --on showplayers_bar3 }} however, each macro is different in that --set bar3 changes depending on how I'm feeling, or how good of odds I want the NPC to have loads of health. I use these 4 methods for that line. --set bar3|[[@{selected|hp|max}]] --set bar3|[[@{selected|npc_hpformula}]] --set bar3|[[ {[[@{selected|npc_hpformula}]],[[@{selected|npc_hpformula}]]}kh1 ]] --set bar3|[[ {[[@{selected|npc_hpformula}]],[[@{selected|npc_hpformula}]],[[@{selected|npc_hpformula}]]}kh1 ]] My first attempt looked something like this, and this does in fact work !token-mod {{ --set bar1_link| bar2_link| bar3_link| bar1| bar2| bar3| --set light_radius|light_dimradius| --off light_hassight --off showname --set bar3|?{Roll Method|Average,[[@{selected|hp|max}]]|Single Roll,[[@{selected|npc_hpformula}]]} --set bar2_value|@{selected|npc_ac} --set bar1_value|[[10 + [[@{selected|npc_perception}]]]] --on showplayers_bar3}} However, once I start to the drop dice rolls is when it fails. I've tried this with a variety of HTML characters in the closing curly braces, but I'm getting numbers like [[{34 for hp. I've tried with the HTML characters on the end of just the drop dice roll query, and I've also tried it using the HTML characters at the end of each attribute reference, but I thought I wasn't supposed to do that. !token-mod {{ --set bar1_link| bar2_link| bar3_link| bar1| bar2| bar3| --set light_radius|light_dimradius| --off light_hassight --off showname --set bar3|?{Roll Method|Average,[[@{selected|hp|max}]]|Single Roll,[[@{selected|npc_hpformula}]]|Double Roll,[[{[[@{selected|npc_hpformula}]],[[@{selected|npc_hpformula}]]&-#-125;kh1]]} --set bar2_value|@{selected|npc_ac} --set bar1_value|[[10 + [[@{selected|npc_perception}]]]] --on showplayers_bar3 }} Any thoughts on this?
1529590965

Edited 1529591245
I've also tried it this way This works --set bar3|[[?{Roll Method|Average,@{selected|hp|max}|Single Roll,@{selected|npc_hpformula}}]] This doesn't (again with and without HTML closing curly braces. --set bar3|[[?{Roll Method|Average,@{selected|hp|max}|Single Roll,@{selected|npc_hpformula}|Double Roll,{[[@{selected|npc_hpformula}]],[[@{selected|npc_hpformula}]]}kh1}]]
1529591373

Edited 1529591395
Jakob
Sheet Author
API Scripter
Your problem is the use of closing curly braces and commas (except for those ending @{...} attribute references) within the options of a roll query. You need HTML encode those, for example in your double roll option (I think there are no others in this example). Offenders are bolded and need to be HTML encoded. Double Roll,{[[@{selected|npc_hpformula}]] , [[@{selected|npc_hpformula}]] } kh1}
Alright, I didn't realize the commas would cause issues too. giving that a shot, I'll report back in a minute. Technically in a gotomeeting at work :D
Comma works, thanks a bunch! I've always had issues with Curly Braces, never had them with Commas before, thank you!