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

Help with nested Macro Please

1644646737

Edited 1644646757
Hi everyone,  I have been trying to get what I think should be a simple macro set up exactly how I want for a while now, and have not been having much luck, so I figured I would ask here. I am sure it is a simple solution, but since I don't fully understand roll20's macro's I have been having some issues.  I am currently DMing a campaign where not all our players can be in every session, but their characters are always there. I am controlling anyone who is not in the session. Controlling the environment, mobs, and pc's can become very tedious and slow the game down a lot, so I have token actions for all players main attacks. I can easily make a token action for each individual save, or skill, but I would like to instead have 1 button called saves, that when clicked gives a prompt for which save, and then executes the save as if it was clicked directly from the character sheet. My macro fails due to | { and }, which I am aware of issues when using a nested macro, but I have replaced all of them with the html counterparts and it still fails.  We are playing pf1, using the pathfinder by roll20 sheet. Here is the code from 1 of the characters that is run when clicking a fortitude save from within the character sheet: @{Gnarlton Wanks|whispertype} &{template:pc} {{name=^{fortitude}}} {{type=save}} {{showchar=@{Gnarlton Wanks|rollshowchar}}} {{charname=@{Gnarlton Wanks|character_name}}} {{roll=[[1d20+@{Gnarlton Wanks|fortitude}[MOD]+(@{Gnarlton Wanks|saves_condition})[CONDITION]+@{Gnarlton Wanks|rollmod_save}[QUERY]]]}} {{shownotes=@{Gnarlton Wanks|rollnotes_save}}} {{notes=@{Gnarlton Wanks|fortitude_notes}}} {{conditionsflag=[[@{Gnarlton Wanks|saves_condition}]]}} {{conditions=@{Gnarlton Wanks|conditions_display}}}          Here is the Reflex save: @{Gnarlton Wanks|whispertype} &{template:pc} {{name=^{reflex}}} {{type=save}} {{showchar=@{Gnarlton Wanks|rollshowchar}}} {{charname=@{Gnarlton Wanks|character_name}}} {{roll=[[1d20+@{Gnarlton Wanks|reflex}[MOD]+(@{Gnarlton Wanks|saves_condition})[CONDITION]+@{Gnarlton Wanks|rollmod_save}[QUERY]]]}} {{shownotes=@{Gnarlton Wanks|rollnotes_save}}} {{notes=@{Gnarlton Wanks|reflex_notes}}} {{conditionsflag=[[@{Gnarlton Wanks|saves_condition}]]}} {{conditions=@{Gnarlton Wanks|conditions_display}}}         Here is the will save: @{Gnarlton Wanks|whispertype} &{template:pc} {{name=^{will}}} {{type=save}} {{showchar=@{Gnarlton Wanks|rollshowchar}}} {{charname=@{Gnarlton Wanks|character_name}}} {{roll=[[1d20+@{Gnarlton Wanks|will}[MOD]+(@{Gnarlton Wanks|saves_condition})[CONDITION]+@{Gnarlton Wanks|rollmod_save}[QUERY]]]}} {{shownotes=@{Gnarlton Wanks|rollnotes_save}}} {{notes=@{Gnarlton Wanks|will_notes}}} {{conditionsflag=[[@{Gnarlton Wanks|saves_condition}]]}} {{conditions=@{Gnarlton Wanks|conditions_display}}}           I thought I found a way around my problem by creating a macro for each save, and then the token action that would call upon those macros based on a prompt, but it does the exact same thing.  Here is what that macro looks like: ?{Which Save?|         Fortitude, #Gnarlton-Fort|         Reflex, #Gnarlton-Reflex|         Will, #Gnarlton-Will  } Here is the full macro: ?{Which Save?|         Fortitude, @{Gnarlton Wanks|whispertype} &{template:pc} {{name=^{fortitude}}} {{type=save}} {{showchar=@{Gnarlton Wanks|rollshowchar}}} {{charname=@{Gnarlton Wanks|character_name}}} {{roll=[[1d20+@{Gnarlton Wanks|fortitude}[MOD]+(@{Gnarlton Wanks|saves_condition})[CONDITION]+@{Gnarlton Wanks|rollmod_save}[QUERY]]]}} {{shownotes=@{Gnarlton Wanks|rollnotes_save}}} {{notes=@{Gnarlton Wanks|fortitude_notes}}} {{conditionsflag=[[@{Gnarlton Wanks|saves_condition}]]}} {{conditions=@{Gnarlton Wanks|conditions_display}}} |         Reflex, @{Gnarlton Wanks|whispertype} &{template:pc} {{name=^{reflex}}} {{type=save}} {{showchar=@{Gnarlton Wanks|rollshowchar}}} {{charname=@{Gnarlton Wanks|character_name}}} {{roll=[[1d20+@{Gnarlton Wanks|reflex}[MOD]+(@{Gnarlton Wanks|saves_condition})[CONDITION]+@{Gnarlton Wanks|rollmod_save}[QUERY]]]}} {{shownotes=@{Gnarlton Wanks|rollnotes_save}}} {{notes=@{Gnarlton Wanks|reflex_notes}}} {{conditionsflag=[[@{Gnarlton Wanks|saves_condition}]]}} {{conditions=@{Gnarlton Wanks|conditions_display}}} |         Will, @{Gnarlton Wanks|whispertype} &{template:pc} {{name=^{will}}} {{type=save}} {{showchar=@{Gnarlton Wanks|rollshowchar}}} {{charname=@{Gnarlton Wanks|character_name}}} {{roll=[[1d20+@{Gnarlton Wanks|will}[MOD]+(@{Gnarlton Wanks|saves_condition})[CONDITION]+@{Gnarlton Wanks|rollmod_save}[QUERY]]]}} {{shownotes=@{Gnarlton Wanks|rollnotes_save}}} {{notes=@{Gnarlton Wanks|will_notes}}} {{conditionsflag=[[@{Gnarlton Wanks|saves_condition}]]}} {{conditions=@{Gnarlton Wanks|conditions_display}}} } I am showing the version without changing the | { and } into html because I am not sure which to change, and the code is much easier to read this way. I am thinking it's just an issue of my needing to change some of them, but not all, but I am kinda lost. I would appreciate any help you can offer.  I would like to put all the character skills as well, but I believe once I have the saving throws macro working properly, I should be able to build the skill macros (I hope) Thank you!
1644649289
GiGs
Pro
Sheet Author
API Scripter
Nested rolls are a long-standing problem on roll20: <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> Basically every } or , in your called macro is interpreted by the query as part of the query, and causes the macro to break. There are two main ways to fix this. The first is to go through you macros and replace all the necessary characters with html entities (but do not change attribute calls like @{Gnarlton Wanks|conditions_display}), but this has extra issues. The second is to switch to chat menus, a far superior and simpler solution,described here <a href="https://app.roll20.net/forum/post/5899495/roll20-tips-and-tricks-innovative-solutions-to-common-problems/?pageforid=5927072#post-5927072" rel="nofollow">https://app.roll20.net/forum/post/5899495/roll20-tips-and-tricks-innovative-solutions-to-common-problems/?pageforid=5927072#post-5927072</a>
1644676792

Edited 1644677025
OP, the @{Gnarlton Wanks|whispertype} very likely is an attribute that populates a pipe or closing bracket and because of the nature of the character sheet toggles, even if you went into that and html replaced them inside that attribute, everytime you toggle it will replace that field with a preset remembered non html replaced character again.&nbsp;&nbsp; I have done what you are doing and I did it by going to the wiki for your character sheets templates and making all three of those abilities generically without using the sheets toggle attributes.&nbsp; i don't play your gameset, but I have an example from 5e by roll20.&nbsp;&nbsp; The following is a query token action that uses the selected token instead of a specific character name that then lists off a series of options, you will notice that 5e uses wtype instead of whispertype and that I have omitted the entry completely and set the roll template to always roll twice:&nbsp;&nbsp; EDIT:&nbsp; For any 5e guys out there, you also have to replace the final bit in templates cause it also populates a non html replaced entry(charname_output).&nbsp; Below in my code is the non attribute version of it.&nbsp; It populates an entry that is basically {{charname stuff}} and the closing brackets break the query so manually enter the output or leave it blank like my macros below cause I don't care for character names in templates.&nbsp;&nbsp; ?{What Reaction?||Rapier, &amp;{template:atkdmg&amp;#125; {{mod=[[@{selected|pb}[PB]+@{selected|dexterity_mod}[DEX]]]&amp;#125;&amp;#125; {{rname=Rapier&amp;#125;&amp;#125; {{r1=[[1d20cs&gt;20+@{selected|pb}[PB]+@{selected|dexterity_mod}[DEX]]]&amp;#125;&amp;#125; {{always=1&amp;#125;&amp;#125; {{r2=[[1d20cs&gt;20+@{selected|pb}[PB]+@{selected|dexterity_mod}[DEX]]]&amp;#125;&amp;#125; {{attack=1&amp;#125;&amp;#125; {{range=5ft.&amp;#125;&amp;#125; {{damage=1&amp;#125;&amp;#125; {{dmg1flag=1&amp;#125;&amp;#125; {{dmg1=[[1d8+@{selected|dexterity_mod}[DEX]]]&amp;#125;&amp;#125; {{dmg1type=Piercing&amp;#125;&amp;#125; 0 {{dmg2=&amp;#125;&amp;#125; {{dmg2type=&amp;#125;&amp;#125; {{crit1=[[1d8[CRIT]+1d8[PiercerFeat]]]&amp;#125;&amp;#125; {{crit2=&amp;#125;&amp;#125; 0 {{desc=Can reroll 1 attack damage dice.&amp;#125;&amp;#125; {{spelllevel=&amp;#125;&amp;#125; {{innate=&amp;#125;&amp;#125; {{globalattack=&amp;#125;&amp;#125; {{globaldamage=[[5d6[Sneak Attack]]]&amp;#125;&amp;#125; {{globaldamagecrit=[[5d6[Sneak Attack]]]&amp;#125;&amp;#125; {{globaldamagetype=&amp;#125;&amp;#125; ammo= {{charname=&amp;#125;&amp;#125;|Uncanny Dodge, &amp;{template:traits&amp;#125; {{name=Uncanny Dodge&amp;#125;&amp;#125; {{source=Class: Rogue 5&amp;#125;&amp;#125; {{description=Starting at 5th level&amp;#44; when an attacker that you can see hits you with an attack&amp;#44; you can use your reaction to halve the attack's damage against you.&amp;#125;&amp;#125;}
Thanks to both of you. I'll look into both.&nbsp;
I figured it out. I didn't realize you have to leave calls alone. So I replaced all the pipes and close braces that were not part of calls with their HTML counterparts. Also, since this is for a specific character, I removed all the calls like character name, etc and just manually typed it out.&nbsp; Here is the finalized macro that works as a token action for anyone interested: ?{Which Save?| &nbsp; Fortitude, &amp;{template:pc&amp;#125;{{showchar=[[1]]&amp;#125;&amp;#125;{{charname=Gnarlton Wanks&amp;#125;&amp;#125; {{name=Fortitude&amp;#125;&amp;#125;{{type=save&amp;#125;&amp;#125;{{roll=[[1d20+@{Gnarlton Wanks|fortitude}[MOD]+(@{Gnarlton Wanks|saves_condition})[CONDITION]+?{Modifier&amp;#124;0&amp;#125;[QUERY]]]&amp;#125;&amp;#125;{{notes=@{Gnarlton Wanks|fortitude_notes}&amp;#125;&amp;#125;{{conditionsflag=[[@{Gnarlton Wanks|saves_condition}]]&amp;#125;&amp;#125;{{conditions=@{Gnarlton Wanks|conditions_display}&amp;#125;&amp;#125; | Reflex, &amp;{template:pc&amp;#125;{{showchar=[[1]]&amp;#125;&amp;#125;{{charname=Gnarlton Wanks&amp;#125;&amp;#125; {{name=Reflex&amp;#125;&amp;#125;{{type=save&amp;#125;&amp;#125;{{roll=[[1d20+@{Gnarlton Wanks|reflex}[MOD]+(@{Gnarlton Wanks|saves_condition})[CONDITION]+?{Modifier&amp;#124;0&amp;#125;[QUERY]]]&amp;#125;&amp;#125;{{notes=@{Gnarlton Wanks|reflex_notes}&amp;#125;&amp;#125;{{conditionsflag=[[@{Gnarlton Wanks|saves_condition}]]&amp;#125;&amp;#125;{{conditions=@{Gnarlton Wanks|conditions_display}&amp;#125;&amp;#125; | Will, &amp;{template:pc&amp;#125;{{showchar=[[1]]&amp;#125;&amp;#125;{{charname=Gnarlton Wanks&amp;#125;&amp;#125; {{name=Will&amp;#125;&amp;#125;{{type=save&amp;#125;&amp;#125;{{roll=[[1d20+@{Gnarlton Wanks|will}[MOD]+(@{Gnarlton Wanks|saves_condition})[CONDITION]+?{Modifier&amp;#124;0&amp;#125;[QUERY]]]&amp;#125;&amp;#125;{{notes=@{Gnarlton Wanks|will_notes}&amp;#125;&amp;#125;{{conditionsflag=[[@{Gnarlton Wanks|saves_condition}]]&amp;#125;&amp;#125;{{conditions=@{Gnarlton Wanks|conditions_display}&amp;#125;&amp;#125; &nbsp; } &nbsp;
The macro is even better if you replace the character name with selected as below. This way, it works with whatever you have selected. ?{Which Save?| &nbsp; Fortitude, &amp;{template:pc&amp;#125;{{showchar=[[1]]&amp;#125;&amp;#125;{{charname=@{Selected|character_name}&amp;#125;&amp;#125; {{name=Fortitude&amp;#125;&amp;#125;{{type=save&amp;#125;&amp;#125;{{roll=[[1d20+@{Selected|fortitude}[MOD]+(@{Selected|saves_condition})[CONDITION]+?{Modifier&amp;#124;0&amp;#125;[QUERY]]]&amp;#125;&amp;#125;{{notes=@{Selected|fortitude_notes}&amp;#125;&amp;#125;{{conditionsflag=[[@{Selected|saves_condition}]]&amp;#125;&amp;#125;{{conditions=@{Selected|conditions_display}&amp;#125;&amp;#125; | Reflex, &amp;{template:pc&amp;#125;{{showchar=[[1]]&amp;#125;&amp;#125;{{charname=@{Selected|character_name}&amp;#125;&amp;#125; {{name=Reflex&amp;#125;&amp;#125;{{type=save&amp;#125;&amp;#125;{{roll=[[1d20+@{Selected|reflex}[MOD]+(@{Selected|saves_condition})[CONDITION]+?{Modifier&amp;#124;0&amp;#125;[QUERY]]]&amp;#125;&amp;#125;{{notes=@{Selected|reflex_notes}&amp;#125;&amp;#125;{{conditionsflag=[[@{Selected|saves_condition}]]&amp;#125;&amp;#125;{{conditions=@{Selected|conditions_display}&amp;#125;&amp;#125; | Will, &amp;{template:pc&amp;#125;{{showchar=[[1]]&amp;#125;&amp;#125;{{charname=@{Selected|character_name}&amp;#125;&amp;#125; {{name=Will&amp;#125;&amp;#125;{{type=save&amp;#125;&amp;#125;{{roll=[[1d20+@{Selected|will}[MOD]+(@{Selected|saves_condition})[CONDITION]+?{Modifier&amp;#124;0&amp;#125;[QUERY]]]&amp;#125;&amp;#125;{{notes=@{Selected|will_notes}&amp;#125;&amp;#125;{{conditionsflag=[[@{Selected|saves_condition}]]&amp;#125;&amp;#125;{{conditions=@{Selected|conditions_display}&amp;#125;&amp;#125; &nbsp; }