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.

Query nested in attribute

As a curiosity, I tried nesting the query function within an attribute. Specifically I wrote something like "@{CHARACTER|weapon-?{weapon}-name}" expecting that entering a number would put that number into the attribute it was nested in such as "@{CHARACTER|weapon-#-name} which would then finally return the name of the weapon I entered the number of. Instead, it seemed to parse the text differently than expected. I was properly asked for a value to which I entered "1", and I first got an error "No attribute was found for @{CHARACTER|weapon-?{weapon}" and then the text "CHARACTER|weapon-1" as usually happens when I enter an unrecognized attribute. When I tried using a default value such as in "@{CHARACTER|weapon-?{weapon|1}-name}", the value in the query prompt was instead had "1-name" (no curly brace) initially to which entering resulted in "No attribute was found for @{CHARACTER|weapon-?{weapon}" and "CHARACTER|weapon-1-name". It seems that the attribute function itself was only scanning until the first closed-curly-brace ignoring anything in between regardless as if there were any other macros or functions nested in. But whatever macros are there are still executed independently. I'm not surprised actions like this weren't anticipated, but it could add a bit of flexibility if you can get it to work properly. If you somehow get it to properly parse out and follow order of operations, this could potentially work.
1435298839
The Aaron
Roll20 Production Team
API Scripter
This is not a bug. It has to do with the order of operations of expansion of Attributes (variables) and Roll Queries: See: <a href="https://wiki.roll20.net/Dice_Reference#Order_of_Op" rel="nofollow">https://wiki.roll20.net/Dice_Reference#Order_of_Op</a>... Variables are substituted at step 3, Roll Queries at step 4.