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

[Macros] [Dark Heresy 2e] How can I combine Attribute (Characteristic) macros with Query macros?

The title says it all, really. This is what I have at the moment, and I'm baffled as to how to fix it. From what I'm understanding, the vertical bar/pipe ("|") within the attribute roll is confusing the equation for the query and is messing it up. I've tried use parenthesis, hoping they'd show the system where an equation begun and one ended, but to no success. This is what I have so far: &{template:default} {{name=Characteristic Roll}} {{Characteristic Roll=?{Characteristic?| WeaponSkill, [[-1*(1d100) +@{selected|WeaponSkill +?{modifier|0}]] | BallisticSkill, [[-1*(1d100) +@{selected|BallisticSkill} +?{modifier|0}]] | Strength, [[-1*(1d100) +@{selected|Strength} +?{modifier|0}]] | Toughness, [[-1*(1d100) +@{selected|Toughness} +?{modifier|0}]] | Agility, [[-1*(1d100) +@{selected|Toughness} +?{modifier|0}]] | Intelligence, [[-1*(1d100) +@{selected|Intelligence} +?{modifier|0}]] | Perception, [[-1*(1d100) +@{selected|Perception} +?{modifier|0}]] | Willpower, [[-1*(1d100) +@{selected|Willpower} +?{modifier|0}]] | Fellowship, [[-1*(1d100) +@{selected|Fellowship} +?{modifier|0}]] | Influence, [[-1*(1d100) +@{selected|Influence} +?{modifier|0}]] | Corruption, [[-1*(1d100) +@{selected|Corruption} +?{modifier|0}]] }}}
1467660324

Edited 1467660376
Did you do the HTML conversions on the pipes "|", commas "," and the closing curly braces "}" when inside the "master" query? It's to be noted the you don't do HTML conversions when you are doing attribute calls @{|} or macro calls %{|}.
1467660378
Lithl
Pro
Sheet Author
API Scripter
Replace the pipes, closing brace, and any commas in your query (eg, for a select dropdown query) with their HTML entity equivalents. | is | , is , } is } If you want to nest a query inside of a query, go one level deeper, escaping the ampersand. For example, | becomes |. You can go as many levels deep like this as you like. Note that if you put this into a macro (on your Settings tab) and then re-open the macro later, those entities will be resolved to their normal characters, and you'll have to replace them again. If you do this with abilities (on your character sheet), that won't happen.
I... May be being a bit of a dunce, but I'm not sure of what you guys are suggesting? O_o I need to swap all of the pipes with &#123, right? I think? And all of the closing braces with &#125? But do nothing to the opening braces?
1467672462
Lithl
Pro
Sheet Author
API Scripter
Swap the pipes with | (not 123) and the closing braces of the queries (not the @{attributes} or %{abilities}) with }
1467675631

Edited 1467675653
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
Douglas William Bacon said: I... May be being a bit of a dunce, but I'm not sure of what you guys are suggesting? O_o I need to swap all of the pipes with &#123, right? I think? And all of the closing braces with &#125? But do nothing to the opening braces? Basically, yes, although there are some caveats: You want to leave any ability calls alone, so @{STR} is not modified and neither is @{selected|STR}. This is because attribute calls are resolved before the roll query, so they become whatever number/text/value/etc. you have stored in that attribute. Sometimes you also need to replace commas with their html entity. If you have any complicated values in a stored attribute that you are calling (like say a whole macro), you will need to do all this in those as well, and then again for any complex attributes called in those. Take a look at the roll query entry in the wiki  here  for more info on what needs doing. And take a look at the API command button wiki entry  here  for more info on html entity escaping. This won't work for you case above, but I prefer using Ability Command Buttons in place of complicated roll queries. They add to chat log clogging, but they are also a lot less easy to mess up, and a whole lot easier to setup.
This has me a bit taken aback, as I've never had to do it before when it comes to either attribute calls or queries, is this a recent development? Or does it only apply when it comes to more complicated macros? (Out of interest, that is.) As for the macro itself, should it look something like this now? <a href="http://pastebin.com/PwjEsFeK" rel="nofollow">http://pastebin.com/PwjEsFeK</a> If someone could show and correct any errors, that'd be great, as I'm a tad dyslexic. (I can also report that it still isn't working properly, so I'm still confused. As far as I can tell I replaced all of the pipes and closing braces - that are not a part of calls or queries - and that there are no commas in the macro?)
1467682195

Edited 1467682444
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
Yep, the html escaping is only needed when your trying to do complicated roll queries.
1467682939

Edited 1467683238
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
Just looked at your paste bin. You've got too many html escapes in now. You only need them for the things that are inside a roll query, so your macro: &{template:default&#125 {{name=Characteristic Roll& #125& #125 {{Characteristic Roll=?{Characteristic?& #124 WeaponSkill, [[-1*(1d100) +@{selected|WeaponSkill +?{modifier|0}]] & #124 BallisticSkill, [[-1*(1d100) +@{selected|BallisticSkill} +?{modifier|0}]] & #124 Strength, [[-1*(1d100) +@{selected|Strength} +?{modifier|0}]] & #124 Toughness, [[-1*(1d100) +@{selected|Toughness} +?{modifier|0}]] & #124 Agility, [[-1*(1d100) +@{selected|Toughness} +?{modifier|0}]] & #124 Intelligence, [[-1*(1d100) +@{selected|Intelligence} +?{modifier|0}]] & #124 Perception, [[-1*(1d100) +@{selected|Perception} +?{modifier|0}]] & #124 Willpower, [[-1*(1d100) +@{selected|Willpower} +?{modifier|0}]] & #124 Fellowship, [[-1*(1d100) +@{selected|Fellowship} +?{modifier|0}]] & #124 Influence, [[-1*(1d100) +@{selected|Influence} +?{modifier|0}]] & #124 Corruption, [[-1*(1d100) +@{selected|Corruption} +?{modifier|0}]] & #125& #125& #125 Should be: &{template:default } {{name=Characteristic Roll }} {{Characteristic Roll=?{Characteristic? | WeaponSkill, [[-1*(1d100) +@{selected|WeaponSkill } +?{modifier|0&nbsp; & #125 ]] | BallisticSkill, [[-1*(1d100) +@{selected|BallisticSkill} +?{modifier|0&nbsp; & #125 ]] | Strength, [[-1*(1d100) +@{selected|Strength} +?{modifier|0&nbsp; & #125 ]] | Toughness, [[-1*(1d100) +@{selected|Toughness} +?{modifier|0&nbsp; & #125 ]] | Agility, [[-1*(1d100) +@{selected|Toughness} +?{modifier|0 & #125 ]] | Intelligence, [[-1*(1d100) +@{selected|Intelligence} +?{modifier|0&nbsp; & #125 ]] | Perception, [[-1*(1d100) +@{selected|Perception} +?{modifier|0 & #125 ]] | Willpower, [[-1*(1d100) +@{selected|Willpower} +?{modifier|0 & #125 ]] | Fellowship, [[-1*(1d100) +@{selected|Fellowship} +?{modifier|0 & #125 ]] | Influence, [[-1*(1d100) +@{selected|Influence} +?{modifier|0 & #125 ]] | Corruption, [[-1*(1d100) +@{selected|Corruption} +?{modifier|0 & #125 ]] }}} delete the space between the ampersand and pound sign to use. EDIT: Made the additions/changes more clear with bolding, and I had left in two unnecessary (and macro breaking) html escapes.
Thanks! Look like I completely misunderstood what was said - although it still doesn't seem to be working after removing the space between the ampersands and pound signs? To give you a visual, here's what occurs after the button is pressed on the left side, and how it resolves on the right (the newest entry in the chat). (Leaving out the input-value section for modifiers, as that seems to be working just fine.)
1467684084
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
Woops, my bad, you need to escape the pipe inside the modifier roll queries as well: ?{modifier|0 & #125 ]] Should be: ?{modifier&nbsp;&nbsp; & #124&nbsp; 0 & #125 ]]
With those changes I'm now getting the following steps and end result:
In fact, that is my bad! I edited the already-edited macro without redoing all of the braces again. It's now working wonderful! Thanks! I'll report back if I have any more problems with this in the immediate future. Credit to Scott C. but thanks to everybody else also!
1467686091
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
Ha, truly, credit goes to qwerty as pretty much everything that I relayed to you was from things he had posted about previously. I just passed them on while he's apparently offline.
1467692422
vÍnce
Pro
Sheet Author
For some strange reason, it's best practice to include spaces before and after double braces when using inline rolls within roll templates.