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

Nested Queries No Longer Working?

1673386725
Nick O.
Forum Champion
Hi All I have a 5e macro that uses nested queries so a player can choose to drink a healing potion as an action or as a bonus action. If I copy and paste the code directly into the chat window, it works fine. However, if I turn it into an actual macro, the HTML codes get converted into their corresponding characters and the nesting doesn't work properly.  Here's the code &{template:default}{{name=Healing Potion}}{{?{action type|bonus,?{Potion|Regular, **Healing Potion Used:** [[2d4+2]]|Greater, **Greater Healing Potion Used:** [[4d4+4]]|Superior, **Superior Healing Potion Used:** [[8d4+8]]|Supreme, **Supreme Healing Potion Used:** [[10d4+20]]}|full,?{Potion|Regular, **Healing Potion Used:** [[10]]|Greater, **Greater Healing Potion Used:** [[20]]|Superior, **Superior Healing Potion Used:** [[40]]|Supreme, **Supreme Healing Potion Used:** [[60]]}}}} When I paste it into the macro window, it turns into this: &{template:default}{{name=Healing Potion}}{{?{action type|bonus,?{Potion|Regular, **Healing Potion Used:** [[2d4+2]]|Greater, **Greater Healing Potion Used:** [[4d4+4]]|Superior, **Superior Healing Potion Used:** [[8d4+8]]|Supreme, **Supreme Healing Potion Used:** [[10d4+20]]}|full,?{Potion|Regular, **Healing Potion Used:** [[10]]|Greater, **Greater Healing Potion Used:** [[20]]|Superior, **Superior Healing Potion Used:** [[40]]|Supreme, **Supreme Healing Potion Used:** [[60]]}}}} Does anyone know how to prevent this conversion from happening?
1673387280
timmaugh
Pro
API Scripter
I just tested that and it worked, Nick... are you saying that they immediately convert from HTML codes to the characters, or after you reopen the macro? Because re-opening the macro will de-code those HTML escapes in a macro... which is a known quirk of the macro input. If I paste your code into a new macro and save it, the macro will function. If I open that macro again the characters will convert and if I save it at that point, I'll be saving those characters in the macro rather than the HTML escape sequences that are required for making the macro work.
1673387513
Nick O.
Forum Champion
Thanks, Timmaugh! I'm in the habit of clicking Save Changes every time I close the macro window so I don't lose anything. I followed your steps and it works fine. Sorry for the false alarm, and thanks again!
1673388286
GiGs
Pro
Sheet Author
API Scripter
One reason people use a a Macro Mule character (store macros as abilities on a GM character) is because this doesn't happen with Abilities. You can close and reopen an ability as often as you like - those nested HTML entities won't be parsed. Personally, I hardly ever use nested macros - I use API Macro Buttons-  they are usually a lot simpler to write and easier to maintain. For the above you'd create separate macros, Healing-Potion-regular, healing-potion-greater, etc, than have a macro that prints out a bunch of buttons, letting people choose which potion to use.
1673439110

Edited 1673439120
David M.
Pro
API Scripter
+1 for chat menus ( wiki ) in this type of case.
1673442719
Nick O.
Forum Champion
Looks like I'll be doing a video on Chat Menus soon. :) Thanks!