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

Idiot in need of assistance: (5e) how to nest macros/abilities in a dropdown query = Battlemaster Manoeuvres

1620664636

Edited 1620664695
Apologies if this is well-trodden ground for this forum: I've been scouring through relevant posts and articles and the 'advanced usage' section but for someone with no knowledge of coding or computers (or what the hell 'parsing' means) I cannot seem to get my head around it. I've created separate macros for each of my Battlemaster manoeuvres (simple template), and all I'm looking to do is create a dropdown query that will let me choose which of the manoeuvres I wish to use. I understand that on some level I have to convert some syntax( {,  |,  } ), into html entities, however I really have no idea where and every time I try something it never seems to work. I understand that editing a macro with html entities automatically converts them back once reopened to edit and I've been working through that in my trial and error. What I need help with is specifically how you nest macros inside a dropdown query and what exactly needs to be converted to html entities - the syntax in the dropdown query itself? the syntax in macros that are nested within? all syntax involved? should I  convert the Manoeuvre macros into Abilities on the character sheet and then try to nest them? Is there a problem with a dropdown query outputting macros in a Simple Template? Please help an idiot out, I have no knowledge of coding or anything like that and this is all completely new to me; if you have any answers please explain like I am a five year old. And before you say that this has already been covered many times on this forum, believe me; I am aware. I'm just stupid. :)
Nesting macros in a dropdown query is a huge P.I.T.A., because of the Roll20 Order of Operations . Abilities  are expanded (meaning the definition of the ability is placed in the formula anywhere that ability appears; e.g.  %{character name|ability_name}  becomes  /r 1d4 ). Macros  are expanded (e.g.  #macro-name  becomes  /r 1d4 ). Attribute calls  are resolved. (e.g.  @{attribute_name}  becomes  4 ) Steps 1-3  are repeated up to 99 levels deep,  or there are no longer any expansions required. Roll queries  are executed up to 99 levels deep (the player making the roll is asked to provide a value for each query, and that value is substituted in where the roll query appears in the formula).  Html entities  within roll queries are parsed once after each roll query (e.g.  }  becomes  } , but  }  becomes  } ) Inline rolls  are executed, starting with the most deeply nested inline roll working upward. The overall result of the inline roll is substituted in place where it appeared in the formula. The remaining roll is executed : first, dice are rolled for any dice (e.g.  2d6  is rolled; including any special dice such as dropped or exploding), then the result of that roll is substituted into the formula. Mathematical functions  like  floor()  and  ceil()  are executed. The  entire remaining formula is evaluated , including observing proper  Math Order of Operations  (parentheses first, then multiplication/division, then addition/subtraction). Html entities/replacements  are processed once more The  message is sent to  q   Text Chat  as well as the  API sandbox . So when you have a basic query that looks like this (I'm super simplifying this): ?{Which Manoeuvre?|Attack,#Attack|Defend,#Defend} And your Manoeuvre macros are something like this: #Attack &{template|npcaction} {{rname=Attack}} {{description=This is the description of the attack you are making}} #Defend &{template|npcaction} {{rname=Defend}} {{description=This is the description of the defense you are making}} When you enter the initial query, Roll20 parses (replaces specific items) the macro calls, following the Order of Operations. So the initial basic query is changed before it is finally processed  into: ?{Which Manoeuvre?|Attack,&{template|npcaction} {{rname=Attack}} {{description=This is the description of the attack you are making}}|Defend,&{template|npcaction} {{rname=Defend}} {{description=This is the description of the defense you are making}}} Now that everything that should be parsed has been parsed, it is then 'processed' as a command.  And it 'breaks' because the initial query is bounded by specific characters: vertical pipes '|' , closing braces '}', and commas ','.  When it sees a vertical pipe, it assumes that it separates the next query item; when it sees a comma it assumes it is the output for the query item; and when it sees a closing brace it assumes that is the end of the query.  ?{Which Manoeuvre?|Attack,&{template |npcaction} The vertical pipe here becomes the second query item, because it doesn't recognize that there is a nested item within the query starting with another opening brace. So you have to replace all the complicating characters in the macro that is called within the query.  Everything that is within the #Attack and #Defend cannot use a vertical pipe, comma, or closing brace.  They would have to be replaced ('escaped') with html entity substitutions.  Then it's further complicated if there are any calls or queries within those macros, and they'd have to be 'double escaped' to function.
1620666904
Kraynic
Pro
Sheet Author
Quite a few of us use very few queries and use chat menus instead.&nbsp; <a href="https://app.roll20.net/forum/permalink/5927072/" rel="nofollow">https://app.roll20.net/forum/permalink/5927072/</a> There are a lot of tips/tricks in that thread, so look over the first post (which is an index) for other things that might interest you.
Wow I did not think I would get such a comprehensive reply in like 10 minutes, thanks very much that's made this much simpler for me to understand (especially for explaining what 'parsing' and 'escaped' means I had no idea).
1620673303
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Andreas recently updated the wiki page for&nbsp; Chat Menus , using the original post as a starting point. It's a bit more thorough and well-documented than my original post.