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

Heavily Nested Queries & Inline Rolls

Hey guys, I call upon the superior knowledge of the r20 macro community to come to my aid. So I am making a set of heavily stacked rolls/queries. The campaigns I am using don't have access to character sheets for a variety of reasons so I'm making do with a set of macros in a notepad on my computer for quick copy/paste. The character I'm playing does full rounds a lot, and I get sick of constantly punching up his attack rolls and damage values. So I wanted to use the query system to come up with a kind of hamfisted variable/if/then system. "The Code", dressed up to be visually pleasing and flow like the basic code I'm trying to imitate and it helps to keep things straight in my mind when looking for closed brackets. &{template:default} {{name=Dragons Claw Damage}} {{ Variables = ?{STR|3} Str, ?{Power|1} Power, ?{Enh|1} Enh }} //Set up the "variables" {{ Spell Combat =     ?{ Spell Combat Hit/Miss? | //Did the attack hit or miss?         Miss , Miss |         Hit , ?{Critical Hit? | //If it hit, is it a critical blow?             No , [[ //If not, roll damage                 1d10                 + floor( 1.5 * ?{ STR } )[STR]                 + floor( 1.5 * (2 * ?{ Power } ))[Power]                 + ?{ Enh }[ENH]                 + ?{ Bonus Dmg | 0 }             ]] |             Yes , [[ //It crit, roll 3x damage                 3d10 + ( 3 *                     floor( 1.5 * ?{ STR } )[STR]                     + floor( 1.5 * (2 * ?{ Power } ))[Power]                     + ?{ Enh }[ENH]                     + ?{ Bonus Dmg | 0 }                 )             ]]         }         + [[ // The trouble bit.             ?{Spell Damage Yes/No | // If I deal additional spell damage for various                 No , 0 | // reasons I need it added on regardless of crit                 Yes , ?{Spell Damage | 0 } // damage. This is also good for stuff like the             } // Flaming Burst property on a weapon.         ]] // Unfortunately I cannot get this part to resolve     } // In the roll20 system. }} The macro in roll20 chat format for testing purposes. &{template:default} {{name=Dragons Claw Damage}} {{ Variables = ?{STR|3} Str, ?{Power|1} Power, ?{Enh|1} Enh }} {{ Spell Combat = ?{ Spell Combat Hit/Miss? | Miss , Miss | Hit , ?{Critical Hit? | No , [[ 1d10 + floor( 1.5 * ?{ STR } )[STR] + floor( 1.5 * (2 * ?{ Power } ))[Power] + ?{ Enh }[ENH] + ?{ Bonus Dmg | 0 } ]] | Yes , [[ 3d10 + ( 3 * floor( 1.5 * ?{ STR } )[STR] + floor( 1.5 * (2 * ?{ Power } ))[Power] + ?{ Enh }[ENH] + ?{ Bonus Dmg | 0 } ) ]] } + [[ ?{Spell Damage Yes/No | No , 0 | Yes , ?{Spell Damage | 0 } } ]] } }} I have tried the &#XXX; bit under "Spell Damage Yes/No" in an assortment of different combinations. The closest I ever got was the entire Yes/No query in a single box requesting the input value for "Spell Damage". If I can pull this off I will be able to cover my entire attack repertoire in two macros by toggling attacks and damages on and off making my life a beautifully over complicated simplicity.  Additionally as I level I'll only have to change the values in the upper "variable" boxes, not find every entry of Strength in a half dozen requests. Is it easier to ask the gm's to enable character sheets? Yes, probably. But that wasn't what I set out to do. Edit: Are you kidding me? It converted the HTML text into regular text. Even the stuff in the code boxes. Guess I'll be sticking them in a gist.github. Links to follow. The Gist
1526044269

Edited 1526044409
Basically, every level of nested query requires an additional nested level of replacements, and replacements of the part of the replacement characters that get replaced.  As you've seen, the html codes even get replaced when you post them here.  So when they get parsed then parsed then parsed again because they're nested in nests of nests, you've got to have set things up so the end result is the right code, after going through the wash cycle multiple times. Good luck - personally, I dont touch nested queries, nor do I use queries anywhere but in the lowest level macros, and I build chat button menus for my decision nesting - totally sidesteps the whole issue. By the way, a lot of what you are trying to do, such as only needing to edit strength in one place - you can achieve by adding a custom attribute to your sheet, and just referring to it.  You do not need any fancy pants sheet added to your game, you can define attributes and abilities in any game on a totally blank featureless sheet, and build anything you happen to want.
Yah, that's kind of the catch. We play in a kind of "west marches" style on a server where you use the same character in a bunch of one-off quests. Sometimes there are 'quest lines' but not always. Got about 50 people all in all, some of whom are also gm's. So a lot of r20 campaigns are a one-and-done kind of thing. The catch is, we almost never set up even rudimentery sheets at all, which is why I am really hammering at things like variables and stuff because I don't have access to attributes or abilities or sheets at all usually. Yes, I understand I'm not really using the limited macro system as it was meant to be. But I feel limitation breeds creativity. I'll keep hammering at the nested nested nested html stuff and see if I can't figure it out. Mostly I was looking for help figuring out which parts need to be extended via & a m p ; This is as close as I've come to managing it. I feel I nearly have it but I just can't get the stupid thing to work. ^ This ends up with this v instead of a drop down query Do I just keep adding & amp ; & amp ; & amp ; at the start of some and not others until I can get it working? Because if I do, they start showing up in the query box.
1526088419
GiGs
Pro
Sheet Author
API Scripter
You had an extra & amp;   for each level deep of nesting. So look at your macro's structure in the original post and you should be able to figure it out, in theory.