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

Templates in Querries

I'm new and been curios about macros. What I created is primitive, but I'm wondering how you would go about placing templates in queries? I've tried several different options from the Wiki How too, but I must admit nothing is quite working. Is there anyway someone can point me in the right direction.  Thanks! ?{Guiding Bolt|    Level 1,  **GUIDING BOLT** **Range Attack:** [[1d20+@{spell_attack_bonus}]] **Radiant Damage:** [[4d6]] *Next attack roll made against this target before the end of next turn has advantage*| Level 2, **GUIDING BOLT** **Range Attack:** [[1d20+@{spell_attack_bonus}]] **Radiant Damage:** [[5d6]] *Next attack roll made against this target before the end of next turn has advantage*| Level 3,  **GUIDING BOLT** **Range Attack:** [[1d20+@{spell_attack_bonus}]] **Radiant Damage:** [[6d6]] *Next attack roll made against this target before the end of next turn has advantage*| Level 4,  **GUIDING BOLT** **Range Attack:** [[1d20+@{spell_attack_bonus}]] **Radiant Damage:** [[7d6]] *Next attack roll made against this target before the end of next turn has advantage*| Level 5, **GUIDING BOLT**  **Range Attack:** [[1d20+@{spell_attack_bonus}]] **Radiant Damage:** [[8d6]] *Next attack roll made against this target before the end of next turn has advantage*| Level 6, **GUIDING BOLT** **Range Attack:** [[1d20+@{spell_attack_bonus}]] **Radiant Damage:** [[9d6]] *Next attack roll made against this target before the end of next turn has advantage*| Level 7, **GUIDING BOLT** **Range Attack:** [[1d20+@{spell_attack_bonus}]] **Radiant Damage:** [[10d6]] *Next attack roll made against this target before the end of next turn has advantage*| Level 8, **GUIDING BOLT** **Range Attack:** [[1d20+@{spell_attack_bonus}]] **Radiant Damage:** [[11d6]] *Next attack roll made against this target before the end of next turn has advantage*| Level 9, **GUIDING BOLT** **Range Attack:** [[1d20+@{spell_attack_bonus}]] **Radiant Damage:** [[12d6]] *Next attack roll made against this target before the end of next turn has advantage*|}
1626209437
GiGs
Pro
Sheet Author
API Scripter
It can be done, but you'll have to look into nesting queries: <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> You'd be better off making a chat menu, but that would require creating a separate ability on your character sheet for each attack (or a universal macro, but you'd need to add selected| or something similar to the attributes). <a href="https://app.roll20.net/forum/post/5899495/roll20-tips-and-tricks-innovative-solutions-to-common-problems/?pageforid=5927072#post-5927072" rel="nofollow">https://app.roll20.net/forum/post/5899495/roll20-tips-and-tricks-innovative-solutions-to-common-problems/?pageforid=5927072#post-5927072</a>
1626255033

Edited 1626270094
Ziechael
Forum Champion
Sheet Author
API Scripter
I don't think something this simple would need nesting, the only variable seems to be the level which has a predictable effect on the damage roll: &amp;{template:default} {{name=GUIDING BOLT}} {{Ranged Attack=[[1d20+@{spell_attack_bonus}]]}} {{Radiant Damage= [[ [[?{Level|1|2|3|4|5|6|7|8|9}+3]]d6 ]] }} {{Next attack roll made against this target before the end of next turn has advantage}}
1626268558

Edited 1626270449
@Ziechael I'm getting a substring undefined error when I run the macro. Also, the first level is 4d6, after the first level it would add another d6 for every spell level. I'm new, and might be reading the macro wrong, but does this macro cover the 4d6 first level issue? Thanks so much, that macro enlightens me a bit on how to construct a query and build a format around it.&nbsp; Update: Thanks a lot. I was able to correct the substring undefined error and get the macro running. Man, this line is really clever&nbsp; [[?{Level|1|2|3|4|5|6|7|8|9}+3]]d6 ]] Everything is up and working now. Just so I understand the query, does each level start at a base 3d6 and you are adding 1d6 onto every level, including level one? I'd love a walk-through on that line if you get the time.&nbsp;
1626270064
Ziechael
Forum Champion
Sheet Author
API Scripter
If you are running the macro from the chat directly you'll need to add a way to define whose spell attack bonus to use: @{selected|spell_attack_bonus} will look for a selected token that is linked to a journal entry. @{target|spell_attack_bonus} will prompt for a token to choose (that is linked to a journal entry. @{ &lt;charactername&gt; |spell_attack_bonus} will look for a specific journal to use (replace the bold bit with an actual character name!). Alternatively you can launch the macro from a journal's abilities section which doesn't require any additional syntax and will work as originally written. And yes, the base number of d6 is defined as 3 in the macro plus the level being cast at, ie. 1=4d6 to 9=12d6
Super clever! It's up and working, now, and thanks for the explanation! :0)
1626272483
Ziechael
Forum Champion
Sheet Author
API Scripter
No problem, happy to help. The best advice for any aspiring macro builder looking to use queries is to remember that only the bits that you want to be different based on the results of the query need &nbsp;to be nested in the actual query. If those can be simple mathematical operations, then all the better :) As always, should you have any issues with future projects, just post on the forums... we live for this stuff!