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

[5e Community] Drop Down [Query] Macros for Multiple Attacks

October 10 (8 years ago)
First time poster, first time Roll20 GM so please excuse the lack of correct terminology.

I'm using the following 5e character sheet, specifically to create a monster template. What I am trying to do is create a macro that presents the GM with monster attack options. For instance, let's say my monster has 3 attack options. 2 of them can be used as part of a multi-attack action. The other is a standalone action. Instead of having three macro buttons, one for each attack option, I want one with two options: option A, multi-attack (which would roll the corresponding two attacks) and option B (which in turn rolls the appropriate attack). I've already set up the attacks through the character sheet but I suspect the problem is the nested pipe "|" symbols. I tried to escape them by using the appropriate HTML entity but that ends up throwing another error. I scoured the internet for hours but none of my examples showed nested pipe symbols. I even tried creating variables to hold the attack rolls and leverage them from within the query line but but alas I am defeated. Hoping you guys can chime in with some working code.
October 10 (8 years ago)

Edited October 10 (8 years ago)
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
I would suggest ability command buttons for this instead of drop down menus as you don't have to worry about html escapes.

Also, I can't really describe the drop down stuff on my phone.

Aaaand, now I'm back on my comp.

For the dropdown, you would need to replace every comma, bar, and curly end bracket in the called attack that wasn't part of an attribute or ability call (@{...} or %{...} respectively. If you are using a sheet generated ability, this may not be possible as most sheets don't expose the macro text of their abilities to the user. I have not used that 5e sheet, so I have no idea if it does or not.

If you do have access to the macro text for the sheet generated ability, you may find the google sheet I link to in this post helpful for doing html replacements.

If you are still having problems, I'll need a few things from you to help out
  1. Post up a copy of the macro text you are using (with html replacements intact) or post a link to a gist/pastebin of it and I'll see if I can spot anything
  2. Screenshots of
    1. What is output to chat when you trigger the query
    2. What appears in the dropdown prompt (with the dropdown expanded out)
Good luck,

Scott
October 11 (8 years ago)

Edited October 11 (8 years ago)
Thanks for the quick response. I replaced every non-letter between the query's {}s and now the dialog shows me the correct syntax but its not firing.

The code is on pastebin. See below for screenshot of latest output.



It feels like I'm close...
October 11 (8 years ago)
Tetsuo
Forum Champion

Advanced Usage For Roll Queries said:

Roll Queries currently end at the first closing curly brace the parser encounters. Within a Roll Query, other characters that serve as Roll Query syntax (vertical bars and commas) will always be treated as such by the parser, potentially causing unwanted behavior when placed within the Roll Query for other purposes. To work around this, replace some but not all of these "problematic" characters with their HTML entities 
I would suggest checking out the wiki as a good starting point for what symbols to replace and why. Specifically, this caught my eye:
Due to the order of operations, calls (i.e. @{Attribute}, %{Ability}, #Macro) are parsed to their values before Roll Queries are executed. So, you would need to HTML escape the related calls (ie: NPCaction 1 and NPCaction 3) if you want to call them in a drop down. 

(I'm pretty sure. I'm personally newish to html escaping, so my grasp is tenative at best)

October 11 (8 years ago)

Edited October 11 (8 years ago)
You're calling  %{Selected|NPCAction1} within a drop-down query.  Unless that ability also contains HTML escapes, it will break the drop-down.  That might be one issue. 

Also, I believe you only need to HTML Entity replace  ,   }  and |   (when not used as part of a variable call)  You're doing html replacements for square braces and other characters that are fine as-is.

October 11 (8 years ago)
Ziechael
Forum Champion
Sheet Author
API Scripter
Not sure the [[ ]]  are necessary around the ability calls either, in my testing doing that causes the call to hang rather than fire fully.
October 11 (8 years ago)

Edited October 11 (8 years ago)
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
Franky, Mark, and Ziechael have the right of it.

You're actually doing too much escaping and in the wrong place. You don't want to escape problem characters that are part of the roll query, only those that are part of options or values within the roll query. Also, as Mark said above, the only characters that should be replaced are commas, end curly braces, and bars. So your roll query from pastebin should look like this:
?{Select an Attack Option: |Multiattack, %{Selected|NPCAction1} |Cleanse the Flesh and Spirit, %{Selected|NPCAction3}}

As Mark mentioned you need to replace the problem characters that are in NPCAction# (note not the characters that are part of the call).

So, if your NPCAction1 was:
&{template:default} {{name=Attack | Claws}} {{Roll = [[1d20]]}} {{Damage=[[2d10]], fire}}

your escaped NPCAction1 would be:
&{template:default} {{name=Attack | Claws}} {{Roll = [[1d20]]}} {{Damage=[[2d10]], fire}}

Note, as I mentioned above, you may not be able to do this calling a sheet generated ability as the macro text may not be exposed and editable.
October 11 (8 years ago)
I've toyed with a few of your suggestions and got the query to display properly but the actions don't fire. I am admitting defeat and will create a button for each attack option...*sigh*.

At least I got my humble spellbook macro to work.

Thanks to everyone that provided insight.
October 11 (8 years ago)
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
Sorry to hear that
October 11 (8 years ago)
Hey don't feel bad, I switched to a button array a long time ago, it's just plain easier. If you make sure the players whispers it to their character then the rest of the players won't get chat spam and it's pretty painless, plus the player can scroll back up and hit the button again to re-used the attack.
October 11 (8 years ago)
The macro was specifically for monsters. My gaming group is present and the roll their dice in the real world. 

So far, the highest number of actions a monster has had is 4 which is manageable as long as I follow a naming convention to keep the actions sorted correctly. 
I personally just use the class actions and copy the secondary attack to its primary.

For example, for a bear, I'll put in bite and claw as melee weapon attacks. I then write a "class action" tied to melee attacks. I call it "Multiattack" and put in the text:
"The bear makes two attacks: one with its bite and one with its claws.
Claws: Melee Weapon Attack: +5 to hit [[d20+5]] | [d20+5]], reach 5 ft., one target. Hit: [[2d6+4]] (2d6 + 4) slashing damage."

When I click on the bite attack, it puts the second attack right below it. During play I then decide whether they would be using the second attack -- typically yes, baring say slow or something.




October 12 (8 years ago)
Brett that's kind of what I'm doing now. I have an "Attack-Multi" button if the creature has multi-attack otherwise its just "Attack-claw" for example. Rinse Repeat as needed for additional attacks.

Have a new problem now that I'm still researching. I'll toss it here before trying to make a new post.

I think all my macro testing goofed up the chat archive. Now nothing displays in the chat window. Not even simple text (e.g. hello world). I thought maybe the archived log size was causing a problem but I just cleared that and chat still doesn't display. Definitely going to be a show stopper if I can't get it fixed.

Anyone else run into the chat not displaying entries (macros or otherwise)? Got a fix? Also, can I disable the the chat log altogether? I didn't see anything under game options or campaign options for this.
October 12 (8 years ago)

Edited October 12 (8 years ago)
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
Yeah, experimenting with html replacements in macros can cause it (at least this is when I notice it happen). Did you clear the chat archive from your game splash screen:

Or just clear the current chat log from in game:

Make sure it was the first one, the second one has no effect.

-Scott
October 12 (8 years ago)
Did both. Still bugged.
October 12 (8 years ago)
After Clearing the game's Chat Archive (note: not Clearing your Current Chat Log), exit and re-enter the game.
this is what i have for npc actions currently and it is broken into two macros calling info from a token connected to a character sheet/npc sheet, now I have had to create 8 custom lines in attribute to execute the simple commands melee1 hit output melee2 damage output if first macro was a hit.

ATTACK
/em The @{selected|npc_name} swiftly attacks you with ?{Which Attack?|Melee,@{selected|melee1} |Ranged,@{selected|ranged1} |Special,@{selected|special1} }
your AC please.

DAMAGE
/em The @{selected|npc_name} swiftly attacks you with ?{Which Attack?|Melee,@{selected|melee2} |Ranged,@{selected|ranged2} |Special,@{selected|special2} }


If you can add onto or simplify this please add. Currently i can attack and damage melee,ranged, or special from multiple different creatures using the same macro. Its just adding the hit and damage lines for melee ranged and special gets time consuming. Unfortunatly you cant call from NPC_Content, it dosnt read it right because its not a macro.