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

Trouble with Chaining Macros

1611777442

Edited 1611780762
Hello, I am having difficulty getting this string of macros to all function consecutively. The !findres is a the command from a script written by Oosh that searches the resources of a sheet for a given name and then edits it as commanded, and it functions perfectly for its purpose. The trait template syntax is working perfectly as well, pulling from the rollable table, but where I have issue is calling the subsequent macros. I keep getting returned a } I assume this means there's something wrong with my syntax somewhere along the way, so here are the macros I'm using below, in the order in which I'd like them to run, as called with # 6-Drinking !findres --char|sel --name|Intoxication --mod|?{Strength of the drink?| (1/2) Watered Down,+0| (2/2) Watered Down,+1| (1) Weak,+1| (2) Moderate,+2| (3) Strong,+3| (4) Very Strong,+4| (5) Deadly,+5} ?{Will this drink intoxicate you to meet or exceed your personal threshold? (Enter 'No' if your threshold has already been met or exceeded)| No, | Yes,&{template:traits} {{name=Liquid Courage}} {{source=Intoxication for @{selected|character_name}}&#125:{{description=•[[1t[Liquid-Courage]]] • Disadvantage on WIS & DEX saving throws • Disadvantage on INT & WIS ability check}}} ?{Has your threshold already been met or exceeded?| No, | Yes,#Drinking-DC } Drinking-DC &{template:atkdmg} {{save=1}} {{savedc=[[8+?{Strength of the drink?|(1/2) Watered Down,+0|(2/2) Watered Down,+1|(1) Weak,+1|(2) Moderate,+2|(3) Strong,+3|(4) Very Strong,+4|(5) Deadly,+5}+@{selected|exhaustion_level}]]}} {{savedesc=No exhaustion gained}} {{saveattr=Constitution}} #Drinking-Con-Save Drinking-Con-Save &{template:simple} {{rname=CON Save vs. Exhaustion}} {{mod=@{selected|constitution_mod}}} {{r1=[[1d20+@{selected|constitution_mod}]]}} @{selected|rtype}+@{selected|constitution_mod}]]}} {{charname=@{selected|character_name}} What confuses me even more is that if I run the Drinking-DC itself, it calls Drinking-Con-Save just fine, but when I try to call them using 6-Drinking, it doesn't work.  If you have any insight as to how this can be solved it would be greatly appreciated!
Update: I have identified the problem as the following query with embedded macro call: ?{Has your threshold already been met or exceeded?| No, | Yes,#Drinking-DC } But, it doesn't look incorrect to me. Yet, whenever the query is answered Yes, I get returned a }, instead of the Drinking-DC being called to run. I'm baffled because I have left a space after the macro call like the wiki says to, yet it still gets returned } even though that } should be closing the query. 
1611782716
Jordan C.
Pro
API Scripter
None of the characters in the macro that need to be escaped have been escaped per nested queries ( Advanced Macros ) So for instance, Drinking-DC would need to look like this -  &{template:atkdmg} {{save=1}} {{savedc=[[8+?{Strength of the drink?|(1/2) Watered Down,+0|(2/2) Watered Down,+1|(1) Weak,+1|(2) Moderate,+2|(3) Strong,+3|(4) Very Strong,+4|(5) Deadly,+5}+@{selected|exhaustion_level}]]}} {{savedesc=No exhaustion gained}} {{saveattr=Constitution}} And your Drinking-Con-Save would need to look like this, I believe &{template:simple} {{rname=CON Save vs. Exhaustion}} {{mod=@{selected|constitution_mod}}} {{r1=[[1d20+@{selected|constitution_mod}]]}} {{advantage=1}}{{r2=[[1d20+@{selected|constitution_mod}]]}} {{charname=@{selected|character_name}}} Caveating this with when I tried the whole macro selecting no seems to return nothing so I am missing something still. Also, @{selected|rtype} isn't going to work since it translates to a literal string with right curly braces so you'll have to decide if you want advantage always rolled or not.
1611782807
GiGs
Pro
Sheet Author
API Scripter
When running a query, all the queries called get loaded into the query, and then roll20 attempts to run it. So this&nbsp; ?{Has your threshold already been met or exceeded?| No, | Yes,#Drinking-DC } becomes ?{Has your threshold already been met or exceeded?| No, | Yes, &amp;{template:atkdmg} {{save=1}} {{savedc=[[8+?{Strength of the drink?|(1/2) Watered Down,+0|(2/2) Watered Down,+1|(1) Weak,+1|(2) Moderate,+2|(3) Strong,+3|(4) Very Strong,+4|(5) Deadly,+5}+@{selected|exhaustion_level}]]}} {{savedesc=No exhaustion gained}} {{saveattr=Constitution}}&nbsp; } Now, whenever a query encounters a } it considers that the end of the query. In the above macro, that occurs at the end of the templat:atkdmg. &nbsp;So everything after that is lost. See this post for more explanation and fixes:&nbsp;<a href="https://app.roll20.net/forum/permalink/9742734/" rel="nofollow">https://app.roll20.net/forum/permalink/9742734/</a>
1611784672

Edited 1611784925
Thanks guys! Your tips and reminder to escape nested queries really helped! Now I have this beast of a macro that will do everything I need it to:&nbsp; &nbsp;— Add intoxications levels to a character sheet with an Intoxication resource based on the strength of drink chosen from a dropdown query &nbsp;— Query whether drinking past the Threshold, if yes, then it posts a Constitution Save DC of appropriate difficulty per character (w/ description) &nbsp;— Query whether the drink will meet or exceed the Threshold, if yes, posts the Trait box with the Liquid Courage Rollable Table output within &nbsp;— Query if the drink of Deadly strength, if yes, it posts a DC 10 Contitution Save vs falling asleep for 1d6 x 10 minutes (w/ description) !findres --char|sel --name|Intoxication --mod|?{Strength of the drink?| (1/2) Watered Down,+0| (2/2) Watered Down,+1| (1) Weak,+1| (2) Moderate,+2| (3) Strong,+3| (4) Very Strong,+4| (5) Deadly,+5} ?{Has your personal threshold already been met or exceeded?| No, | Yes,&amp;{template:atkdmg&amp;#125; {{save=1&amp;#125;&amp;#125; {{savedc=[[8+?{Strength of the drink?&amp;#124;(1/2) Watered Down&amp;#44;+0&amp;#124;(2/2) Watered Down&amp;#44;+1&amp;#124;(1) Weak&amp;#44;+1&amp;#124;(2) Moderate&amp;#44;+2&amp;#124;(3) Strong&amp;#44;+3&amp;#124;(4) Very Strong&amp;#44;+4&amp;#124;(5) Deadly&amp;#44;+5&amp;#125;+@{selected|exhaustion_level}]]&amp;#125;&amp;#125; {{savedesc=No exhaustion gained&amp;#125;&amp;#125; {{saveattr=Constitution&amp;#125;&amp;#125; {{desc=You must make a Constitution saving throw save for each drink consumed past your threshold. The DC is equal 8 + the strength of the drink + your level of exhaustion. If you fail&amp;#44; you gain one level of exhaustion. If you fail the save by 5 or more&amp;#44; you fall unconscious for 1d4 hours.&amp;#125;&amp;#125;} ?{Will this drink intoxicate you to meet or exceed your personal threshold? (Enter 'No' if your threshold has already been met or exceeded)| No, | Yes,&amp;{template:traits&amp;#125; {{name=Liquid Courage&amp;#125;&amp;#125; {{source=Intoxication for @{selected|character_name}&amp;#125;&amp;#125; {{description=You gain the following traits for 1 hour: •[[1t[Liquid-Courage]]] • Disadvantage on WIS &amp; DEX saving throws • Disadvantage on INT &amp; WIS ability check&amp;#125;&amp;#125;} ?{Lastly, was your drink of Deadly Strength?|No,|Yes,&amp;{template:atkdmg&amp;#125; {{save=1&amp;#125;&amp;#125; {{savedc=[[10]]&amp;#125;&amp;#125; {{savedesc=Remain conscious&amp;#125;&amp;#125; {{saveattr=Constitution&amp;#125;&amp;#125; {{desc=After consuming a drink of deadly strength&amp;#44; you must make a DC 10 Constitution saving throw vs. falling asleep for 1d6 x 10 minutes.&amp;#125;&amp;#125; {{damage=1&amp;#125;&amp;#125; {{dmg1flag=1&amp;#125;&amp;#125; {{dmg1=[[1d6*10]]&amp;#125;&amp;#125; {{dmg1type=minutes of sleep&amp;#125;&amp;#125;} Picture proof lol