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] [OGL] Making a query macro for the atkdmg template

Hey all In order to not have my attacks & spell casting menu cluttered with entries, I wanted to create a macro that let me choose from the available entries to attack. Unfortunately, the attack macros in itself works, but the moment I try to make a query out it, it is not working as intended. Meaning, I cannot select (in this example) between the two options. I think it might have something to to with order, but for the love of it I have yet failed to understand what i am doing wrong. ?{Projectile |Spear, &{template:atkdmg} {{mod=+[[@{dexterity_mod}+@{pb}]]}} {{rname=Spear}} {{r1=[[1d20cs>20+@{dexterity_mod}+@{pb}]]}} @{rtype} {{r2=[[1d20cs>20+@{dexterity_mod}+@{pb}]]}} {{attack=1}} {{range= 6m/20ft - 18m/60ft}} {{damage=1}} {{dmg1flag=1}} {{dmg1=[[1d6+@{dexterity_mod}]]}} {{dmg1type=Piercing}} {{crit1=[[1d6+@{dexterity_mod}]]}} {{charname=Returner}} | Bolt, &{template:atkdmg} {{mod=+[[@{dexterity_mod}+@{pb}]]}} {{rname=Bolt}} {{r1=[[1d20cs>20+@{dexterity_mod}+@{pb}]]}} @{rtype} {{r2=[[1d20cs>20+@{dexterity_mod}+@{pb}]]}} {{attack=1}} {{range= 6m/20ft - 18m/60ft}} {{damage=1}} {{dmg1flag=1}} {{dmg1=[[1d8+@{dexterity_mod}]]}} {{dmg1type=Piercing}} {{crit1=[[1d8+@{dexterity_mod}]]}}{{charname=Returner}} } Thanks in advance for any assistance.  
1594947505

Edited 1594947671
Queries are rather finicky in the way they accept coding, so a better option would be to set yourself up with a clickable chat menu. As long as all of the attacks are either in the Attacks/Spellcasting section of your sheet or Macros set up as Abilities (in the Attributes and Abilities tab) you can reference them as a button. Here's the macro I use to get the above chat entry (the bold parts are the framework): /w Carric 0&{template:npcaction} {{name=Attacks}} {{description=**Melee Attacks** [ Crow-Sword ](~ Carric|repeating_attack_-M2ZjZWtVkVSQaSuVEhP_attack ) | [ Rapier ](~ Carric|repeating_attack_-M2ZgyXazjJcZV6CoHAz_attack ) | [ Mace ](~ Carric|repeating_attack_-M41aoYQ2-lpVB3-dZq6_attack ) | [ Dagger ](~ Carric|repeating_attack_-M2ZnQZZULWSVqOuzmLi_attack ) **Ranged Attacks** [ Longbow ](~ Carric|repeating_attack_-M2ZjgrDxnWZJowzv8o3_attack ) | [ Dagger ](~ Carric|repeating_attack_-M2ZnQZZULWSVqOuzmLi_attack ) | [ Crow-Dart ](~ Carric|repeating_attack_-M2ctnaKIVn2XyZvIJXX_attack )}} If you aren't familiar with buttons, the brackets enclose the name that will appear on the button and the parentheses enclose what the button will activate. You always fill it with ~<character name>|<roll location index or Ability name>. To find the roll location index (not sure that's what it's really called, that's just what I call it) drag a rollable ability from your sheet to the Macro bar on the VTT (enable it in the Collections tab if it's not already open). It will give you the sheet's name followed by a string similar to what you see above. If you instead have a custom macro set as an Ability on your sheet you would simply use the name of the ability (which must be unique from any roll commands native to the sheet, like you can't name an ability Initiative or Strength). I have additional chat menus for saving throws, skills, ability checks, and whatever else I feel a character needs quick access to, all accessible as token buttons for ease of use.
1594948141

Edited 1594953166
David M.
Pro
API Scripter
EDIT - ninja'd! Dakota gives alternative good examples for setting the chat buttons up using repeating attacks, which I didn't cover.  In general, returning a template from a query is going to get ugly fast. Pretty sure you have to start using html replacements for the }, |, and comma characters. Plus, it gets pretty tricky to organize and edit later without messing things up. Adding a third option, for example, will really suck to set up. I would recommend using chat menu buttons, with the commands all within character ability macros. First you create two abilities, for example ReturnerAttack and BoltAttack ReturnerAttack  &{template:atkdmg} {{mod=+[[@{dexterity_mod}+@{pb}]]}} {{rname=Returner}} {{r1=[[@{d20}cs>20 + @{dexterity_mod}[DEX]+@{pb}[PROF]]]}} @{rtype}cs>20 + @{dexterity_mod}[DEX]+@{pb}[PROF]]]}} {{attack=1}} {{range=6m/20ft - 18m/60ft}} {{damage=1}} {{dmg1flag=1}} {{dmg1=[[1d6+@{dexterity_mod}[DEX]]]}} {{dmg1type=Piercing}} {{crit1=[[1d6[CRIT]]]}} BoltAttack &{template:atkdmg} {{mod=+[[@{dexterity_mod}+@{pb}]]}} {{rname=Bolt}} {{r1=[[@{d20}cs>20 + @{dexterity_mod}[DEX]+@{pb}[PROF]]]}} @{rtype}cs>20 + @{dexterity_mod}[DEX]+@{pb}[PROF]]]}} {{attack=1}} {{range=6m/20ft - 18m/60ft}} {{damage=1}} {{dmg1flag=1}} {{dmg1=[[1d8+@{dexterity_mod}[DEX]]]}} {{dmg1type=Piercing}} {{crit1=[[1d8[CRIT]]]}} Then make a third ability macro that gives a title and two buttons, one corresponding to each ability macro. RangedAttackOptions ( You could use whatever template you want. Default, etc. I used the npcaction template in this example) &{template:npcaction} {{name=Ranged Attack Options}} {{description=[Returner](~ReturnerAttack) [Bolt](~BoltAttack)}} Output from RangedAttackOptions: When you click the Bolt button, here is the output (note my character sheet is set up to always roll advantage, but the code above will grab your settings from the character sheet automatically) Doing it this way allows you to easily add additional options, without going crazy troubleshooting gigantic macros :)
Wow, thanks alot!  Yeah indeed, this system is way more viable than anything I could have come up with. Works like a charm now~