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

Conditional Nested Template Macro Question

February 24 (6 years ago)

Edited February 24 (6 years ago)

Hey Community,

As a PC, I am trying to set up a macro that allows me to select from my many different attacks.
As a simplified example I use something along the lines of:

attack:

?{Weapon?|Sword,#sword |Dagger,#dagger |Bow,#bow }

Furthermore, I have copied the weapon macros from my character sheet.
I modified them slightly, but they all look as follows:

sword:

@{Name|wtype}&{template:atk} {{mod=+5}} etc...

The weapon macro's work fine standing alone,
however when I try to run the "attack" macro I get a pop-up with the following the following:

Weapon?: Sword,&{template:atk


Where "Weapon?:" Is correctly recognized as query,
but the "sword" macro seems to have been expanded and is messing with the structure of the condition.
And as you could have guessed, If I select that option it doesn't work.
Which makes sense, because part of the macro was placed in the name for the conditional option.
("Sword,&{template:atk")
I am confused because it does seem to skip over the wtype correctly, but it gets stuck on the template.
I tried without the template but that only moved the problem to the next option ( {{mod=+5 )
I tried looking around to see how other people fixed this but couldn't find anything.
Has anyone ever had to deal with this before, or does anyone know a work around?

If you have any questions please let me know :)

Kind regards

February 24 (6 years ago)

Edited February 24 (6 years ago)
Andrew C
Marketplace Creator

So the problem is that your Query calls up the macro as it is.
So if your macro has:

&{template:attack}{{name=Bob}}{{roll stuff here}}

then your Query sees

?{Weapon?|Sword, &{template:attack}{{name=Bob}}{{roll stuff here}}|Bow, ... }

and as soon as it gets to the "}" in &{template:attack} the Macro-reader says "Oh the Query is over here. Job Done."

You need to escape code your Macros. So replace the "}" with } and similar for any Pipes and maybe some ampersands.

February 24 (6 years ago)

I am not used to a community that replies this fast. Thanks a lot man :)

February 24 (6 years ago)
Ziechael
Forum Champion
Sheet Author
API Scripter

To expand upon Andrew's answer, you can find the full details for html replacements here.

Additionally there is a lot of merit to utilising a chat menu rather than a nested query as it saves you a LOT of work replacing characters and perfecting the nesting requirements. Worth a look, trust me :)

February 24 (6 years ago)

Edited February 24 (6 years ago)
vÍnce
Pro
Sheet Author

Another option is to just drag/drop your attacks, or any of your sheet's button/rolls for the matter, to the quickbar(rename/colorize if desired).