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

Button nested within a button nested within a Token Action

Hi, I am attempting to nest a button within a button that is created through a token Action. /***HERE IS THE CODE ( In bold I put the nested button.) *** /w gm &{template:npcaction} &{noerror}{{rname=@{selected|token_name}}}{{name=General Info}}{{description=**Actions** [Ranged Attack](`#&{template:default} {{name=Ranged Attack}} {{Attack=[[1d20 + 8]]|| [Adv](`#&{template:default} {{name=@{selected|token_name} has Advantage!}}) }})}} ***/ This all works except for the 2nd nested button (in bold) and I am sure there is some syntax I am missing here What I want: A token button that gives me a list of the NPC's attacks in button form.  When it rolls the attack, I want there to be a button to roll for advantage.
You don't have to replace left brackets or vertical pipes: /w gm &{template:npcaction} &{noerror}{{rname=@{selected|token_name}}}{{name=General Info}}{{description=**Actions** [Ranged Attack](`#&{template:default} {{name=Ranged Attack}} {{Attack=[[1d20 + 8]]}}) || [Adv](`#&{template:default} {{name=Ranged Attack}} {{Attack=[[1d20 + 8]]}}) }} This will create a 'Ranged Attack' button and an 'Adv' button next to it.   However I'll caution you from pursuing this.  Adding an advantage roll is going to be a LOT of work, as you'll basically have to recreate the entire roll that is created by the character sheet, and you'll have to use repeating attributes and generic attribute references, and there will be some things you won't be able to recreate.  It's much easier to just turn on 'Query Advantage' on the character sheet and reference the roll directly: &{template:npcaction} {{rname=@{selected|character_name}}} {{description=[@{selected|repeating_attack_$0_atkname} ](~@{selected|character_name}|repeating_attack_$0_attack) }}
Jarren said: You don't have to replace left brackets or vertical pipes: /w gm &{template:npcaction} &{noerror}{{rname=@{selected|token_name}}}{{name=General Info}}{{description=**Actions** [Ranged Attack](`#&{template:default} {{name=Ranged Attack}} {{Attack=[[1d20 + 8]]}}) || [Adv](`#&{template:default} {{name=Ranged Attack}} {{Attack=[[1d20 + 8]]}}) }} This will create a 'Ranged Attack' button and an 'Adv' button next to it.   However I'll caution you from pursuing this.  Adding an advantage roll is going to be a LOT of work, as you'll basically have to recreate the entire roll that is created by the character sheet, and you'll have to use repeating attributes and generic attribute references, and there will be some things you won't be able to recreate.  It's much easier to just turn on 'Query Advantage' on the character sheet and reference the roll directly: &{template:npcaction} {{rname=@{selected|character_name}}} {{description=[@{selected|repeating_attack_$0_atkname} ](~@{selected|character_name}|repeating_attack_$0_attack) }} I appreciate the response.  The campaign I am running has a lot of customized things that just do not fit within the character sheet well.  So I was hoping I could pull my players away from the character sheet a bit and have a nice list of buttons they could push for their "Actions" and other features. In the example you gave it puts the Adv next to "Ranged Attack", but what I would like is to nest that Adv in "Ranged Attack" button.  Is this doable?
What do you mean by ‘nesting’? Do you want a query (asking if advantage or not) to pop up when you click on ‘Ranged Attack’, or another chat menu? 
Jarren said: What do you mean by ‘nesting’? Do you want a query (asking if advantage or not) to pop up when you click on ‘Ranged Attack’, or another chat menu?  I am really just looking for a way to have buttons even after clicking a button. We as a group have come up with a lot of custom fun things that don’t work with the 5e character sheet. To make these custom things more streamlined I wanted give them a token action that listed the different things they can do without having to comb through their character sheet. Each of these things would be a button that resolves to the thing they can do. Each of these things they can do might also have custom things that I would like a button for in case it is needed Ex: a character can add 1d6 to their if they change the type of damage. For this specific example I would like 1) A token action that lists their abilities 2) A button that does the ability 3) a button within that ability that they can push to add their 1d6 damage if applicable. 3) is nested in 2) which is nested in 1). I can get 1) and 2) to work together but when I try 3) it fails Thanks so much for any help!
FoxRobinHood said: I am really just looking for a way to have buttons even after clicking a button. We as a group have come up with a lot of custom fun things that don’t work with the 5e character sheet. To make these custom things more streamlined I wanted give them a token action that listed the different things they can do without having to comb through their character sheet. Each of these things would be a button that resolves to the thing they can do. Each of these things they can do might also have custom things that I would like a button for in case it is needed Ex: a character can add 1d6 to their if they change the type of damage. For this specific example I would like 1) A token action that lists their abilities 2) A button that does the ability 3) a button within that ability that they can push to add their 1d6 damage if applicable. 3) is nested in 2) which is nested in 1). I can get 1) and 2) to work together but when I try 3) it fails I had a long explanation written up but accidentally hit the 'go back' button on my browser and lost it all.&nbsp; Basically for the first layer of nesting you need to replace a few specific control characters (right braces, ampersands, right brackets) and you lose the ability to use carriage returns without using something like&nbsp;&amp;percnt;NEWLINE&amp;percnt;. In the second layer you need to replace all control characters, as well as replacing the ampersands from control character replacements that would have been needed if it was the first layer. Here's an example of what it would look like: &amp;{template:npcaction} {{rname=Button 1 Output}} {{description=[Button 2](`#&amp;amp;{template:npcaction&amp;rcub; {{rname=Button 2 Output&amp;rcub;&amp;rcub; {{description=Button 2 Output &amp;percnt;NEWLINE&amp;percnt; Line 2 &amp;percnt;NEWLINE&amp;percnt; &amp;lsqb;Button 3&amp;rsqb;&amp;lpar;`#&amp;amp;amp;&amp;lcub;template:npcaction&amp;amp;rcub; &amp;lcub;&amp;lcub;rname=Button 3 Output&amp;amp;rcub;&amp;amp;rcub; &amp;lcub;&amp;lcub;description=Button 3 Output &amp;amp;percnt;NEWLINE&amp;amp;percnt; Line 2 &amp;amp;rcub;&amp;amp;rcub;&amp;rpar;&amp;rcub;&amp;rcub;) }} It gets far too tricky to continue nesting at this point.&nbsp; That's as far as I'm willing to explain it, because there are other options that are not so convoluted at this point, even if they don't get you exactly the output that you are looking for. Again, most customization can be achieved through the character sheet itself, such as using a Global Damage Modifer or adjusting the damage field of an attack with a query that asks about additional damage, or attribute calls to the character sheet. Here's an example of a custom sword that can add damage if the target is undead:&nbsp; <a href="https://app.roll20.net/forum/permalink/10784880/" rel="nofollow">https://app.roll20.net/forum/permalink/10784880/</a> Here's an example of a custom Shadow Blade:&nbsp; <a href="https://app.roll20.net/forum/post/10715833/possible-to-query-spell-slot-level-in-critical-damage-field-of-a-weapon" rel="nofollow">https://app.roll20.net/forum/post/10715833/possible-to-query-spell-slot-level-in-critical-damage-field-of-a-weapon</a> Here's an example of the 2024 OneDND Playtest for Shillelagh:&nbsp; <a href="https://app.roll20.net/forum/post/11754933/2024-shilleagh-damage-formula-help-request" rel="nofollow">https://app.roll20.net/forum/post/11754933/2024-shilleagh-damage-formula-help-request</a>
You know, one thing I am wondering is if I can use the token action to produce my buttons that are represented by macros. That way the button is not doing all the work? I am still very new to all this so I am unsure how this would work. So, could a button reference macros that would call other macros?
To close this out.&nbsp; I believe I have figured out what I needed. I created a token action that calls a bunch of macros into the chat as buttons.&nbsp; The macros can resolve 1 layer of nesting just fine. I appreciate all the help!