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

Reference Repeating Attack in Ability macro without using SELECTED

May 15 (5 years ago)

Edited May 17 (5 years ago)

Hi folks,

Wondering if there is a trick to referencing a repeating attack from within an Ability (macro), but without calling "selected"?

Basically to create an ability that can be called without the character token being selected.

I know I can call the attack via:

%{selected|repeating_attack_$0_attack}

But I want to get rid of the "selected".

edit: SOLUTION: 

@{repeating_attack_$0_rollbase}

FROM HERE: https://app.roll20.net/forum/permalink/7457533/

courtesy of Vince!

May 15 (5 years ago)
keithcurtis
Forum Champion
Marketplace Creator
API Scripter

Use the character name:

%{Aragorn|repeating_attack_$0_attack}
May 15 (5 years ago)

Edited May 15 (5 years ago)


keithcurtis said:

Use the character name:

%{Aragorn|repeating_attack_$0_attack}


Right, I think I knew this... can the character name also be a reference though? %{character_name|...} doesn't work.
edit: just wanted to say: I was totally expecting keith to have the answer ;)

May 15 (5 years ago)
The Aaron
Roll20 Production Team
API Scripter

I believe if you use an ability on a character rather than a macro, you can omit the selected and the character name and just use:

%{repeating_attack_$0_attack}

That's certainly true for @{} references.


The Aaron said:

I believe if you use an ability on a character rather than a macro, you can omit the selected and the character name and just use:

%{repeating_attack_$0_attack}

That's certainly true for @{} references.


That's what I thought, but it just results in that statement being sent to chat.

May 15 (5 years ago)

Edited May 15 (5 years ago)
keithcurtis
Forum Champion
Marketplace Creator
API Scripter


Evan said:


keithcurtis said:

Use the character name:

%{Aragorn|repeating_attack_$0_attack}


Right, I think I knew this... can the character name also be a reference though? %{character_name|...} doesn't work.
edit: just wanted to say: I was totally expecting keith to have the answer ;)

Thanks. :D

Not sure how this would be used, then. If the character name is a reference, how does Roll20 know to which character to refer? Both "selected" and the character name are references to which character to affect. Let's try another tack. What are you trying to accomplish with this?



I want to include this in an Abilities macro and I only want to write it once then copy paste into all my players' sheets. It seems like calling an ability from within an Ability should automatically assume the character in question is the one in the sheet the ability is called from in my opinion!
May 16 (5 years ago)

Edited May 16 (5 years ago)

It's possible to reference another ability on the same character with

~abilityname

I don't know if it will work for repeating things though. 

Edit: As The Aaron said you can reference attributes. Every character has an attribute called character_id. So something along the lines of this should work:

%{@{character_id}|repeating_attack_$0_attack}
May 16 (5 years ago)
keithcurtis
Forum Champion
Marketplace Creator
API Scripter

I've tested a zillion different combinations, including Danii's above, and selective HTML replacements. If there's a solution to this, it eludes me. I think you will need to use the selected keyword, unfortunately.

However, the triggering still intrigues me. The players will still need to trigger it somehow. If it's a sheet ability, you have four choices:


1. Have the sheet open to the Abilities tab

The players will need to click the macro from there, but if they have the sheet open, they might as well be on the main page and click the desired ability

2. Use a token macro that calls the ability

This would only appear if the token were selected, so there is no issue in using the selected keyword.

3. Use a Collections macro that calls the ability

Although the collections macro could be made universal, each player would need to add it to their macro bar personally. If made a universal token macro, there would be no keyword issue, as in #2, above.

4. Type the name of the macro in chat

Issues as in 2 & 3 above.


In order for a ability to even work without a token/character selected, Roll20 needs to know which character to reference. At some point you will need to provide that reference. Even if a player could type the macro directly into chat (as #4 above) it doesn't know which character is meant, since one player can control many characters.

I think your best bet is a universal token macro and make sure a token is always available for each character in the game. I have this issue in my own game on my Theater of the Mind page, which only shows a scene, no maps. I solved it by putting tokens in a line across the top of the page, and using the maplock script to lock them in place, so as not to be disruptive.


keithcurtis said:

I've tested a zillion different combinations, including Danii's above, and selective HTML replacements. If there's a solution to this, it eludes me. I think you will need to use the selected keyword, unfortunately.

However, the triggering still intrigues me. The players will still need to trigger it somehow. If it's a sheet ability, you have four choices:


1. Have the sheet open to the Abilities tab

The players will need to click the macro from there, but if they have the sheet open, they might as well be on the main page and click the desired ability

2. Use a token macro that calls the ability

This would only appear if the token were selected, so there is no issue in using the selected keyword.

3. Use a Collections macro that calls the ability

Although the collections macro could be made universal, each player would need to add it to their macro bar personally. If made a universal token macro, there would be no keyword issue, as in #2, above.

4. Type the name of the macro in chat

Issues as in 2 & 3 above.


In order for a ability to even work without a token/character selected, Roll20 needs to know which character to reference. At some point you will need to provide that reference. Even if a player could type the macro directly into chat (as #4 above) it doesn't know which character is meant, since one player can control many characters.

I think your best bet is a universal token macro and make sure a token is always available for each character in the game. I have this issue in my own game on my Theater of the Mind page, which only shows a scene, no maps. I solved it by putting tokens in a line across the top of the page, and using the maplock script to lock them in place, so as not to be disruptive.


Thanks keith.

For point 1: the ability doesn't just include the attack -- there's some other stuff I want to do in ability (flavour text in chat etc).

But you are right that tying it to a token macro is most likely how it will be used and therefore using the selected keyword makes sense. Or simply customising the macro to include the character's name as they don't really change that often (if at all).

In order for a ability to even work without a token/character selected, Roll20 needs to know which character to reference. At some point you will need to provide that reference. Even if a player could type the macro directly into chat (as #4 above) it doesn't know which character is meant, since one player can control many characters.

It just irks me that attribute calls can assume the caller is the character referenced by the sheet, but attacks/repeating abilities don't. 

May 16 (5 years ago)
keithcurtis
Forum Champion
Marketplace Creator
API Scripter

It is odd, since you can call a regular ability pretty easily. Even an ability command button won't work with this: [Attack 1](~repeating_attack_$0_attack)

May 16 (5 years ago)

Edited May 16 (5 years ago)
vÍnce
Pro
Sheet Author

Have you tried changing

%{selected|repeating_attack_$0_attack}

to

@{repeating_attack_$0_attack}

?
Changing the roll to an attribute call within an ability macro (treats the roll as any other sheet attribute and "assumes" the character is the one hosting the ability macro) seems to work on the PF Community sheet.


May 16 (5 years ago)

Edited May 16 (5 years ago)


Vince said:

Have you tried changing

%{selected|repeating_attack_$0_attack}

to

@{repeating_attack_$0_attack}

?
Changing the roll to an attribute call within an ability macro (treats the roll as any other sheet attribute and "assumes" the character is the one hosting the ability macro) seems to work on the PF Community sheet.



I had previously tried this and it failed (the attack roll is simply called "Attack" in the 5E OGL sheet):



However I can reference a property of the attack in this way:

@{repeating_attack_$0_atkname}

returns the name of the Attack:

Ravenblade (1H)

At this point I'm going to continue with the functionality that does work (using a charname or selected as the keyword.


Thanks everyone who contributed!

May 16 (5 years ago)

Edited May 16 (5 years ago)
vÍnce
Pro
Sheet Author

You can use the value of the repeating attack without needing select.

@{repeating_attack_$0_rollbase}

will work.

Just note that if they ever change the value used for the attack's from rollbase to something else, you would need to also update your macros.  OGL seems like a very stable sheet at this point, so I doubt there will be a change with that, but you never know.


May 16 (5 years ago)

Edited May 16 (5 years ago)


Vince said:

You can use the value of the repeating attack without needing select.

@{repeating_attack_$0_rollbase}

will work.

Just note that if they ever change the value used for the attack's from rollbase to something else, you would need to also update your macros.  OGL seems like a very stable sheet at this point, so I doubt there will be a change with that, but you never know.



Great news, thanks Vince!

What am I missing that

%{selected|repeating_attack_$0_attack} 
works as an ability call, but it requires
@{repeating_attack_$0_rollbase} 
when used as an attribute?

Is it just something with the underlying sheet style?

edit: also, is there a good way to suppress the chat output (Zeal|repeating_attack_$0_attack-roll) of the ability call so you just get the roll?


May 16 (5 years ago)
vÍnce
Pro
Sheet Author

I think it has something to do with how the button is named.  roll_attack vs attr_attack.  On the PF Community sheet we named our sheet's rolls like an attribute, e.g. "attr_foo" which seems to allow the button to be identified as either a roll or an attribute.  Whereas if you use "roll_foo" (OGL sheet and many others...), the button is only identified as a roll.  This is speculation on my part.  To be honest, I'm not sure why there is a difference.  The trick of using the value of the roll button vs the button's name bypasses whatever limitations/issues roll20 has with "roll_foo".

edit: also, is there a good way to suppress the chat output (Zeal|repeating_attack_$0_attack-roll) of the ability call so you just get the roll?

Not sure I understand the question. ;-(


May 16 (5 years ago)
keithcurtis
Forum Champion
Marketplace Creator
API Scripter


Vince said:


edit: also, is there a good way to suppress the chat output (Zeal|repeating_attack_$0_attack-roll) of the ability call so you just get the roll?

Not sure I understand the question. ;-(

Look at your screen shot. Before the macro runs, there is a line that says: "Garmtoc|repeating_attack_$0_rollbase"


May 16 (5 years ago)

Edited May 16 (5 years ago)
vÍnce
Pro
Sheet Author

That was just as I was testing various iterations of the macro.  (I didn't mean to include it in my screen shot. lol)

@{repeating_attack_$0_rollbase}

Will only post the attack. Here's me clicking the macro multiple times.



Vince said:

That was just as I was testing various iterations of the macro.  (I didn't mean to include it in my screen shot. lol)

@{repeating_attack_$0_rollbase}

Will only post the attack. Here's me clicking the macro multiple times.



Oh yes, I'm sure I saw it print out the rollbase the first time, but it appears it doesn't when I test it now!

Thanks again!


May 16 (5 years ago)
vÍnce
Pro
Sheet Author

Cool beans.

I investigated my suggestion and can now say it doesn't work because of the order of operations which is abilities before attributes. So you can't use an attribute inside an abilitycall. 

Glad Vince could help you. :)