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

Using TokenMod to update multiple token tooltips

I like to display token names in their tooltips as opposed to the permanently pinned nameplates. I currently use a TokenMod macro to set this up.  !token-mod {{ --set tooltip|"@{selected|token_name}" --on show_tooltip --off showname showplayers_name }} This works great with a single token. The token's name is placed in the tooltip, the nameplate is hidden, and my players see the token name when they float their cursor over the token. Perfect! However, if I select multiple tokens and run the macro, they all end up with the first token's name. For example, if I select an orc, a goblin, and a drider and then run the macro, they all end up with their tooltip set to "Orc". Is there any way I could adjust this macro to allow it to work with multiple tokens? It doesn't even have to require selection. I configure every token this way (PC and NPC) so it could be a macro that effects every token on the page. My current work around is to run the macro token-by-token which isn't great.  Thanks, Don
1652669639
The Aaron
Roll20 Production Team
API Scripter
The best you could do with TokenMod out of the box is set all character tokens at once by using @{selected|character_id} with --ids  However, I bet you could get it done with Tim's Meta scripts. Worst case, I could write you a script that does it for all tokens in one go. 
1652714156
timmaugh
Pro
API Scripter
Hey Don -- you can do this with TokenMod + SelectManager + Fetch + ZeroFrame. I know that sounds like a lot, but the meta-scripts are just broken out into different scripts because they manage different things. In the end, your command line doesn't have to get very complicated. Here's the idea: putting everything into a single TokenMod call means that Roll20 has only one chance to replace the @{selected|token_name} verbiage with the actual token name; and since that replacement only works for the first token selected, you're running into the problem you're describing. We're going to take that single TM call and tell it to run for each token individually (using SelectManager), and feed each of those commands the name of the next token in the set of those you've selected (SelectManager and Fetch). (ZeroFrame keeps them organized and running in the right order, no matter what order you have them installed in your API panel.) The end result should look like this, which I just tested: !forselected(^) token-mod {{   --set   tooltip|"@^(selected.token_name)"   --on   show_tooltip   --off   showname   showplayers_name }}
Thank you both for your solutions. Tim's suggestion worked perfectly! You've saved me a lot of clicking :)