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

Nesting Abilities Within A Macro

Just spent a few hours trying do accomplish something specific, and I'm running my head into the wall at every turn. What I'm trying to do is create a macro that can let me chose between a selected token's various abilities.

Something along the lines of...
Attack
?{Which Attack?|Attack 1,%{Selected|Attack1|Attack 2,%{Selected|Attack2|Attack 3,%{Selected|Attack3}}

I got as far as reading on the wiki "Roll Queries currently end at the first closing 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 (see notes below)."

But I can't figure out which characters are "problematic" and which aren't. Any chance someone could lend a hand here?
March 02 (9 years ago)
Hi, Fraust. If you read a bit further in Advanced Usage for Roll Queries, you'll see that Ability calls (e.g. %{Selected|Attack1}) are not problematic to Roll Queries per se. What is often problematic are the values of the Abilities. This case is directly addressed in Roll Query Troubleshooting.

Please let me know if you find anything in those sections unclear.
Yeah, sorry I wasn't more clear, but I read the rest of it and it isn't making sense to me.
March 02 (9 years ago)
That's okay!

Please let me know if reading through those sheds some more light on Advanced Usage for Roll Queries and Roll Query Troubleshooting.
Thanks for the help so far Silvyre, though I'm still not really getting it. Mostly, I'm not really sure what are the calls and what are the values in what I'm trying to do here.

Also, I keep seeing reference to rolling templates, and I don't think what I'm trying to do should have anything to do with those...so either I'm not articulating my intent well enough, or maybe a roll template is the only/best way to do it?

The purpose behind the macro, is to have a generic attack macro in my Pathfinder game for monsters/NPCs. What I'd like it to do is result in a simple drop down menu with maybe 5 to 10 selections that correspond to separate abilities on various monster/NPC journals. So the menu options will be Attack 1, Attack 2, Attack 3, Attack 4, Attack 5...and  on the Bugbear Stalker the Attack 1 ability will be his morning star adjusted for power attack, and Attack 2 will be his morning star without power attack...then the Drow Sniper will have Attack 1 as their heavy xbow with sneak attack damage, and his Attack 2 will be a dagger, and so on. So I'll have one macro, "Attack" that shows up as a token action on everything that isn't a PC controlled token, that leads to various abilities...rather than just having all the various attacks from a given creature show up as token actions.

The ultimate goal is to click on a token and only see maybe 3 token actions. Attack, Saves, Spells...as opposed to what I have right now, where I click on the token of an NPC and each spell is its own token action, and each attack is its own token action.
March 02 (9 years ago)

Edited March 02 (9 years ago)

Fraust said:

Mostly, I'm not really sure what are the calls and what are the values in what I'm trying to do here.

Let's say Bugbear Stalker uses an Attribute on its Attributes & Abilities Tab to track its Hit Points.
Let's say we give that Attribute a Name "HP" and a Current value of 10:



As this is an Attribute, the call @{Bugbear Stalker|HP} outputs (i.e. is parsed to, or converted to) the value 10 when used in an Ability/Macro (or otherwise sent to the text chat).

Likewise,




Fraust said:

Also, I keep seeing reference to rolling templates, and I don't think what I'm trying to do should have anything to do with those...

Perhaps not, but I've found that many users run into the issues that you're having when attempting to nest macros which use Roll Templates. Regardless, I hold that the examples given which use Roll Templates can definitely prove insightful to anyone who is learning Advanced Usage for Roll Queries or is attempting Roll Query Troubleshooting.
March 03 (9 years ago)

Edited March 03 (9 years ago)
I also wrote a pretty in-depth breakdown along with big examples of how far you can push these:
https://docs.google.com/document/d/1zO_X2eWnfclroHPUC26Q4Mk3BKgj2JvKrWZ18p3sRf4/edit?usp=sharing

The guide starts with a huge example and breaks it apart for showing how simple it is to build step by step, and shows how it works.
Encartrus...thank you for the link. I'm starting to sorta kinda hammer something together, but I can't get any of the sample macros to work (went through and added the right attributes). Does this require a pro account or anything along those lines?
March 07 (9 years ago)

Fraust said:

Does this require a pro account or anything along those lines?

PowerCards is an API Script. Access to the API is available in games in which the Creator is an active Pro subscriber.
That's what I was afraid of, thanks Silvyre.
March 08 (9 years ago)
No problem; did you still need any help with your macro?
I think what I'm trying to do isn't going to work, but I've learned a few new tricks that help out.
March 08 (9 years ago)
What you want to do will work... you just need to re-read the advance query usage stuff and try to get it to work with one ability and then add the rest.
HoneyBadger...it's possible to nest an ability call within a macro?

March 08 (9 years ago)

Edited March 08 (9 years ago)
Yeah. It's possible. I'm in a game at the moment and don't have time to show the whole example, but I will later.
What i have found when creating my macros that I want to nest is they need to be created in your Macro section of the setting tab.  Not in the character sheets tab.  When I discovered that the nesting worked as shown. 

With your instance #attack1 might need to be 2 different macros unless you wanted to create variables to ask for power attack & sneak attack each time the macro was used (which should be possible).
GOT IT!! Finally! Not sure why this didn't click sooner, but yeah...after looking at Clint's reply I realized what I was doing wrong. Basically, when I went through and did the replacements for the | and } at the right time, I was writing the macro in a character ability, and when I was writing them up in the macro section, I wasn't replacing them. So yeah, I'm an idiot :)

Huge thanks to everyone who put up with me on this!
March 09 (9 years ago)
Great, Fraust!
Fraust, do you mind posting what you ended up getting to work?
March 14 (9 years ago)
I'd like to see what you did as well. I'm having the same problem with a dropdown list of macros.
Sorry I didn't see the questions until recently, but yeah, I don't mind at all. A lot of it was just figuring out where to put things and when to replace which characters...

In my list of Macros in the Settings tab, I have one called "Melee-Attack", which is set to Show as Token Action. This is what the coding in the macro looks like.

?{Attacks|@{selected|MeleeAttack1},%{selected|MeleeAttack1}|@{selected|MeleeAttack2},%{selected|MeleeAttack2}|@{selected|MeleeAttack3},%{selected|MeleeAttack3}|@{selected|MeleeAttack4},%{selected|MeleeAttack4}|@{selected|MeleeAttack5},%{selected|MeleeAttack5}}

Then, each NPC or Monster I create has both an Attribute and an Ability called "MeleeAttack1" as well as "MeleeAttack2" and so on. 

For a town guard type NPC, the current value of the Attribute "MeleeAttack1" would be "Cudgel Standard". Then the Ability "MeleeAttack1" would be the town guard attacking with his cudgel as a standard action (using the Pathfinder rule set)...So might look something like...

/emas Town Guard bashes ?{Target|you} with his cudgel.
Hitting AC [[1d20+14+?{To Hit|0}]], doing  [[1d6+13+?{To Damage|0}]] damage.

This will give you three prompts when you activate the Ability...it'll ask you to put down who the guard is attacking, with the default saying "you", it'll ask you for a modifier on the To Hit roll defaulting to 0, and for a modifier on the To Damage roll again defaulting to 0.

The above Ability will work fine as an independent Ability, but if you leave it as is and then try to use the Macro, your drop down menu gets all garbled. In order for things to work smoothly, you have to change it to the following.

/emas Town Guard bashes ?{Target|you} with his cudgel.
Hitting AC [[1d20+14+?{To Hit|0}]] doing [[1d6+13+?{To Damage|0} damage.

So all we did was change "|" to "|" and "}" to "}"

Then, if the Town Guard doesn't have four more distinct melee attacks, set the current value of the unused Attributes to NA. For the unused Abilities just don't put anything where you would normally put the coding.

Did that help at all?