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

Trying to make a Token Action that calls on other Token Actions, but not having luck. Any help is appreciated. Thanks.

Hello all, I am working with the Carbon 2185 character sheet (cyberpunk, based on 5e OGL system), and I am trying to make a token tool that calls on other token tools, but I'm not having any luck in getting it to work.  I'm sure it is probably just a pretty simple thing that I'm messing up, but any help in straightening this out would be appreciated, for sure.  Thanks, in advance. I currently have an attack Token Action macro that calls on the weapon fields on the character sheet and ends up displaying the Weapon being used in the title of the resulting default template block in the chat window. The first line under the title displays the Attack Roll and type (Standard, Advantage, or Disdvantage), the second line displays the type of damage that was done alongside the amount of damage rolled, and the third line simply repeats the second line, but listing it as Crit Dmg instead (in case of a critical hit roll). I have this Token Action macro set up for each of the four weapon entries that appear on the character sheet and I've labeled them each as ATK 1, ATK 2, etc. I'm trying to set it up so that there is another Token Action macro that simply calls on these other Token Action macros. The desired end result is such that the player will select a Token Action macro that is simply titled "Attack" and that will prompt a drop-down query roll input that lists the name of the weapons in the four weapon slots on the character sheet. Once the player selects which weapon he/she is attacking with, the appropriate attack Token Action macro will commence (ATK 1, ATK 2, etc) and post its output in the default template in the chat window as per normal, but specific to whichever weapon the player selected only. I will post my current attack macro example here: ----------------------------------- ATK-1 &{template:default} {{name=@{attack_name_1}}} {{Attack Roll= [[ @{attack_bonus_1} + ?{Roll Type|Standard,1d20 ]] Standard|Advantage,2d20kh1 ]] Advantage|Disadvantage,2d20kl1 ]] Disadvantage} }} {{damage=@{attack_type_1} [[@{attack_damage_1}+@{attack_dmod_1}]]}}{{crit Dmg=@{attack_type_1} [[@{attack_damage_1}+@{attack_dmod_1}]]}} ----------------------------------- The way I was trying to do it is (using only two entries as an example): ?{What type of attack?|@{attack_name_1},%{selected|ATK 1}|@{attack_name_2},%{selected|ATK 2}} ----------------------------------- For some reason, the result I keep getting is: No ability was found for %{selected|ATK 1} No ability was found for %{selected|ATK 2} I also tried it with the character's name instead of just using "selected", but that didn't work either. ----------------------------------- The query popup does appear though, and it is filled with four possible options for the player to choose. They are: Unarmed ATK 1 Shotgun ATK 2 (Because "Unarmed" is the entry in the spot labeled @{attack_name_1} and "Shotgun" is the entry in the spot labeled @{attack_name_2} on the character sheet. ATK 1 and ATK 2 are only the names of the associated Token Action macros, but they appear in the drop-down options as well.) ----------------------------------- So, if anyone sees the error of my ways here and would like to give me a clue as to what I'm doing wrong, I'd really appreciate it.  Thanks.
1592347002
GiGs
Pro
Sheet Author
API Scripter
You're hitting the dreaded nesting queries issue. Be aware that when roll20 runs a macro, it collects all other macros and abiluties referenced, and insterts them in the macro, and then tries to run it. So this ?{What type of attack?|@{attack_name_1},%{selected|ATK 1}|@{attack_name_2},%{selected|ATK 2}} Actually gets run as something like: ?{What type of attack?|@{attack_name_1},&amp;{template:default} {{name=@{attack_name_1}}} {{Attack Roll= [[ @{attack_bonus_1} + ?{Roll Type|Standard,1d20 ]] Standard|Advantage,2d20kh1 ]] Advantage|Disadvantage,2d20kl1 ]] Disadvantage} }} {{damage=@{attack_type_1} [[@{attack_damage_1}+@{attack_dmod_1}]]}}{{crit Dmg=@{attack_type_1} [[@{attack_damage_1}+@{attack_dmod_1}]]}}|@{attack_name_2},&amp;{template:default} {{name=@{attack_name_1}}} {{Attack Roll= [[ @{attack_bonus_1} + ?{Roll Type|Standard,1d20 ]] Standard|Advantage,2d20kh1 ]] Advantage|Disadvantage,2d20kl1 ]] Disadvantage} }} {{damage=@{attack_type_1} [[@{attack_damage_1}+@{attack_dmod_1}]]}}{{crit Dmg=@{attack_type_1} [[@{attack_damage_1}+@{attack_dmod_1}]]}}} Now because its inside a query, any commas, | or } characters are going to be interpreted as part of the query - and your abilities have a lot of them. So it breaks the query. The only way to solve this with a nested query is to go through the html entity replacement described on the page linked here:&nbsp; <a href="https://wiki.roll20.net/Macros#Advanced_Usage_for_Roll_Queries" rel="nofollow">https://wiki.roll20.net/Macros#Advanced_Usage_for_Roll_Queries</a> A much better solution is to switch to Chat Menus. Try this: /w "@{selected|character_name}" &amp;{template:default} {{name=Attack Menu}} {{=[@{attack_name_1}](~ selected|ATK 1) [@{attack_name_2}](~selected|ATK 2)}} This will whisper a menu of buttons to the player who controls the selected character, and you can just click the button to run the attack ability. I just noticed you have another problem: are your Abilities named "ATK 1" and "ATK 2"? Having spaces in abilities names is a very bad idea (it's also quite hard to create them). If you do really have spaces there, rename them to something like "ATK-1" (and change the button code above).
Thanks a lot for the response and the assistance. I didn't think about chat menus, so that will probably be the solution that I'll use. I didn't use HTML replacement for the other part mainly because the information I saw in Roll20 help pages about Roll Queries and Abilities, etc, all said NOT to replace those things in Attribute, Macro, or Ability calls, as they are NOT problematic.&nbsp; So, I figured they wouldn't cause an issue, you know?&nbsp; Maybe I misunderstood what they meant when they wrote that. I don't know.&nbsp; The chat menu option seems good though to me, so I thank you very much, again.
Oh, and no, I don't have spaces in my Ability names, as it auto-includes dashes in their names. I only wrote it that way in the Ability Call, since that is the way it is written in the Roll20 help information regarding Ability Calls. It doesn't have the dashes in the example names (something like "Massive Axe" or something like that, in the example).
1592352398

Edited 1592352420
GiGs
Pro
Sheet Author
API Scripter
Grudgel Games said: Thanks a lot for the response and the assistance. I didn't think about chat menus, so that will probably be the solution that I'll use. I didn't use HTML replacement for the other part mainly because the information I saw in Roll20 help pages about Roll Queries and Abilities, etc, all said NOT to replace those things in Attribute, Macro, or Ability calls, as they are NOT problematic.&nbsp; So, I figured they wouldn't cause an issue, you know?&nbsp; Maybe I misunderstood what they meant when they wrote that. I don't know.&nbsp; The chat menu option seems good though to me, so I thank you very much, again. You might just be the first person I've responded to on this topic that actually noticed that about attribute etc calls! (Seriously the most common error with attempts to handle nested macros, is replacing those). However, look agains at the macro text, and see how many }}&nbsp;characters there in the templates. There's also at&nbsp; least one, probably two more queries inside the first query, with their own commas, |, and } characters. They all break the first query.