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

TokenMod Question: Setting Tooltip to Match Rollable Token Side Name?

1727650514

Edited 1727650563
Dave
Pro
I have a rollable token that I'm using as an in-game clock. It's attached to a sheet called "Clock", and I've got a tokenmod macro that advances the clock by an hour every time I click on it. I'd like to add --set tooltip to my macro to have the tooltip display the current side name, so it'd look like --set tooltip| and then the value or variable to link the name of the new side? But I'm not sure if that value or variable exists. Like, --set tooltip|@{Clock|currentface} or something? I'm kinda coding illiterate and feel like the answer might exist and I'm just stabbing around in the dark, so I thought I'd ask here. I know I could do it by having 24 different macros, one for each hour, and just having --set tooltip|"6 AM" and so on in each macro, but I thought maybe there's a better way.
1727654584
timmaugh
Pro
API Scripter
Hey, Dave... You can pair TokenMod with the Metascript Toolbox to get that information. Here is an example that assumes: 1) the rollable table supplying the token is named "Clock" 2) that table has entries that supply the sides of your token and those entries have the text you are looking to plug into the tooltip (i.e., the "5 AM" entry is named "5 AM" and has the 5am image...) 3) every entry is weighted "1" (default) 4) You have the token selected when you run the TokenMod command. If all of that is true, you can use this formation for the name of the entry from the table: @\(table.Clock.{&math@(selected.currentside) + 1}) Now, you'd want to put that in quotation marks for the purposes of TokenMod, so the TokenMod argument where you use that would look like: --set tooltip|" @\(table.Clock.{&math@(selected.currentside) + 1})" If you don't have the token selected when you run the TokenMod command, you can reference it by name. So, assuming now that you've named the multi-sided clock token something like "ClockToken", you would change the construction to be: @\(table.Clock.{&math@(ClockToken.currentside) + 1}) (basically replacing the reference to "selected" with the actual name of the token). Quick Explanation The Metascript Toolbox is a set of scripts that expand what other scripts can do. If you have an hour to kill, you can watch this video I put together to explain what they are and how they work. You are using two of them in this syntax: Fetch and MathOps. Here are the parts, broken down... @(selected.currentside) ...or... @(ClockToken.currentside) This is a Fetch construction to get the currentside of the token (by selection or by name). This is 0 based, but we need it to be 1-based to retrieve the data from the table, so we're going to use it in a MathOps construction: {&math ... + 1} Then we're going to use that in *another* Fetch construction, this time using the result of the math in a retrieval from the table that supplied the sides for this token: @(table.Clock. ...) Except that this construction will have to wait on the inner stuff to process (the video explains more about this), so we defer it one cycle by introducing a backslash between the @ and the (. @\(table.Clock....) One caveat Depending on the timing, you might need to set the tooltip to the *next* item in the table , since you might be setting the tooltip before TokenMod has had time to process the side change and update the property. At the end of the rollable table (ie, you've reached the last entry), you won't have another entry to get after this one. In that case, Fetch will continue to return the highest/last item from the table. I figure you have logic already built into how you set the side that allows you to determine if you need to flip back over to the start of the table (when the clock has run 24 hours and you need to start over). If you have that logic and you can't figure out how to plug this metascript construction in, post back with your existing TokenMod line and I can help. On the other hand, if you *don't* already have logic that would helpfully flip you over to the start of the table again, that is something the metascripts can help with, too. In that case, also post back with your existing TokenMod command line and I can help with the necessary changes to make it work.
Thank you so much! I appreciate the detailed response. Wonderful. I'm going to give this a try  in a little bit and see how it works!
1727667853

Edited 1727667896
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
You could also try out the Faces script. It proved a graphic, chat-based interface to change face, name, tooltip and GMnotes of a token: For example, here is a table with three entries that have notes: The chat menu generated looks like this: You can use the little buttons in the lower right of each entry to send the note to either the token's tooltip or gmnotes. The little "x" next to each button will clear those fields respectively. Clicking on the graphic changes the face and clicking on the name changes the name. Table entries with and without notes will mix and match: