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

[Help] Query nesting working as a macro but not in the sheet, why?

1540407150

Edited 1540407344
Leothedino
Sheet Author
Hey guys, Got myself a bit of a problem here. Teaching myself about creating queries within a query, I managed to make one that works successfully (put directly into the game chat) but when it's inside a custom sheet it all falls apart. Here is the query: /roll 1d10+?{ACTION TYPE|    Attack, ?{EXTRA ATTACK| No, 0 | Yes, -3 } ?{RANGE| Close, +0 | Far, -3 } | Defend, ?{Defense Action| Block, 0 | Parry, -3 } }+?{ADDITIONAL MODS?|0} But the moment I put it into my sheet (like the following) it begins to completely muddle upon use. For example,  when the query comes up the Action Type  query merges the Extra Attack and Range query together into a mess of options. Why? What am I doing wrong? value=[[1d10+?{ACTION TYPE|       Attack, ?{EXTRA ATTACK| No, 0 | Yes, -3 } ?{RANGE| Close, +0 | Far, -3 } | Defend, ?{Defense Action| Block, 0 | Parry, -3 } }+?{ADDITIONAL MODS?|0}]] As always, any and all help is greatly appreciated. Perhaps it'll alleviate me banging my head against the wall with this haha.
1540408494
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
This is because HTML code is parsed when entered in HTML code. I know there is a way to escape it, but I'm not sure what it is.
Oh heavens, really? This query is so important. It stops my players from having to toggle a million checkboxes, and then untoggle them again over and over between turns. AKA a complete immersion killer.  Fingers crossed there is a way.
1540411047
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
You could try putting an extra layer of encoding in by replacing the & with &
Silly question from me, perhaps. But do you mean like this?  No, 0 | becomes: No & #44; 0 & #124; Like that? Not sure where else '&' features.
1540413963
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
Yep
Oh my goodness, it worked. What the fudge? Scott, that was some serious HTML sorcery right there buddy, thanks man. I'd love to know -why- it worked, so my brain could make peace with this lesson, but you know what, I am over the moon it just -does- work. Internet cookies to you my friend, thank you kindly. 
1540417356
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
It's because the HTML parser parse one layer of HTML (the &) which then gives you the HTML code you actually want. It's the same reason you need to extra encode when nesting queries in other queries. You'll want to do some testing to check the stability of the fix.
Yeah, I got a little excited too soon. The query process is solid now, it's not jumbled, but as for the result, well... there isn't any :P It's not acknowledging the numbers that matter anymore. I'll play around a little more tonight before I admit defeat for the evening.  ... But hey, the small victories count! :D 
Scrap that, I was missing an '=' in my code. Tired eyes from 9 hours at it, silly mistake. It does actually work! Ha.