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

Nested Macros, Rollable Tables, and frustration.

I'm trying to incorporate my critical tables into R20. The issue that I'm running into, though, is that it requires a nested set of macros which then calls a RT for the result. Example: The attack shows the hit location. If it's a critical, I run the Roll-Critical macro, which has a dropdown for the location. Depending on which one you choose, it calls the macro "roll-crit-[location]" (roll-crit-body, roll-crit-head, etc). These macros, in turn, have a dropdown asking if the area was armored (in my game you can piecemeal armor so some areas might have armor and others may not). If armored it calls the RT "crit-table-with-armor" and if no armor it calls "crit-table-no-armor". So I went through all my macros and replaced them with the special characters. Everything works until it's time to call the RT, in which case it returns a null value. When I run the macros individually everything is fine. So I'm assuming it has something to do with the RT call from within a nested macro. Macros (with special characters you can't see): Roll-Critical &{template:default}{{?{Hit location?|     Body, #roll-crit-body |    Arm, #roll-crit-arm |     Leg, #roll-crit-leg  |     Hand, #roll-crit-hand  |     Foot, #roll-crit-foot  |     Head, #roll-crit-head } }} roll-crit-arm &{template:default}{{?{Is the foe wearing armor?| Yes,[[1t[crit-table-with-armor]]]|No,[[1t[crit-table-no-armor]]]}  }}
1617049039

Edited 1617049145
Ziechael
Forum Champion
Sheet Author
API Scripter
Check out this thread from earlier today, the problems you are having are basically the same so hopefully you'll also find your answers there too... specifically check out the second option in this post . :) Feel free to ask here for more specific elaboration if needed though.
1617050204
Andreas J.
Forum Champion
Sheet Author
Translator
Think you need to remove the space between , and the #roll-crit-body part, for those macros to work. The extra space is causing the macro to fail.&nbsp; <a href="https://wiki.roll20.net/Complete_Guide_to_Macros_%26_Rolls#Drop-down_Queries" rel="nofollow">https://wiki.roll20.net/Complete_Guide_to_Macros_%26_Rolls#Drop-down_Queries</a> This should work: &amp;{template:default}{{?{Hit location?| Body,#roll-crit-body | Arm,#roll-crit-arm | Leg,#roll-crit-leg | Hand,#roll-crit-hand | Foot,#roll-crit-foot | Head,#roll-crit-head } }} Ziecheal is proposing an alternative way to construct your macro, by creating a Chat Menus with buttons to launch specific macros, instead of having a dropdown menu each time. See the link for more examples on making a chat menu instead.
1617050236

Edited 1617050270
I can actually get it to work fine until I try and call a Roll Table. All I get back is a single purple line with no value under it.&nbsp; edit: I forgot to thank you for your response. So....thanks!
Spaces? THE ERROR WAS CAUSED BY SPACES?!? If this works I'm going to buy you a virtual beer then start putting my hair back in. The hair I've been pulling out trying to get this to work....
1617050985
Andreas J.
Forum Champion
Sheet Author
Translator
David N. said: If this works I'm going to buy you a virtual beer then start putting my hair back in. The hair I've been pulling out trying to get this to work.... If you wanna throw coins at me, I have Patreon :D I actively maintain and update the roll20 community wiki, and have created both pages I just linked to, which explains each thing in greater detail. While others tend to help with direct answers, I have a habit of improving the documentation so that it's easier to show to the next person, and saving the forum wisdom on the wiki. :)
1617056927

Edited 1617057466
Ziechael
Forum Champion
Sheet Author
API Scripter
Spacing aside, it still won't work as written, Roll20 will expand everything in the query so what you are essentially ending up with is this: &amp;{template:default}{{&amp;{template:default}{{?{Is the foe wearing armor?|Yes,[[1t[crit-table-with-armor]]]|No,[[1t[crit-table-no-armor]]]} }}}} Which will not work. To nest a template in a query you'll need to replace all of the problematic syntax with html which will stop the macro working natively as well as be a huge pain to maintain. Trust me, I've been there ;) All of that aside, you could just nest your crit macros in the original query: &amp;{template:default}{{?{Hit location?|&nbsp; &nbsp; &nbsp;Arm,?{Is the foe wearing armor&amp;#124;Yes&amp;#44;[[1t[crit-table-with-armor]]]&amp;#124;No&amp;#44;[[1t[crit-table-no-armor]]]&amp;#125;&nbsp;|&nbsp; etc } }} which will require some &nbsp;html but not the same as trying to nest elements of a template or the entire template?
You're right, the spaces didn't work. I'll hit this again today to test. And again, thanks to all of you who helped.