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 .
×
The Roll20 Black Friday sale is live now! Up to 30% Off Your Favorite Content!

Macros inside of a query, I'm just not getting this

Hi All! First post, and I'm going a little crazy. I'm trying to write some macros to make this whole dual-wielding magus build a little easier to deal with and I'm stumped. I'm trying to follow some basic examples from the tutorials, and I'm having a hard time wrapping my head around things. In short, I'm using the example in the basic Macro's guide to have a query. The example shows: ?{Which macro?|Attack,#use-sword |Defend,#use-shield } Which leads me to trying to use a macro I've borrowed from configuring things in my character sheet I call "ITWF_FullAttack" which looks like this: @{Zundar|PC-whisper} &{template:pf_attack} {{character_name=@{Zundar|character_name}}} {{character_id=@{Zundar|character_id}}} {{subtitle}} {{name=ITWF w/ Double Slice 2x Rapier, Agile (Full Attack)}} {{attack=[[ 1d20cs>[[ 18 ]] + [[ 12 ]] ]]}} {{damage=[[ 1d6 + [[ 6 ]] ]]}} {{crit_confirm=[[ 1d20 + [[ 12 ]] ]]}} {{crit_damage=[[ [[ (1 * (2 - 1)) ]]d6 + [[ (6 * (2 - 1)) ]] ]]}} {{type=}} {{description=}} {{attack2=[[ 1d20cs>[[ 18 ]] + [[ 12 + 0 ]] ]]}} {{damage2=[[ 1d6 + [[ 6 ]] ]]}} {{crit_confirm2=[[ 1d20 + [[ 12 + 0 ]] ]]}} {{crit_damage2=[[ [[ (1 * (2 - 1)) ]]d6 + [[ (6 * (2 - 1)) ]] ]]}} {{attack3=[[ 1d20cs>[[ 18 ]] + [[ 12 + -5 ]] ]]}} {{damage3=[[ 1d6 + [[ 6 ]] ]]}} {{crit_confirm3=[[ 1d20 + [[ 12 + -5 ]] ]]}} {{crit_damage3=[[ [[ (1 * (2 - 1)) ]]d6 + [[ (6 * (2 - 1)) ]] ]]}} {{attack4=[[ 1d20cs>[[ 18 ]] + [[ 12 + -5 ]] ]]}} {{damage4=[[ 1d6 + [[ 6 ]] ]]}} {{crit_confirm4=[[ 1d20 + [[ 12 + -5 ]] ]]}} {{crit_damage4=[[ [[ (1 * (2 - 1)) ]]d6 + [[ (6 * (2 - 1)) ]] ]]}} 0 0 0 0 {{header_image=@{Zundar|header_image-pf_attack-melee}}} 0 The macro by itself works (the code is admittedly hard for me to follow and I'm not a novice coder by any means - I get the gist of it, but it's just... a lot to look at), but I try and throw it in the above code like so: ?{Which macro?|Attack,#ITWF_FullAttack |Defend,#use-shield } And I just get a ton of nope on the output. I've tried multiple ways to make this work with little to no success. Further, the intellisense portion of recognizing my macro never pops up. It pops up others that I've added, but never this one. What piece of this puzzle am I missing? Further, does code formatting on posts only work bottom up? Every time I've tried to add more code formatting to code further down, it just takes away all of my previous code formatting and only works when I start from the bottom up again. Hardly as important, but just like... jeesh. Anyway, I would appreciate any help that can be provided, thank you!
1455583822

Edited 1455583956
Further, does code formatting on posts only work bottom up? Every time I've tried to add more code formatting to code further down, it just takes away all of my previous code formatting and only works when I start from the bottom up again. Hardly as important, but just like... jeesh. Anyway, I would appreciate any help that can be provided, thank you! Sounds like you are using a browser other than Firefox or Chrome.
I'm actually using Chrome v48.0.2564.109. Not that it matters too much, I was just curious about that weird issue.
You missed this part Troubleshooting Due to the order of operations , macro calls nested within Roll Queries are fully expanded before the query is executed. This means that if a macro nested within a Roll Query contains any problematic characters, which conflict with Roll Query syntax, that nested macro may cause the Roll Query to break. If this is the case, it may be necessary to either remove or replace problematic characters within that nested macro with HTML entities (see: Advanced Usage for Roll Queries ). Note that macros which contain HTML entities may no longer function autonomously and must be saved as Abilities . The example given ?{Which macro?|Attack,#ITWF_FullAttack |Defend,#use-shield }   only works if those two macros do not contain any sheet references, i.e. @{Zundar|character_name} and @{Zundar|character_id}. If you remove portions that reference a sheet attribute then it should work. 
1455598720

Edited 1455599183
Indeed; what  Ed S. posted above ( from the Roll20 Wiki ) outlines precisely why you're getting "a ton of nope on the output". However, minor correction (to a very common misconception): Ed S. said: The example given ?{Which macro?|Attack,#ITWF_FullAttack |Defend,#use-shield }   only works if those two macros do not contain any sheet references, i.e. @{Zundar|character_name} and @{Zundar|character_id}. If you remove portions that reference a sheet attribute then it should work.  Attributes are actually not problematic to Roll Queries, as explained by the Advanced Usage for Roll Queries section of that Roll20 Wiki page. What is problematic are the closing curly braces that compose Roll Template syntax, and extraneous commas. (Stray vertical bars are trouble, too, but it doesn't seem like you're using any.) Replace all of those with HTML entities (but spare the Attributes!), and you should be good to go.
Silvyre said: Indeed; what  Ed S. posted above ( from the Roll20 Wiki ) outlines precisely why you're getting "a ton of nope on the output". However, minor correction (to a very common misconception): Ed S. said: The example given ?{Which macro?|Attack,#ITWF_FullAttack |Defend,#use-shield }   only works if those two macros do not contain any sheet references, i.e. @{Zundar|character_name} and @{Zundar|character_id}. If you remove portions that reference a sheet attribute then it should work.  Attributes are actually not problematic to Roll Queries, as explained by the Advanced Usage for Roll Queries section of that Roll20 Wiki page. What is problematic are the closing curly braces that compose Roll Template syntax, and extraneous commas. (Stray vertical bars are trouble, too, but it doesn't seem like you're using any.) Replace all of those with HTML entities (but spare the Attributes!), and you should be good to go. Thank you for making that a little clearer Silvyre. I have always had it in my head that it was the attribute calls that it couldn't process but it's the brackets from the calls that is actually causing the problem. I think I see. It's hard to get my head wrapped around it. That's why you are the query expert.  
Alright thank you, I'll give it a try. I read over the Advanced Usage for Roll Queries guide as well, but I read it, and was like, "I've got to change all of those characters inside of my called Macro? That'll really fix it?" It just seemed strange to me how strict the syntax is when it comes to subsequent curly braces and whatnot. I very much appreciate the kindness and helpfulness displayed here.
1455691289

Edited 1455692067
Attributes are actually not problematic to Roll Queries, as explained by the Advanced Usage for Roll Queries section of that Roll20 Wiki page. What is problematic are the closing curly braces that compose Roll Template syntax, and extraneous commas. (Stray vertical bars are trouble, too, but it doesn't seem like you're using any.) Replace all of those with HTML entities (but spare the Attributes!), and you should be good to go. That's not the behavior I'm getting. I am in fact getting the behavior that Ed S. described, namely that references to sheet attributes break the roll query. For example, I'm trying to set up a macro/ability that rolls a combat maneuver in Pathfinder, where the player selects which combat maneuver they'd like to roll from a drop-down menu. My first draft, which is very incomplete, is as follows: ?{Combat maneuver|Bull rush, &{template:pf_attack} {{name=Bull rush}} {{Check=[[1d20]]}} |Dirty trick, &{template:pf_attack} {{name=Dirty trick}} {{Check=[[1d20]]}} } This seems to work, in that it produces a drop-down menu with no errors, but you'll notice that it doesn't actually roll a combat maneuver, since it doesn't add the Combat Maneuver Bonus (CMB) to the 1d20 roll. However, if I try to add that, as follows: ?{Combat maneuver|Bull rush, &{template:pf_attack} {{name=Bull rush}} {{Check=[[1d20 + @{selected|CMB} ]]}} |Dirty trick, &{template:pf_attack} {{name=Dirty trick}} {{Check=[[1d20]]}} } The query is broken, and the output is garbage. All I did was add + @{selected|CMB} to the Bull rush roll, with the "|" and "}" replaced by HTML entities as recommended. It didn't work. The only difference is that it references a sheet attribute, which leads me to think that this is in fact the problem. Playing around with it further, I hypothesized that the "@{" in "@{selected|CMB}" was contributing to the problem. So I made an additional edit to convert those to HTML entities: ?{Combat maneuver|Bull rush, &{template:pf_attack} {{name=Bull rush}} {{Check=[[1d20 + @{selected|CMB} ]]}} |Dirty trick, &{template:pf_attack} {{name=Dirty trick}} {{Check=[[1d20]]}} } This seemed to help, in that the desired drop-down menu then appeared. But the CMB of the selected token wasn't added. So again, it's the reference to the sheet attribute that wasn't working. EDIT: I want to add that in all the excerpted bits of code above, the closing curly braces and vertical bars were replaced with HTML entities when I pasted them in, as described, forgetting that they would be converted back to the original characters when I submitted the post. So what you're seeing above doesn't show the macro as I actually wrote it and tested it.
I've revised the Advanced Usage for Roll Queries section. Hopefully, it's a bit more comprehensible. Please let me know if you feel it provides some insight into the issues you're having, Carlo .
Yes that helps, thanks! I happened to have the old version still opened in a tab, and comparing them now, this is much, much better. To be honest the old version was very confusingly written, but now that concrete examples are provided the meaning becomes clear. I edited my macro accordingly and it now seems to be working as intended. Thanks for responding so quickly!
Very glad to hear it!
If only we could use a drop down to do those macro and ability calls without all the finagling, well then I would rule the world....
1455728615

Edited 1455729276
That is a really valuable piece of information Silvyre. I learned something! I used it to solve a query call problem i was having within a random treasure generator macro. However it does create a problem in that it ruins my lovely lil templates!   For example, this macro converted into an Ability & Attribute (variable) combo. &{template:default} {{name=TREASURE!}} {{?{Treasure Type?| @{TTA}}}} The value of TTA is "Treasure Type A" from the old AD&D 1e Monster Manual. My translation of it into roll20 it looks like this:  TREASURE TYPE: A Copper: =[[(d71-1)*(d51-1)]] Silver: =[[(d22-1)*(d101-1)]] Electrum: =[[(d99-1)*(d51-1)]] Gold: =[[(d89-1)*(d101-1)]] Platinum: =[[(d51-1)*(d6-1)]] Gems: =[[d26-1]] Jewelry: =[[d19-1]] Magic Item(A): =[[d10>8]] Magic Item(B): =[[d10>8]] Magic Item(C): =[[d10>8]] Other:=[[0]] Now, originally this here was all kept tidy via that pretty lil purple "default" template, because it was just a macro in Settings tab.  However, once i turned it into a called value for a character Ability, of course i had to drop the template format because of those problematic } characters you pointed out.  But now when it prints out in chat, the lines don't stay separated & it creates a jumbled, butt-ugly mess where they all run into each other!  :) How do i get it to display just one line per entry when i can no longer manage it using the template it had before?
You can still use the template structure in your attribute just replace the } in the template fields with }
Here's my recommendation, Goblintrain —no HTML entities required! &{template:default} {{name=TREASURE!}} {{?{Treasure Type?| A, TREASURE TYPE: A Copper: [[(d71-1)*(d51-1)]] Silver: [[(d22-1)*(d101-1)]] Electrum: [[(d99-1)*(d51-1)]] Gold: [[(d89-1)*(d101-1)]] Platinum: [[(d51-1)*(d6-1)]] Gems: [[d26-1]] Jewelry: [[d19-1]] Magic Item(A): [[d10>8]] Magic Item(B): [[d10>8]] Magic Item(C): [[d10>8]] Other:[[0]] | B, TREASURE TYPE: B Copper: [[(d71-1)*(d51-1)]] Silver: [[(d22-1)*(d101-1)]] Electrum: [[(d99-1)*(d51-1)]] Gold: [[(d89-1)*(d101-1)]] Platinum: [[(d51-1)*(d6-1)]] Gems: [[d26-1]] Jewelry: [[d19-1]] Magic Item(A): [[d10>8]] Magic Item(B): [[d10>8]] Magic Item(C): [[d10>8]] Other:[[0]] | C, TREASURE TYPE: C Copper: [[(d71-1)*(d51-1)]] Silver: [[(d22-1)*(d101-1)]] Electrum: [[(d99-1)*(d51-1)]] Gold: [[(d89-1)*(d101-1)]] Platinum: [[(d51-1)*(d6-1)]] Gems: [[d26-1]] Jewelry: [[d19-1]] Magic Item(A): [[d10>8]] Magic Item(B): [[d10>8]] Magic Item(C): [[d10>8]] Other:[[0]] } }}