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

Nesting Templates in a Roll Query?

1538158561

Edited 1538163905
Good afternoon, I'm having serious issues with getting the below macro working. I'm trying to select a spell's level and have it display a template for that level of the spell. Currently the issue is upon using the macro, the window that pops up shows this in the field: Level 2, &{template:default I do understand that this is because of the order of operations and issues with the "}" "," and "|" characters. (And "&") I have already converted every single one of those characters in the below macro into their HTML entity counterpart and tried running the macro. The issue with the macro then is that running it does not attempt to display the query. It simply sends every possible query option into the chat but written as code and doesn't produce any errors in chat. It simply doesn't display any template as they should appear.  Otherwise, this is the current code without using the HTML Entities. Any help would greatly be appreciated! /me casts Prayer of Healing upon the party! ?{Spell Level | Level 2,  &{template:default} {{name=Prayer of Healing LVL 2 (Action)}}{{Healing=[[2d8+2+2+@{Davfinas Lethersmit|wisdom_mod}}]]}} {{Range=30 feet}} {{Target=Up to 6 creatures}} | Level 3, &{template:default} {{name=Prayer of Healing LVL 3 (Action)}}{{Healing=[[3d8+3+2+@{Davfinas Lethersmit|wisdom_mod}}]]}} {{Range=30 feet}} {{Target=Up to 6 creatures}} | Level 4, &{template:default} {{name=Prayer of Healing LVL 4 (Action)}}{{Healing=[[4d8+4+2+@{Davfinas Lethersmit|wisdom_mod}}]]}} {{Range=30 feet}} {{Target=Up to 6 creatures}} | Level 5, &{template:default} {{name=Prayer of Healing LVL 5 (Action)}}{{Healing=[[5d8+5+2+@{Davfinas Lethersmit|wisdom_mod}}]]}} {{Range=30 feet}} {{Target=Up to 6 creatures}} }
1538159505
GiGs
Pro
Sheet Author
API Scripter
You need to change only the html characters that need to be changed. That's not a very helpful statement, because I don't fully understand the logic, but there are some characters you must not change: Those that make up attributes - dont change any of the characters in something like this: @{Davfinas Lethersmit|wisdom_mod} The characters that would be in macro if you had no nesting. From there, it's a matter of experimentation to figure out which ones you need to change, and the added complication that with more than one level of nesting, you need to keep adding extra html characters. A common suggestion, because its much simpler, is to abandon the idea of a nested dropdown, but instead have it whisper to chat an API button menu, which you can then click the one you need. All that said, looking at your specific macro, you can avoid the need for a nested macro completely: !?{Spell Level|Level 2,2|Level 3,3|level 4,4|level 5,5} /me casts Prayer of Healing upon the party! &{template:default} {{name=Prayer of Healing LVL ?{Spell Level} (Action)}} {{Healing=[[?{Spell Level}d8+?{Spell Level}+2+@{Davfinas Lethersmit|wisdom_mod}}]]}} {{Range=30 feet}} {{Target=Up to 6 creatures}}  I added a line break after (Action) purely so you can see the full macro, Make sure you remove that when you copy the macro. The ! on the first line above means that line wont be printed out in chat. It allows you to set up queries in the order you want. You can reuse queries in the same macro, and it will return the same value each time - just remember to only use the title part, not the stuff after the first |. This alternative form might work too: /me casts Prayer of Healing upon the party! &{template:default} {{name=Prayer of Healing LVL !?{Spell Level|Level 2,2|Level 3,3|level 4,4|level 5,5} (Action)}} {{Healing=[[?{Spell Level}d8+?{Spell Level}+2+@{Davfinas Lethersmit|wisdom_mod}}]]}} {{Range=30 feet}} {{Target=Up to 6 creatures}} 
Wow that's incredible. Thank you!  I didn't realize I could reference what selection was chosen from the roll query to use it like that in the macro. That works fantastic!
1538164100
GiGs
Pro
Sheet Author
API Scripter
Glad to help! i only spotted that after I was halfway through my post, haha, so I left the first bit in.