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

Nested Macros

1598628517

Edited 1598633233
I have a character ability token action calling a macro which works fine with a fixed number of dice: **@{selected|name} sprays @{target|name} with buckshot!** /roll ?{Target Number?|      4+, 3 t[AttackDice4+]|      5+, 3 t[AttackDice5+]} /fx bubbling-smoke @{target|token_id} ``STANDARD ATTACK - no special rules`` ...but it breaks when I try to incorporate the below bolded query: **@{selected|name} sprays @{target|name} with buckshot!** /roll ?{Target Number?|      4+, (?{Attack Dice}) t[AttackDice4+]|      5+, (?{Attack Dice}) t[AttackDice5+]} /fx bubbling-smoke @{target|token_id} ``STANDARD ATTACK - no special rules`` Is there something I'm missing? EDIT:  To provide some additional context, here's the character ability that calls this macro: ?{Which attack?|      Fire SMG,#AttackSMG |      Fire Shotgun,#AttackShotgun |      Fire Handgun(s),#AttackHandgun } "#AttackSMG" is the one that works, as that weapon has fixed damage dice.  "#AttackShotgun" and "#AttackHandgun" can vary based on range and number of shooters, so they're giving me problems.
I really wish roll20 would just write a macro parser that handled nested macros correctly.  This stuff isn't rocket science.
1598655079

Edited 1598655112
GiGs
Pro
Sheet Author
API Scripter
The problem here is you have a query inside a query inside a query, so you need to increase the level of html substitution. Look up Chat Menus, they are a much better way of handling these situations. You create your attack macros normally, no html substitutions necessary. Then you have a macro that replaces your dropdown selection menu: it whispers a set of buttons to you in chat, one for each macro, and you click the attack you want to make. PS: Alan, I agree completely. This really should be a solved problem on roll20's end.
It took me a bit to start getting a handle on the Chat Menus, but I've managed some successful tests and it seems to be exactly what I'm looking for.  Thanks!
One quick follow-up on this, as I very nearly have everything working how I want.  Here's my macro: /w @{selected|name} &{template:default} {{name=@{selected|name} Activation Menu}} {{Movement: [Skid Check](~Mechanicros|Skid) Combat: [Attack](%{selected|Attack}) [Evade](~Mechanicros|Evade) |[Slip Away](~Vehicros|SlipAwayAct) Wrecking: [Flip Check](~Mechanicros|Flip) [Explode Check](~Mechanicros|ExplCheck) [Explosion Damage](~Attacros|ExplMiddle)}} The bolded line is breaking the macro.  Each vehicle will have customized Attack macros containing the specific weapons / attack abilities they can perform.  I can get it to work if I use the character name (e.g.  [Attack](~Burnout|Attack) , but   what would be the correct syntax to have it use the "Attack" ability macro from the selected token, so I can utilize the macro across multiple characters without having to customize it for each sheet? Thanks!
1598828978
Oosh
Sheet Author
API Scripter
You've almost got it, you just have to match the syntax of your other buttons: [Attack] (~selected|Attack) %{selected|Attack} is the correct syntax to call an ability to chat, but we need to use (~selected|Attack) for a command button.