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

How to call the initiative of a randomly selected token from the turn tracker

So this doesn't seem to work [[@{tracker|@{selected|token_name}}]] Any ideas on how to do it, or are we in API territory?
1648627206

Edited 1648627435
vÍnce
Pro
Sheet Author
What are you wanting to accomplish? If you just need to add a token to the tracker try; [[ 0 @{tracker} ]] I believe &{tracker} assumes the token_name by default so @{selected|token_name} shouldn't be needed. Include a number or roll inside the inline roll brackets otherwise it will fail.
It looks like you're trying to pull the initiative of the selected token. It can be done using the Prefix trick and you'll probably need a Macro mule . With the final macro looking something like [[ @{Macro|prefix}tracker|@{selected|token_name}} ]] One thing to note:- if you have multiple tokens with the same name in the tracker it will pull the initiative of the last one in the current order
Thanks RainbowEncoder. That does the trick. Thanks a lot!
1648697681
vÍnce
Pro
Sheet Author
RainbowEncoder said: It looks like you're trying to pull the initiative of the selected token. It can be done using the Prefix trick and you'll probably need a Macro mule . With the final macro looking something like [[ @{Macro|prefix}tracker|@{selected|token_name}} ]] One thing to note:- if you have multiple tokens with the same name in the tracker it will pull the initiative of the last one in the current order That's a neat trick.  How/why does that actually work when just using "@{" doesn't?
vÍnce said: That's a neat trick.  How/why does that actually work when just using "@{" doesn't? When a "@{" appears it grabs all the text up to the next "}" and that can include other "@{" so you cannot nest attributes in that manor. In this instance it would look for the attribute "tracker|@{selected|token_name" and since "@{selected|token_name" isn't on the tracker it fails. However when searching for attributes it will find all it can before doing any replacements. So the prefix attribute and the token name get resolved simultaneously and then on the second pass the @{tracker| attribute will now have the token_name ready to go allowing it to look at the correct entry.
1648757692
vÍnce
Pro
Sheet Author
I have been enlightened.  Thanks RainbowEncoder.