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 .
×

Query macro being broken by nested macros

1603319203

Edited 1603321790
Hey all, I'm having an issue making a nested macro work. I have the following query macro, which should give me a drop-down to choose either the Heal or Undead macros: ?{Channel Type|Healing, #heal |Undead, #undead } Instead, it gives me: I'm not sure what I'm doing wrong, or why it's breaking the query box. I've made FAR more complicated querying macros than this using multiple drilldowns, but here I'm stumped. Maybe its something obvious I'm missing, in which case a fresh pair of eyes would help. Below are the two macros which are being referenced by the above macro: Heal: &{template:pc} {{showchar=[[1]]}} {{charname=Daniel Ali}} {{name=Channel Positive Energy}} {{type=ability}} {{abilitytype=Class Feature}} {{roll=**Healing** [[@{Daniel Ali|channel_energy_damage}d6]]}} {{castingtime=1 standard action}} {{range=Self}} {{area=30ft. radius}} {{targets=All living creatures within range (unless Selective Channel is used)}} {{duration=Instantaneous; see text.}} {{descflag=1}} {{desc=Healed creatures get 5e advantage on one attack roll, skill check, or saving throw of their choice within [[@{Daniel Ali|charisma_mod}]] round(s). Multiple uses don't stack, but do reset the effect’s duration. Creatures benefit from only one instance of this effect at a time.}} {{shownotes=[[1]]}} {{notes=N/A.}} Undead: &{template:pc} {{showchar=[[1]]}} {{charname=Daniel Ali}} {{name=Channel Positive Energy}} {{type=ability}} {{abilitytype=Class Feature}} {{roll=**Positive Energy Damage** [[@{Daniel Ali|channel_energy_damage}d6r1]]}} {{save= }} {{saveeffect=Will half}} {{savedc=[[10+(floor(@{Daniel Ali|caster1_level}*.5))+@{Daniel Ali|charisma_mod}]]}} {{castingtime=1 standard action}} {{range=Self}} {{area=30ft. radius}} {{targets=All undead creatures within range (unless Selective Channel is used.)}} {{duration=Instantaneous.}} {{descflag=1}} {{desc=When dealing damage to undead with your channel energy ability, you can reroll any damage die roll that results in a natural 1.}} {{shownotes=[[1]]}} {{notes=N/A.}}
1603323927

Edited 1603325069
Oosh
Sheet Author
API Scripter
This is an extremely common issue - basically all the %{Ability}, @{Attribute} and #Macro calls are expanded before the code is parsed. So your entire #Heal and #Undead macros are essentially being copy-pasted into that Query before it runs. The macro then (almost immediately) runs into a special character } which breaks the Query. Your options are: - HTML replacement to remove problem characters, namely } , and |. This means the referenced macros will no longer function outside a Query, so you're generally better off pasting them into the drop-down, then replacing characters and saving it all as one big macro. You also generally want to get as much of your code outside the Query as you can - each {{field}} that has the same value in both Heal and Undead can be put before or after the Query. - use a Chat Menu instead edit - here's a (hopefully) working example: &{template:pc} {{showchar=[[1]]}} {{charname=Daniel Ali}} {{name=Channel Positive Energy}} {{type=ability}} {{abilitytype=Class Feature}} {{save= }} {{castingtime=1 standard action}} {{range=Self}} {{area=30ft. radius}} {{duration=Instantaneous.}} {{descflag=1}} {{shownotes=[[1]]}} {{notes=N/A.}} {{roll= ?{Channel Type| Healing,**Healing** [[@{Daniel Ali|channel_energy_damage}d6]]}} {{targets=All living creatures within range (unless Selective Channel is used)}} {{desc=Healed creatures get 5e advantage on one attack roll, skill check, or saving throw of their choice within [[@{Daniel Ali|charisma_mod}]] round(s). Multiple uses don't stack, but do reset the effect’s duration. Creatures benefit from only one instance of this effect at a time.| Undead,**Positive Energy Damage** [[@{Daniel Ali|channel_energy_damage}d6r1]]}} {{saveeffect=Will half}} {{savedc=[[10+(floor(@{Daniel Ali|caster1_level}*.5))+@{Daniel Ali|charisma_mod}]]}} {{targets=All undead creatures within range (unless Selective Channel is used.)}} {{desc=When dealing damage to undead with your channel energy ability, you can reroll any damage die roll that results in a natural 1.} }} Note that we don't replace the braces in Attribute calls - these are resolved before the Query. However, if the Attribute contains any problem characters (say you reference a piece of math like {1d10,@{charisma_mod}}kh1) that will absolutely break your macro. Also those pesky commas in the description fields, , - they are very easy to overlook. Oh, almost forgot - if you save this as a Collections macro, the HTML replacement will be lost if you reopen it. Saving it as an Ability macro on the character sheet is highly recommended, as it doesn't suffer the same problem.