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

Queries within Queries?

I'm trying to get a dropdown to roll for a character's attribute, then an input for additional modifiers but I'm very new to this and it's partially cobbled together from other bits of code. The working code: &{template:default} {{name=Attribute Roll}} {{?{Attribute?| Body,=Body: [[2d6 + @{selected|Body}| Heart,=Heart: [[2d6+@{selected|Heart}| Mind,= Mind: [[2d6+@{selected|Mind}| Soul,=Soul: [[2d6+@{selected|Soul}| Magic,=Magic: [[2d6+{@{selected|Magic}}}]]}} What I'm attempting but doesn't work: &{template:default} {{name=Attribute Roll}} {{?{Attribute?| Body,=Body: [[2d6 + @{selected|Body} + ?{Forward|0} + ?{Relationship|0} + ?{Extra|0}| Heart,=Heart: [[2d6 + @{selected|Heart} + ?{Forward|0} + ?{Relationship|0} + ?{Extra|0}| Mind,= Mind: [[2d6 + @{selected|Mind} + ?{Forward|0} + ?{Relationship|0} + ?{Extra|0}| Soul,=Soul: [[2d6 + @{selected|Soul} + ?{Forward|0} + ?{Relationship|0} + ?{Extra|0}| Magic,=Magic: [[2d6 + {@{selected|Magic} + ?{Forward|0} + ?{Relationship|0} + ?{Extra|0}}}]]}} or even just having one box for all the bonuses together. Bonus points if there's a way to print the breakdown so the output would be something like "[Attribute]: [Roll] + [Forward} + [Relationship] + [Extra] = [Total]" (it's okay if not or it's a pain to do).
1705693671
GiGs
Pro
Sheet Author
API Scripter
See <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> If you can avoid nesting queries within queries, do it. For example, by using Chat Menus . You need to use html entities to make nested chat menus work. One of my last posts discussed the exact technique you need. That's here: <a href="https://app.roll20.net/forum/permalink/11763648/" rel="nofollow">https://app.roll20.net/forum/permalink/11763648/</a>
1705693885

Edited 1705693985
GiGs
Pro
Sheet Author
API Scripter
That said, you probably don't need to nest your queries here. Try this: &amp;{template:default} {{name=Attribute Roll}} {{=?{Attribute?| Body,Body: [[2d6 + @{selected|Body}| Heart,Heart: [[2d6 + @{selected|Heart}| Mind,Mind: [[2d6 + @{selected|Mind}| Soul,Soul: [[2d6 + @{selected|Soul}| Magic,Magic: [[2d6 + @{selected|Magic} } + ?{Forward|0} + ?{Relationship|0} + ?{Extra|0}]]}} It's always worth looking at the structure if a query, and seeing what you can move outside of the query.
1705694109
GiGs
Pro
Sheet Author
API Scripter
By the way, you have an unneccessary extra set of curly brackets around Magic. If the working example, this Magic,=Magic: [[2d6+{@{selected|Magic}}}]]}} can be Magic,=Magic: [[2d6+@{selected|Magic} }]]}}