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

Can someone tell me what I am doing wrong?

I am trying to make a Macro which calls a drop down menu for my other potion macros. My code is: ?{Which Potion?| Experimental,#Exp | Healing,#Heal | Greater,#Great  | Superior,#Superior  | Supreme,#Supreme  } When I run this macro it gives me a text input box with "Experimental,&{template:default" as the input. My guess is that it is breaking when reading the first macro, but I cant figure out how to fix it. &{template:default} {{name=Experimental Healing Potion}} {{Healing=[[2d4+@{Lum Ealbi|intelligence_mod}]]}} is the code for that first macro that I think is breaking the code. I tried using  } to replace the } in the macro but that just called a version of that macro that didn't proper function and did not make a drop down. It also replaced all the  } with } when I opened the macro again.
1611735231
GiGs
Pro
Sheet Author
API Scripter
This is by far the most common issue people encountered when they start making queries. You have the right solution, but are looking in the wrong place. When you run a macro like this ?{Which Potion?| Experimental,#Exp | Healing,#Heal | Greater,#Great  | Superior,#Superior  | Supreme,#Supreme  } roll20 first reads all the macros linked, and copies their contents into the query, giving something like ?{Which Potion?| Experimental, the complete Exp macro text here| Healing, the complete Heal macro text here | Greater, the complete Great macro text here  | Superior, the complete Superior macro text here  | Supreme, the complete Supreme macro text here  } and then it tries to run it. So if any  of those macros contain a } (not part of an attribute call), the querywill see an end-query symbol, and stop at the point. Likewise other special characters like commas or pipes (|) in the macros will cause breakage. When trying to make such a thing work you have two choices: Copy the complete macros into your query above and then edit the text (adding those html replacements where needed) to make the query work. Modify each macro in place, in the same way. So that when the above query is run, those macros still work. But this will make those macros fail when you try to use them normally. Even if you do either of those, you still haver the problem that opening a macro will remove all html characters and break your fixed query. There are ways to avoid this (storing such macros in a GM Macros character sheet for example). A much better solution than either of those is to switch to chat menus. This allows you to keep using the macros you've already created, without having to edit them at all. With this approach you whisper a message to the person calling the query, and instead of a dropdown they get a a chat message which contains a button for each option. That would look like this: /w "@{selected|character_name}" &{template:default} {{name=Chat Menu} {{[Experimental]( !
 #Exp) [Healing] ( !
 #Heal) [Greater]( !
 #Great ) [Superior]( !
 #Superior ) [Supreme]( !
 #Supreme) }} The above macro sends the menu to the owner of whoever owns the currently selected token. So players can click their own token, and get the menu. It does include a html character (this: !
) so if you store it as a macro, you have to make sure never to reopen it or they will vanish and break the macro.
1611808693

Edited 1611808897
Thank you for responding. I am not a gm so the gm options are out in this particular game. I ended up just putting the macro code for potions into the the query rather then call a macro. I didn't want to do a select char since my char is the only one able to make a experimental potion (it is a artificer ability). ?{Which Potion?| Healing,&{template:default} {{name=Healing Potion}} {{Healing=[[2d4+2]]}} | Greater, &{template:default} {{name=Greater Healing Potion}} {{Healing=[[4d4+4]]}} | Superior, &{template:default} {{name=Superior Healing Potion}} {{Healing=[[8d4+8]]}} | Supreme, &{template:default} {{name=Supreme Healing Potion}} {{Healing=[[10d4+20]]}} |} I did hit a issue with the experimental potion when I made it for some reason. I replaced all the } and the one | but it failed to run when I put it in the query. Still it is a nice macro for any dnd game.
1611813194
Oosh
Sheet Author
API Scripter
When you escape characters for a Query, Attributes and Abilities don't get changed - these are parsed first, so by the time the Query gets to them they'll already be resolved to numbers (or whatever the Attribute contains). It's not super important for this macro in particular, but it's good practice with Queries to get as much of the common text on the outside as possible - it makes it much easier to edit or add to, and less typing/pasting: &{template:default} {{Healing=[[?{Which Potion?| Healing, 2d4+2]]}}{{name=| Greater, 4d4+4]]}}{{name=Greater| Superior, 8d4+8]]}}{{name=Superior| Supreme, 10d4+20]]}}{{name=Supreme| Experimental, 2d4+@{Lum Ealbi|intelligence_mod}]]}}{{name=Experimental} Healing Potion}} If you look at a more complicated Query like the 5e skills/abilities macro, this becomes essential as otherwise you'd have some amazingly horrid Query nesting which would ruin anyone's day/
You can do all of this on your character. Follow the steps I outline here but change the character name from MacrosUtils to your character's name.
Thanks Oosh I will give that a try when I can (I managed to mess up the chat in the game with my testing) when I get the gm to clear the chat. Jarren that is a interesting concept, but I like my way better. Still a very interesting innovation.