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 you nest query boxes? Making an all-out attack button

I'm making a macro to make an easy all-out attack button for the Persona tabletop RPG that's in development. An all-out attack involves every party member not afflicted with a status effect making a single melee attack against all downed targets. As long as you have two combatants, you can make an all-out attack when every enemy is downed. So this macro functions as I intend it, for two combatants: /me orders an all-out attack! Everyone rushes in to deal [[@{Melee Damage}+@{Athleticism}+@{target|Melee Damage}+?{What's their attacking stat?| Athleticism, @{target|Athleticism}| Proficiency, @{target|Proficiency}| Guts, @{target|Guts}| Knowledge, @{target|Knowledge}| Charm, @{target|Charm}}]] melee damage to everything! The problem arises when I try providing an escape for if there are only two combatants, but there might be a third or fourth. /me orders an all-out attack! Everyone rushes in to deal [[@{Melee Damage}+@{Athleticism}+@{target|Melee Damage}+?{What's their attacking stat?| Athleticism, @{target|Athleticism}| Proficiency, @{target|Proficiency}| Guts, @{target|Guts}| Knowledge, @{target|Knowledge}| Charm, @{target|Charm}}+?{Another attacker?|No, 0|Yes, +@{target|Melee Damage}+?{What's their attacking stat?| Athleticism, @{target|Athleticism}| Proficiency, @{target|Proficiency}| Guts, @{target|Guts}| Knowledge, @{target|Knowledge}| Charm, @{target|Charm}}]] melee damage to everything! This combines the dialog boxes like this: and that's definitely not intentional. The rest of the macro is supposed to be under Yes, with a separate attacking stat dialog box every time. So it's supposed to go, 1) first person rolls damage (he's assumed to be the macro executor, thus it just assumes Athleticism bc it's his best stat), plus 2) target the second person to roll their damage and ask what their stat is, plus 3) ask if there's another attacker, if not then end the macro. If so then 4) target the third person to roll their damage and ask what their stat is, plus 5) ask if there's another attacker, if not then end the macro. If so then 6) target the fourth person to roll their damage and ask what their stat is, then 7) sum everything into one number I'm not sure if that order of operations is easily understood
1597775583
GiGs
Pro
Sheet Author
API Scripter
Nesting queries is a problem, because roll20 itself doesnt recognise the nesting. The commas and | in your nested query are being used by the first query. It is possible to solve this, but it's very tricky - you have to master html replacements as described here:&nbsp; <a href="https://wiki.roll20.net/Macros#Advanced_Usage_for_Roll_Queries" rel="nofollow">https://wiki.roll20.net/Macros#Advanced_Usage_for_Roll_Queries</a> two better alternatives are: See if you can structure your macro differently, so the nest query isnt nested at all - but comes after the first query finishes. Look into Chat Menu Buttons as described here:&nbsp; <a href="https://app.roll20.net/forum/permalink/5927072/" rel="nofollow">https://app.roll20.net/forum/permalink/5927072/</a> Most people generally switch away from queries to chat menus, because they are so much simpler to create. If you want to keep using nested queries (I dont recommend it), Scott created a tool to make it easier to build them, linked here:&nbsp;<a href="https://app.roll20.net/forum/permalink/6582632/" rel="nofollow">https://app.roll20.net/forum/permalink/6582632/</a>
I think I'm stuck on trying to get the macro structured so the query comes after the first query. I tried HTML replacement, but I think the specifics of it are escaping me, and I run into a different issue when I try using it. One was where the entire nested query showed up in the dropdown box, and another was where it gets stuck on targeting the next attacker.
1597779663
GiGs
Pro
Sheet Author
API Scripter
The fact that you might have two or three or even four attackers, means the nesting would get pretty much impossible to deal with, with html substitutions. You are much better off creating a button in chat for an attack macro, and then you can click that button once for each attack.
1597779782

Edited 1597780190
Matt
Pro
I think I get what you mean by not having queries nested, but now I'm running into the issue where the second @{target|Melee Damage} is functioning as an escape unintentionally. /me orders an all-out attack! Everyone rushes in to deal [[@{Melee Damage}+@{Athleticism}+@{target|Melee Damage}+?{What's their attacking stat?| Athleticism, @{target|Athleticism}| Proficiency, @{target|Proficiency}| Guts, @{target|Guts}| Knowledge, @{target|Knowledge}| Charm, @{target|Charm}}+?{Another attacker?|No, 0|Yes, +@{target|Melee Damage}}+?{What's their attacking stat?| No Attacker, 0| Athleticism, @{target|Athleticism}| Proficiency, @{target|Proficiency}| Guts, @{target|Guts}| Knowledge, @{target|Knowledge}| Charm, @{target|Charm}}+?{Another attacker?|No, 0|Yes, +@{target|Melee Damage}}+?{What's their attacking stat?| No Attacker, 0| Athleticism, @{target|Athleticism}| Proficiency, @{target|Proficiency}| Guts, @{target|Guts}| Knowledge, @{target|Knowledge}| Charm, @{target|Charm}}]] melee damage to everything! Not sure if it's fixable. EDIT: I mean that it processes the macro without any additions after I select the second target, so it seems like putting it in a query box isn't working. And even then, something in here is broken.
So the post editing UI is just refusing to update my post now for some reason, but I fixed the broken equation by removing the redundant + from inside the query. The second target|melee damage still ends the macro early though.
1597781863
GiGs
Pro
Sheet Author
API Scripter
You cant use exactly the same name for a different query, It will use the result of the first query with that name. So the two queries like this: +?{Another attacker?|No, 0|Yes, +@{target|Melee Damage}} are considered by roll20 to be the same query. I'd recommand changing the names to "a second attacker?" and "a third attacker?" so they are unique. The same problem applies to the queries named "Whats their attacking stat?" Once you get them sorted you have another problem. No matter what people answer to the "another attacker?" queries, the rest of the macro will still run. People will be prompted for the attacking stats of the 2nd third, etc attackers, even if there is only one attacker. This is case where nested queries actually make sense, but are too hard to write.
1597782385

Edited 1597782917
Ziechael
Forum Champion
Sheet Author
API Scripter
You have an issue with repeated queries too, every time you ask the exact same question it will reuse the answer from the first instance. ?{What's their attacking Stat?|options...} will not generate different answers when asked later on. Your overall macro would need to look something like: /me orders an all-out attack! Everyone rushes in to deal [[@{Melee Damage}+@{Athleticism}+@{target|First attacker|Melee Damage}+?{What's their attacking stat?| Athleticism, @{target|First attacker|Athleticism}| Proficiency, @{target|First attacker|Proficiency}| Guts, @{target|First attacker|Guts}| Knowledge, @{target|First attacker|Knowledge}| Charm, @{target|First attacker|Charm}}+?{Another attacker?|No, 0|Yes, +@{target|Second attacker|Melee Damage}+?{What's their attacking stat? &amp;#124; Athleticism&amp;#44; @{target|Second attacker|Athleticism}&amp;#124; Proficiency&amp;#44; @{target|Second attacker|Proficiency}&amp;#124; Guts&amp;#44; @{target|Second attacker|Guts}&amp;#124; Knowledge&amp;#44; @{target|Second attacker|Knowledge}&amp;#124; Charm&amp;#44; @{target|Second attacker|Charm}&amp;#125;}+?{Another attacker? |No, 0|Yes, +@{target|Third attacker|Melee Damage}+?{What's their attacking stat?&nbsp; &amp;#124; Athleticism&amp;#44; @{target|Third attacker|Athleticism}&amp;#124; Proficiency&amp;#44; @{target|Third attacker|Proficiency}&amp;#124; Guts&amp;#44; @{target|Third attacker|Guts}&amp;#124; Knowledge&amp;#44; @{target|Third attacker|Knowledge}&amp;#124; Charm&amp;#44; @{target|Third attacker|Charm}&amp;#125;}]] melee damage to everything! Note how the repeated queries have spaces after the question... this should &nbsp;trick Roll20 into seeing them as different questions while allowing them to remain visually similar. (Failing the above working, just change a word or add an identifier to the queries that makes the 100% unique)
1597782524
Ziechael
Forum Champion
Sheet Author
API Scripter
You could go further by nesting the 3rd attacker query within the 'yes' result of the 2nd attack query so you don't have to answer so many questions but then you get into the double nesting territory and a whole world of &amp;amp;#... hurt... happy to give an example if you want to go that route but right now, I sleep!
1597782820
Ziechael
Forum Champion
Sheet Author
API Scripter
Just tested it quick and it isn't quite right... using multiple target calls make things happen a bit janky too... will have more of a play on the morrow
1597784594

Edited 1597784696
Matt
Pro
Y e a h , I t r i e d c h a n g i n g i t t o t h i s / m e o r d e r s a n a l l - o u t a t t a c k ! E v e r y o n e r u s h e s i n t o d e a l [ [ @ { M e l e e D a m a g e } + @ { A t h l e t i c i s m } + @ { t a r g e t | M e l e e D a m a g e } + ? { W h a t ' s t h e i r a t t a c k i n g s t a t ? | A t h l e t i c i s m , @ { t a r g e t | A t h l e t i c i s m } | P r o f i c i e n c y , @ { t a r g e t | P r o f i c i e n c y } | G u t s , @ { t a r g e t | G u t s } | K n o w l e d g e , @ { t a r g e t | K n o w l e d g e } | C h a r m , @ { t a r g e t | C h a r m } } + ? { T h i r d a t t a c k e r ? | N o , 0 | Y e s , @ { t a r g e t | M e l e e D a m a g e } } + ? { T h i r d a t t a c k e r ' s s t a t ? | N o A t t a c k e r , 0 | A t h l e t i c i s m , @ { t a r g e t | A t h l e t i c i s m } | P r o f i c i e n c y , @ { t a r g e t | P r o f i c i e n c y } | G u t s , @ { t a r g e t | G u t s } | K n o w l e d g e , @ { t a r g e t | K n o w l e d g e } | C h a r m , @ { t a r g e t | C h a r m } } + ? { F o u r t h a t t a c k e r ? | N o , 0 | Y e s , @ { t a r g e t | M e l e e D a m a g e } } + ? { F o u r t h a t t a c k e r ' s s t a t ? | N o A t t a c k e r , 0 | A t h l e t i c i s m , @ { t a r g e t | A t h l e t i c i s m } | P r o f i c i e n c y , @ { t a r g e t | P r o f i c i e n c y } | G u t s , @ { t a r g e t | G u t s } | K n o w l e d g e , @ { t a r g e t | K n o w l e d g e } | C h a r m , @ { t a r g e t | C h a r m } } ] ] m e l e e d a m a g e t o e v e r y t h i n g ! I ' m n o t i c i n g t h a t t h e t a r g e t i n g r e t i c l e a n d p r o m p t s t a y s u p w h i l e p r o g r e s s i n g t h r o u g h t h e m a c r o , e v e n t h o u g h i t p r o b a b l y s h o u l d n ' t , a n d i t d i d n ' t a c t u a l l y r o l l a n y t h i n g f r o m t h e t h i r d a t t a c k e r o r f o u r t h a t t a c k e r . I could also hypothetically change it to reference specific characters and just have the order be static and maintain the macro regularly in case they change weapon types or something. Then it could be 'Include character #2?' 'Include character #3?' etc
1597798357
Oosh
Sheet Author
API Scripter
That's probably a better way of structuring it, if you reliably have the same people showing up. Something like: &amp;{template:default} {{name=All Out Attack}} {{Alice=?{Is Alice attacking?|Yes,[[ [alice attack roll math] ]] |No,Not attacking}}} {{Bob=?{Is Bob attacking?|Yes,[[ [bob attack roll math] ]] |No,Not attacking}}} And so on for all the characters. As you mentioned, they might change weapons, or might miss a session or drop out or whatever. An option would be to store {{Alice=?{Is Alice attacking?|Yes,[[ [alice attack roll math] ]] |No,Not attacking}}} as an Ability on their sheet, called Attack1 or similar. Your main macro would then look like: &amp;{template:default} {{name=All Out Attack}} %{Alice|Attack1} %{Bob|Attack1} making it a bit simpler to add or remove players, and a bit simpler to change one player's attack without sifting through the whole lot. Just make sure there's no line breaks in the abilities or they will end the template.
1597824835
Ziechael
Forum Champion
Sheet Author
API Scripter
Woke up this morning with a plan to nail this but totally agree with Oosh, if this is for players and has a rarely changing set of easy to hardcode values I'd do that... using targets (specifically multiple targets) in a nested query is just a bridge too far in complexity... not that I'm giving up, my OCD won't allow it ;)