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
This post has been closed. You can still view previous posts, but you can't post any new replies.

Been trying to get this nested macro type thing working for a while now. Help?

1447558189

Edited 1447575137
Edit: Solved. Trick is to only escape braces and the like for things that aren't macro, attribute, ability, etc. calls. Edit again: For any latecomers, here's my end result: <a href="http://pastebin.com/raw.php?i=mri4Zps8" rel="nofollow">http://pastebin.com/raw.php?i=mri4Zps8</a> Obviously you'll have to replace "Reika" with either "selected" or your own character's name, but you get the idea. --- Here's what I have so far: ?{Attribute check|Strength,%{Reika|strCheck}|Dexterity,%{Reika|dexCheck}} strCheck looks like this: &{template:default} {{name=@{Reika|name}}} {{Strength Check:=[[1d20+@{Reika|strmod}+?{Bonus|0}]]}} The strCheck and dexCheck things work fine when run on their own, but trying to make another macro select between them throws a fit. Any way I can fix that? Or is there a better way to do this entirely?
Please see: <a href="https://wiki.roll20.net/Macros#Troubleshooting" rel="nofollow">https://wiki.roll20.net/Macros#Troubleshooting</a>
1447565791
vÍnce
Pro
Sheet Author
Maybe just roll them into a single macro and display them together. &{template:default} {{name=@{selected|character_name}}} {{Strength Check:=[[1d20+@{selected|strmod}+?{Str Bonus?|0}]]}} {{Dexterity Check:=[[1d20+@{selected|dexmod}+?{Dex Bonus?|0}]]}}
1447566497

Edited 1447567242
Silvyre said: Please see: <a href="https://wiki.roll20.net/Macros#Troubleshooting" rel="nofollow">https://wiki.roll20.net/Macros#Troubleshooting</a> When I replace the nested characters with html entities, I just get the raw text sent to chat and an error telling me "No attribute was found for..." and a buncha html entity gibberish. I assume it was trying to read an attribute with the html entities as part of the name instead of converting them. Gonna need more to go by than that page has if that's an actual way to do this. Vince said: Maybe just roll them into a single macro and display them together. I'd prefer not to make a wall of macro nonsense every time a check comes up, especially since I plan on extending the macro to skill checks once I get this working.
1447569453
vÍnce
Pro
Sheet Author
I get that. &nbsp; I don't think you are going to be able to make a query that includes other macros. &nbsp;The macros get expanded before the query is done which breaks the query. ;-(
1447569787

Edited 1447569919
Jen said: Gonna need more to go by than that page has if that's an actual way to do this. I just expanded the Advanced Usage for Roll Queries section on the Wiki with a "note" to address issues similar to the ones you're having. Please let me know if that section is of help. Note: Due to the order of operations , @{Attribute}, %{Ability} and #Macro calls are converted to their assigned values before Roll Queries are executed. That is to say, the vertical bar and closing brace characters that exist as the syntax of Attribute of Ability calls are replaced before those characters are able to prove problematic to a Roll Query that they are nested within. Consequently, if the assigned value of a nested Attribute, Ability or Macro contains any problematic characters, that item will cause the Roll Query to break as surely as if its assigned value was instead placed directly into the Roll Query instead of its call. If the assigned value of a nested item does contain problematic characters, consider replacing the item's call with its assigned value, and then subjecting that assigned value to the above character replacements. All said, subjecting Attribute, Ability or Macro calls to any character replacements will, under most use cases, cause that call to fail.
1447571848

Edited 1447572034
No sane scripting language I know of ignores additional nesting braces and treats characters within as its own control characters. This behaviour is a bug, right? That's like making floor((2+2)/3) return 4 instead of 1, or even 1.33~. Guess I'll just have to do manual upkeep on my stat mods in the macro to avoid passing control characters to the query. This is less than ideal. :/
Jen said: No sane scripting language I know of ignores additional nesting braces and treats characters within as its own control characters. This behaviour is a bug, right? That's like making floor((2+2)/3) return 4 instead of 1. I'm not sure I follow what you mean. Would you mind explaining?
If I escape the attribute, it gets sent to chat as text instead of the attribute's actual value. ie, "@{selected|dexmod}" instead of "2". If I don't escape it, the parser expanding the macro adds a closing brace inside the query, and the query totally ignores the open brace, treating this as its intended exit point. There's no way to do what I want, nest an attribute call within a query, because the attribute either tries interpreting the html escaping as part of its name or the query interprets the attribute call's closing brace as its own.
Yes; the parser isn't, in general, very picky about which braces it matches. So while I agree this is not ideal, this is (unfortunately) not a bug. However, as I've posted above, the vertical bar and closing brace characters that exist as the syntax of Attribute of Ability calls are replaced before those characters are able to prove problematic to a Roll Query that they are nested within. Hence, is it not necessary that you escape your dexmod Attribute, as the parser only closes the Roll Query after all Attribute calls are converted to their assigned values, i.e. after the Attribute call's closing brace is parsed.
1447573489

Edited 1447573661
Looks like certain ways to nest are ignored, as far as parsing goes. This works fine, without any escaping at all: ?{Attribute|Str,@{Reika|strmod}|Dex,@{Reika|dexmod}} But this fails horribly: ?{Attribute|Str,&{template:default} {{name=@{Reika|strmod}}}|Dex,&{template:default} {{name=@{Reika|dexmod}}}} Everything inside the braces for the template should be ignored as far as the query is concerned. Edit: Oooooooh, I see now. Works if I only escape the template's braces, and not the nested macros and such.
Jen said: Edit: Oooooooh, I see now. Works if I only escape the template's braces, and not the nested macros and such. Yep. :) As a macro-building tip, I'll generally recommend that elements common to all drop-down values within a Roll Query be factored out of the Query. Doubly so for elements that contain problematic characters, such as &{template:default}. Good luck!
1447574207

Edited 1447574330
Well it was either a dropdown or a button for each attribute and skill, not to mention all my spells and the like. Figured nesting like this for a single "ability check" button would be more convenient in the long run. :v And thankies for dealing with me totally missing the point. xd
1447574914

Edited 1447575377
As an alternative, some users prefer calling their macros (especially spells it seems) using API Command Buttons contained within "menus". For example, &amp;{template:default} {{name=Ability Checks}} {{[Strength](!&amp;#13;&amp;#37;{Reika|strCheck&amp;#125;)}} {{[Dexterity](!&amp;#13;&amp;#37;{Reika|dexCheck&amp;#125;)}}
That's some freaky voodoo right there, not sure I like it. Other people trying to talk while I have buttons in the chat might end up with me clicking the wrong thing.
1447608065
vÍnce
Pro
Sheet Author
I would like the API buttons more if they could be styled. &nbsp;Lot's of chat spam as well, unless they are /w to the player/gm.
This site is awesome!
This site is awesome! ^^^^Darril^^^^
1447672553
Ziechael
Forum Champion
Sheet Author
API Scripter
The people on this site make this site awesome! And since the original question has been answered I'll close this thread now :)