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

Nesting Query Macro's not working

I am currently working on a macro for a necromancer that uses mob combat rules for his skeletons  I have two functioning macros for Attack and Damage rolls based off of Ed S. Mob attack and mob damage macros  and I would like to be able to have a Drop Down  Roll Query  that allows me to run 1 or the other. roll20 wiki gives this  example " ?{Which macro?|Attack,#use-sword |Defend,#use-shield }" to which I made the following "?{Attack or Damage |Attack,#SkeletonAttack |Damage,#SkeletonDamage }" This does not work, and only outputs "#SkeletonAttack" or "#SkeletonDamage" in the chat. Upon investigation I came across THIS article about " Advanced Usage for Roll Queries" that shows that macro's that query other existing queries fail and they recommend putting the entire macro you want to call in the Drop Down Roll Query...Which is fine, but whenever I try it fails. I think this is because there are Roll Queries inside of Roll Queries in the same macro but I am not sure and would like some assistance. Here are the working Macro's I currently have. #SkeletonAttack &{template:default}{{name=Skeleton Attack!}}{{ [[{?{Number of Attackers|10}d20 + ?{To hit modifiers +|4}}>[[?{Target AC|15}]] ]] **Skeletons hit!**}}{{Arrows consumed: = ?{Number of Attackers}}} #SkeletonDamage &{template:default}{{name= Skeleton Damage!}}{{ [[ (?{Number of hits|1})d6 + (?{Damage bonus|2}*?{Number of hits}) ]] Piercing Damage}} In Theory it would be simplest if I could get  "?{Attack or Damage |Attack,#SkeletonAttack |Damage,#SkeletonDamage }"  to work, but if I need to put both macro's into the roll query, how would I achieve that? I have gotten this to work with buttons by replacing "#SkeletonAttack" with "[Attack]( (!
#SkeletonAttack)" but this makes it so I have to click more times to activate the macro's i want instead of less, but it works with Roll Query 
1667435332

Edited 1667436744
Gauss
Forum Champion
The problem is that there are a lot of restrictions when the macro you are embedding in the query loads.  ?{Query|Macro1,#Macro1 |Macro2,#Macro2 } is seen as  ?{Query|Macro1,insert the macro from #Macro1 here |Macro2,insert the macro from Macro2 here } And as a result, it breaks, because the macro itself adds things like "}" that will break the query.  So, my suggestion is this: use a chat menu. It can give you buttons for Skeleton Attack and Damage.  Oh, another issue, don't use Collection tab macros, use Ability macros. Collection tab macros will break when you edit them if there is html entities in there.  Make a Macro Mule character, put all your macros on the Mule, then call them from your Collection tab macros. 
Gauss said: The problem is that there are a lot of restrictions when the macro you are embedding in the query loads.  ?{Query|Macro1,#Macro1 |Macro2,#Macro2 } is seen as  ?{Query|Macro1,insert the macro from #Macro1 here |Macro2,insert the macro from Macro2 here } And as a result, it breaks, because the macro itself adds things like "}" that will break the query.  So, my suggestion is this: use a chat menu. It can give you buttons for Skeleton Attack and Damage.  Oh, another issue, don't use Collection tab macros, use Ability macros. Collection tab macros will break when you edit them if there is html entities in there.  Make a Macro Mule character, put all your macros on the Mule, then call them from your Collection tab macros.  Thanks for the response Gauss! I think your idea of a Collection tab is decent, but at this point using the macro quick bar that is available already might do the same thing, I am not running out of space on it quite yet, I just wanted to save a space on my macro quick bar because both macros will always be run at the same time. If I could save the number of hits value from Skeleton Attack, then I could combine the two, but as far as my research goes that isn't possible without a script 
1667451492

Edited 1667451677
Gauss
Forum Champion
Adam R. said: Gauss said: The problem is that there are a lot of restrictions when the macro you are embedding in the query loads.&nbsp; ?{Query|Macro1,#Macro1 |Macro2,#Macro2 } is seen as&nbsp; ?{Query|Macro1,insert the macro from #Macro1 here |Macro2,insert the macro from Macro2 here } And as a result, it breaks, because the macro itself adds things like "}" that will break the query.&nbsp; So, my suggestion is this: use a chat menu. It can give you buttons for Skeleton Attack and Damage.&nbsp; Oh, another issue, don't use Collection tab macros, use Ability macros. Collection tab macros will break when you edit them if there is html entities in there.&nbsp; Make a Macro Mule character, put all your macros on the Mule, then call them from your Collection tab macros.&nbsp; Thanks for the response Gauss! I think your idea of a Collection tab is decent, but at this point using the macro quick bar that is available already might do the same thing, I am not running out of space on it quite yet, I just wanted to save a space on my macro quick bar because both macros will always be run at the same time. If I could save the number of hits value from Skeleton Attack, then I could combine the two, but as far as my research goes that isn't possible without a script&nbsp; I think you might have misunderstood. I wasn't referencing which Bar you use (Token Action vs Macro Bars). I was referencing the two ways to make macros, Attributes and Abilities tab in characters, and Collection tab macros. Both Ability macros and Collection Tab macros can use either bar.&nbsp; Each version of macros functions a bit differently. Collection tab macros should generally be avoided as they are more limited than Ability macros.&nbsp; Typically, you should create a Macro Mule which is a character whose sole purpose is to hold macros. These macros are then referenced directly or from Collection tab macros. Advantages of the Macro Mule:&nbsp; 1) portability, it can be moved from game to game via the Character Vault or the Transmogrifier.&nbsp; 2) Fewer problems, Collection tab macros have limitations. For example: HTML entities will revert the HTML entity, which defeats the purpose of using the HTML entity. Ability macros do not have this limitation.&nbsp; Source: <a href="https://wiki.roll20.net/Macros" rel="nofollow">https://wiki.roll20.net/Macros</a> This is a problem you will be running into if you continue trying to nest Collection tab macros inside queries.&nbsp; 3) Everyone in your game can be set up to use the Macro Mule, this allows you to not duplicate macros for your players, they are all set up using the same base macro.&nbsp; 4) Related to #3, if you make a change to a macro it doesn't have to be duplicated for each player in your game.&nbsp; There are probably more, but that is a good short list.&nbsp; As for chat buttons, another method of doing things, they avoid a number of the problems that you are running into.&nbsp; 1) IIRC, they can be set up to re-use rolls, something you cannot do with your current macro setup.&nbsp; 2) They avoid many of the problems of nesting macros in queries. They are much simpler.&nbsp;
1667457513

Edited 1667457758
I think you might have misunderstood. I wasn't referencing which Bar you use (Token Action vs Macro Bars). I was referencing the two ways to make macros, Attributes and Abilities tab in characters, and Collection tab macros. Both Ability macros and Collection Tab macros can use either bar.&nbsp; Each version of macros functions a bit differently. Collection tab macros should generally be avoided as they are more limited than Ability macros.&nbsp; Typically, you should create a Macro Mule which is a character whose sole purpose is to hold macros. These macros are then referenced directly or from Collection tab macros. Advantages of the Macro Mule:&nbsp; 1) portability, it can be moved from game to game via the Character Vault or the Transmogrifier.&nbsp; 2) Fewer problems, Collection tab macros have limitations. For example: HTML entities will revert the HTML entity, which defeats the purpose of using the HTML entity. Ability macros do not have this limitation.&nbsp; Source: <a href="https://wiki.roll20.net/Macros" rel="nofollow">https://wiki.roll20.net/Macros</a> This is a problem you will be running into if you continue trying to nest Collection tab macros inside queries.&nbsp; 3) Everyone in your game can be set up to use the Macro Mule, this allows you to not duplicate macros for your players, they are all set up using the same base macro.&nbsp; 4) Related to #3, if you make a change to a macro it doesn't have to be duplicated for each player in your game.&nbsp; There are probably more, but that is a good short list.&nbsp; As for chat buttons, another method of doing things, they avoid a number of the problems that you are running into.&nbsp; 1) IIRC, they can be set up to re-use rolls, something you cannot do with your current macro setup.&nbsp; 2) They avoid many of the problems of nesting macros in queries. They are much simpler.&nbsp; Oh! Thank you for the clarification! I am fairly new to Macros so thank you for your patience! 1: you blew my mind with the Macro Mule! I love that idea and will defiantly give it a try it! 2: Even with using the macros in Attributes and Abilities I can't get things to nest properly&nbsp; here is what I have: Character Name; Milo Osto Attack [[1d20+?{attack modifier|5}]] Damage [[1d10+?{damage modifier|5}]] Choose ?{which ability |Attack,%{Milo Osto|Attack} |Damage,%{Milo Osto|Damage} } this results in a few errors depending on which options I select. 3: Another thing I observed is that using templates seems to make this issue worse or make it more visible. I don't mind not having templates but I do think it makes things look neater and easier to read. Can you see what I am doing wrong? The Example in the nesting Macros you linked me works fine, but it doesn't have queries being nested
1667483128

Edited 1667483585
Gauss
Forum Champion
Ok, here is what you see: ?{which ability |Attack,%{Milo Osto|Attack} |Damage,%{Milo Osto|Damage} } Here is what Roll20 sees:&nbsp; ?{which ability |Attack, [[1d20+?{attack modifier|5}]] &nbsp;|Damage, [[1d10+?{damage modifier|5}]] &nbsp;} This is what Roll20 sees when parsing the query:&nbsp; ?{which ability |Attack, [[1d20+?{attack modifier|5 } I bolded the problem. It is the "}" at the end of your first embedded query. That tells the main query 'all done, look no further'.&nbsp; To solve it you have to use HTML entities.&nbsp; <a href="https://wiki.roll20.net/HTML_Entities" rel="nofollow">https://wiki.roll20.net/HTML_Entities</a> So change your attack and damage macros to: (bolded to draw your attention to the solution) Attack [[1d20+?{attack modifier|5 &amp;#125; ]] Damage [[1d10+?{damage modifier|5 &amp;#125; ]] Then Roll20 will see this:&nbsp; ?{which ability |Attack, [[1d20+?{attack modifier|5 &amp;#125; ]] &nbsp;|Damage, [[1d10+?{damage modifier|5 &amp;#125; ]] &nbsp;} And it will work (usually).&nbsp; IF that does not work, because anything with HTML entities can get tricky fast, the next step is chat buttons.&nbsp;
Gauss said: Ok, here is what you see: ?{which ability |Attack,%{Milo Osto|Attack} |Damage,%{Milo Osto|Damage} } Here is what Roll20 sees:&nbsp; ?{which ability |Attack, [[1d20+?{attack modifier|5}]] &nbsp;|Damage, [[1d10+?{damage modifier|5}]] &nbsp;} This is what Roll20 sees when parsing the query:&nbsp; ?{which ability |Attack, [[1d20+?{attack modifier|5 } I bolded the problem. It is the "}" at the end of your first embedded query. That tells the main query 'all done, look no further'.&nbsp; To solve it you have to use HTML entities.&nbsp; <a href="https://wiki.roll20.net/HTML_Entities" rel="nofollow">https://wiki.roll20.net/HTML_Entities</a> So change your attack and damage macros to: (bolded to draw your attention to the solution) Attack [[1d20+?{attack modifier|5 &amp;#125; ]] Damage [[1d10+?{damage modifier|5 &amp;#125; ]] Then Roll20 will see this:&nbsp; ?{which ability |Attack, [[1d20+?{attack modifier|5 &amp;#125; ]] &nbsp;|Damage, [[1d10+?{damage modifier|5 &amp;#125; ]] &nbsp;} And it will work (usually).&nbsp; IF that does not work, because anything with HTML entities can get tricky fast, the next step is chat buttons.&nbsp; Works a Treat! thanks a lot for your patience!