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 attributes

1482276952

Edited 1482277234
I want to be able to use @{weapon-?{weapon|longsword, 1|longbow, 2|}-attack} such that I can use one button to use either weapon 1 or weapon 2, but the system panics when it reaches the query. Basically I want to end up with a dropdown so i can choose between the @{weapon-1-attack} and the @{weapon-2-attack} attributes.
1482280556

Edited 1482280630
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
Attributes/abilities are expanded before queries, you can do what you want, you just need to wrap the attribute calls in the query instead of the query in the attribute call. Make sure to read up on advanced roll query usage as you may have problem characters in there. <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> <a href="https://wiki.roll20.net/Dice_Reference#Order_of_Operations" rel="nofollow">https://wiki.roll20.net/Dice_Reference#Order_of_Operations</a>
1482292992

Edited 1482297757
All right I fiddled a bunch and now i have this, which is very close to what i want, but i have to answer the weapon query twice instead of once (once for damage once for attack role) &{template:dnd4epower} {{atwill=1 }} {{emote=**@{character_name}** swings his weapon. }} {{name=Basic Attack }} {{level=Character Attack 1 }} {{type=At-Will ♦}} {{keywords=Weapon}} {{action=Standard Action♦}} {{range=Melee OR 15/30 }} {{target=one creature }} {{attack= ?{weapon-attack|Longsword, [[1d20+@{strength-mod-level}+@{weapon-5-attack}]]|shortbow, [[1d20+@{dexterity-mod-level}+@{weapon-6-attack}]] } vs AC}} {{**Damage**= ?{weapon-damage|longsword, [[@{weapon-5-num-dice}d@{weapon-5-dice}+@{weapon-5-damage}+@{strength-mod}]]| shortbow, [[@{weapon-6-num-dice}d@{weapon-6-dice}+@{Weapon-6-damage}+@{dexterity-mod}]]} Weapon damage}}
An&nbsp; Advanced Roll Query can combine those two Queries: &amp;{template:dnd4epower} {{name=Basic Attack }} {{emote=**@{character_name}** swings his weapon. }} {{level=Character Attack 1 }} {{atwill=1 }} {{type=At-Will ♦ }} {{keywords=Weapon }} {{action=Standard Action♦ }} {{range=Melee OR 15/30 }} {{target=one creature }} {{attack= [[ 1d20 + ?{Weapon| &nbsp; &nbsp; &nbsp;&nbsp;&nbsp;&nbsp; @{weapon-5-name}, @{strength-mod-level} + @{weapon-5-attack} ]] vs AC &nbsp;&nbsp;&nbsp;&nbsp; &amp;#125;&amp;#125; {{**Damage**=[[ @{weapon-5-num-dice}d@{weapon-5-dice} + @{weapon-5-damage} + @{dexterity-mod} | &nbsp;&nbsp;&nbsp;&nbsp; @{weapon-6-name}, @{dexterity-mod-level} + @{weapon-6-attack} ]] vs AC &nbsp;&nbsp;&nbsp;&nbsp; &amp;#125;&amp;#125; {{**Damage**= [[ @{weapon-6-num-dice}d@{weapon-6-dice} + @{weapon-6-damage} + @{dexterity-mod} &nbsp;&nbsp;&nbsp;&nbsp; } + ?{Modifiers|0} ]] }}
1482310032

Edited 1482310255
Garrett K.
Marketplace Creator
Silvyre said: An&nbsp; Advanced Roll Query can combine those two Queries: &{template:dnd4epower} {{name=Basic Attack }} {{emote=**@{character_name}** swings his weapon. }} {{level=Character Attack 1 }} {{atwill=1 }} {{type=At-Will ♦ }} {{keywords=Weapon }} {{action=Standard Action♦ }} {{range=Melee OR 15/30 }} {{target=one creature }} {{attack= [[ 1d20 + ?{Weapon| &nbsp; &nbsp; &nbsp;&nbsp;&nbsp;&nbsp; @{weapon-5-name}, @{strength-mod-level} + @{weapon-5-attack} ]] vs AC &nbsp;&nbsp;&nbsp;&nbsp; }} {{**Damage**=[[ @{weapon-5-num-dice}d@{weapon-5-dice} + @{weapon-5-damage} + @{dexterity-mod} | &nbsp;&nbsp;&nbsp;&nbsp; @{weapon-6-name}, @{dexterity-mod-level} + @{weapon-6-attack} ]] vs AC &nbsp;&nbsp;&nbsp;&nbsp; }} {{**Damage**= [[ @{weapon-6-num-dice}d@{weapon-6-dice} + @{weapon-6-damage} + @{dexterity-mod} &nbsp;&nbsp;&nbsp;&nbsp; } + ?{Modifiers|0} ]] }} Trying to do something similar, involving nesting ability macros, my first attempt was something like, ?{Type:|Trip,%{Wren|Chain-Trip}|Basic,%{Wren|Chain-Attack}} This has the obvious errors of } and | within the nesting area, which I then replaced with & #124; and 125 respectively, however I am still getting errors such as: TypeError: l is undefined If I knew how to make a text box like the one of yours i just quoted, i could show you exactly what im attempting =/ Any tips? Edit: Actually I've narrowed it down a step further, %{Wren|Chain-Trip} works just fine %{Wren& #124Chain-Trip} does not work at all :( (the space between & # was just to be able to get it in this text box)
1482327867

Edited 1482327885
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
You don't replace characters in an attribute or ability call, you need to replace those characters in the actual abilities you are calling. see the order of operations wiki I linked to above; roll queries are resolved after attributes/abilities have been expanded to their values.