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

[Script Update] TokenMod -- An interface to adjusting properties of a token from a macro or the chat area.

@Jarren: thanks for the clarification. Learned something new again :-)
1635790658

Edited 1635790702
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Will a.  said: This is a heck of a thread, is there any capabilities with token mod, or any other script to have conditionals. for example: if health(bar 3) is below a threshold(constant) add a dice(Roll)? I believe that Script Cards contains conditionals, but I don't use it.
Will a. said: This is a heck of a thread, is there any capabilities with token mod, or any other script to have conditionals. for example: if health(bar 3) is below a threshold(constant) add a dice(Roll)? Also on top of this, does Reusing rolls through $[[0]] calls not work with token mod or is there a way i should be formatting it?
1635790898
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Will a. said: Will a. said: This is a heck of a thread, is there any capabilities with token mod, or any other script to have conditionals. for example: if health(bar 3) is below a threshold(constant) add a dice(Roll)? Also on top of this, does Reusing rolls through $[[0]] calls not work with token mod or is there a way i should be formatting it? IIRC, re-using rolls is generally a display-only feature. But there my be some very specific exceptions. This page might answer your questions.
1635800291
timmaugh
Pro
API Scripter
Will a. said: This is a heck of a thread, is there any capabilities with token mod, or any other script to have conditionals. for example: if health(bar 3) is below a threshold(constant) add a dice(Roll)? I know Keith mentioned ScriptCards. Also, APILogic, a metascript that can be plugged into another script's command line. APIL works from the perspective of what can be recognized at the time APIL runs, evaluating the conditionals, and then leaving the command line in a particular disposition for the intended-recipient script to take action on. The text within the boundaries of the conditional is what is left IN the command line if the conditional passes evaluation. So, a test of bar3 being below some value (lets say, 5), then add a dice roll... the token-mod line could look like: !token-mod --set bar3|+[[1d20]] Then you'd ask how much of that is conditional on the value of bar3. Since that is the only thing we're setting, it's really everything. So we wrap that in the conditional parts of APIL: !{& if @{selected|bar3} < 5 }token-mod --set bar3|+[[1d20]]{&end} If there were MORE things you wanted to do in token-mod (like set other properties), then you might only want to conditionalize the single property setting: !token-mod --set name|Potato {& if @{selected|bar3 < 5}bar3|+[[1d20]]{&end} There are more examples in the APILogic thread, including nesting conditionals and complex AND and/or OR constructions.
1635889058

Edited 1635890386
!token-mod --set tooltip|@{selected|Cond} works, but how do I combine multipple atttributes and text together, to be set in tooltip together. Such as: !token-mod --set tooltip|"@{selected|Cond} and more" or !token-mod --set tooltip|@{selected|Cond},@{selected|Cond2}
1635890493
timmaugh
Pro
API Scripter
Pretty much like your first example... if there is a space, you have to use quotes. Remember, though, that we can't really style the tooltip, so whatever you put in the tooltip will look like a string of text.
!token-mod --set show_tooltip|no Does not seem to work. 'yes' turns it on but I cant turn it off (only manually).
1635904257
Andrew R.
Pro
Sheet Author
I can report that this works: !token-mod --on show_tooltip !token-mod --off show_tooltip
Andrew R. said: I can report that this works: !token-mod --on show_tooltip !token-mod --off show_tooltip On works, but off does not. I do have lots of other scripts active, so maybe a conflict somewhere. Weird, but a minor annoyance.
1636016291
Finderski
Pro
Sheet Author
Compendium Curator
Is there a way to insert a line break in a tool tip?  I'm currently using: !token-mod {{ --set tooltip|"Parry @{selected|parryCur} Toughness @{selected|toughnesscur} (@{selected|toughnessArmor})" --on show_tooltip }} I'd love to have a line break right before Toughness. I've tried: hitting enter in the macro itself (didn't think it would work, since you can have line breaks for the command anyway), \n, 
 and <br>. But none of those work...
1636035286
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
it looks like the displayed text is pretty sanitized. I haven't found a method either.
For those of you who want to move dynamic lighting easily (eg attached to a token), check out the Dynamic Light Recorder script:&nbsp; <a href="https://github.com/symposion/roll20-api-scripts/tree/master/DynamicLightRecorder" rel="nofollow">https://github.com/symposion/roll20-api-scripts/tree/master/DynamicLightRecorder</a>
I noticed that the remove status marker command for multiple instances of the same marker has been changed to only remove the rightmost instance instead of every instance of that marker. Now, the command&nbsp; &nbsp;"!token-mod --set statusmarkers|-blue[]"&nbsp; &nbsp; removes only one instance of the blue status, but what if I do want to remove all of them? It's pretty awkward to count the instances and remove them one by one, and I don't want to clear all status markers of every type, just certain ones. Is there still a convenient way to clear all status markers of a particular name?
1638930438
Mike W.
Pro
Sheet Author
Kaspar K. said: Andrew R. said: I can report that this works: !token-mod --on show_tooltip !token-mod --off show_tooltip On works, but off does not. I do have lots of other scripts active, so maybe a conflict somewhere. Weird, but a minor annoyance. I too cannot get the show_tooltip to turn off. I tried: !token-mod --off show_tooltip !token-mod --set show_tooltip|off Neither works however the 'ON' works with both.&nbsp; I tried this on a test game where Tokenmod is the only script loaded.
1638936031

Edited 1638936115
Mike W.
Pro
Sheet Author
There is another issue I am also having. I have a macro men using Tokenmod that allows me to change a PCs sight from Basic to Peripheral to 360 - works fine. It also allows me to set Darkvision, Nightvision, Infravision, and Ultravision - also works fine. Thus I can set a token to Peripheral vision and give that token Darkvision as well. Then, for example, if I change the token to Nightvision, although the settings show on the token, the settings do not take effect until I then click Save Settings within the token itself. It appears that what I need is for Tokenmod to have a Save Settings switch for Dynamic Lighting.
1638940698
The Aaron
Roll20 Production Team
API Scripter
Sasha said: I noticed that the remove status marker command for multiple instances of the same marker has been changed to only remove the rightmost instance instead of every instance of that marker. Now, the command&nbsp; &nbsp;"!token-mod --set statusmarkers|-blue[]"&nbsp; &nbsp; removes only one instance of the blue status, but what if I do want to remove all of them? It's pretty awkward to count the instances and remove them one by one, and I don't want to clear all status markers of every type, just certain ones. Is there still a convenient way to clear all status markers of a particular name? Sorry for the late reply, no idea how I missed this. You should be able to remove all of them by leaving the brackets off: !token-mod --set statusmarkers|-blue
1638940985
The Aaron
Roll20 Production Team
API Scripter
When I implemented this, there was a disparity between what the api would set abs what the UI would show. &nbsp;If I remember correctly, you'd have to set it off twice before it would work correctly, or something similar. I'll try to check this again. Mike W. said: Kaspar K. said: Andrew R. said: I can report that this works: !token-mod --on show_tooltip !token-mod --off show_tooltip On works, but off does not. I do have lots of other scripts active, so maybe a conflict somewhere. Weird, but a minor annoyance. I too cannot get the show_tooltip to turn off. I tried: !token-mod --off show_tooltip !token-mod --set show_tooltip|off Neither works however the 'ON' works with both.&nbsp; I tried this on a test game where Tokenmod is the only script loaded.
1638941084
The Aaron
Roll20 Production Team
API Scripter
Today's patch is supposed to fix this issue, is it still persisting? Mike W. said: There is another issue I am also having. I have a macro men using Tokenmod that allows me to change a PCs sight from Basic to Peripheral to 360 - works fine. It also allows me to set Darkvision, Nightvision, Infravision, and Ultravision - also works fine. Thus I can set a token to Peripheral vision and give that token Darkvision as well. Then, for example, if I change the token to Nightvision, although the settings show on the token, the settings do not take effect until I then click Save Settings within the token itself. It appears that what I need is for Tokenmod to have a Save Settings switch for Dynamic Lighting.
Is there a way to append text to a tooltip using --set tooltip command? Currently, it overwrites anything already in the tooltip.
1638990331
timmaugh
Pro
API Scripter
Doug E. said: Is there a way to append text to a tooltip using --set tooltip command? Currently, it overwrites anything already in the tooltip. If not natively in TokenMod, then by using a Fetch construction: !token-mod --set tooltip|"@(selected.tooltip); stuff you want to add" Just don't put any TokenMod-breaking key combinations in there... like a double hyphen.
1638991999
Mike W.
Pro
Sheet Author
Doing it twice did not turn it off either. The Aaron said: When I implemented this, there was a disparity between what the api would set abs what the UI would show. &nbsp;If I remember correctly, you'd have to set it off twice before it would work correctly, or something similar. I'll try to check this again. Mike W. said: Kaspar K. said: Andrew R. said: I can report that this works: !token-mod --on show_tooltip !token-mod --off show_tooltip On works, but off does not. I do have lots of other scripts active, so maybe a conflict somewhere. Weird, but a minor annoyance. I too cannot get the show_tooltip to turn off. I tried: !token-mod --off show_tooltip !token-mod --set show_tooltip|off Neither works however the 'ON' works with both.&nbsp; I tried this on a test game where Tokenmod is the only script loaded.
1638996888

Edited 1638996918
Mike W.
Pro
Sheet Author
I just tested this again today and it is still not saving or implementing all the time.. The Aaron said: Today's patch is supposed to fix this issue, is it still persisting? Mike W. said: There is another issue I am also having. I have a macro men using Tokenmod that allows me to change a PCs sight from Basic to Peripheral to 360 - works fine. It also allows me to set Darkvision, Nightvision, Infravision, and Ultravision - also works fine. Thus I can set a token to Peripheral vision and give that token Darkvision as well. Then, for example, if I change the token to Nightvision, although the settings show on the token, the settings do not take effect until I then click Save Settings within the token itself. It appears that what I need is for Tokenmod to have a Save Settings switch for Dynamic Lighting.
1639023846
The Aaron
Roll20 Production Team
API Scripter
Ug.&nbsp; I've confirmed that the patch did not fix it. =( Mike W. said: I just tested this again today and it is still not saving or implementing all the time.. The Aaron said: Today's patch is supposed to fix this issue, is it still persisting? Mike W. said: There is another issue I am also having. I have a macro men using Tokenmod that allows me to change a PCs sight from Basic to Peripheral to 360 - works fine. It also allows me to set Darkvision, Nightvision, Infravision, and Ultravision - also works fine. Thus I can set a token to Peripheral vision and give that token Darkvision as well. Then, for example, if I change the token to Nightvision, although the settings show on the token, the settings do not take effect until I then click Save Settings within the token itself. It appears that what I need is for Tokenmod to have a Save Settings switch for Dynamic Lighting.
1639024041
The Aaron
Roll20 Production Team
API Scripter
Hmm.&nbsp; It's working fine for me.&nbsp; Do you want to PM me an invite to your game and GM me and I can come check it out? Mike W. said: Doing it twice did not turn it off either.
1639024125
The Aaron
Roll20 Production Team
API Scripter
The Aaron said: Sasha said: I noticed that the remove status marker command for multiple instances of the same marker has been changed to only remove the rightmost instance instead of every instance of that marker. Now, the command&nbsp; &nbsp;"!token-mod --set statusmarkers|-blue[]"&nbsp; &nbsp; removes only one instance of the blue status, but what if I do want to remove all of them? It's pretty awkward to count the instances and remove them one by one, and I don't want to clear all status markers of every type, just certain ones. Is there still a convenient way to clear all status markers of a particular name? Sorry for the late reply, no idea how I missed this. You should be able to remove all of them by leaving the brackets off: !token-mod --set statusmarkers|-blue Huh... this seems to have broken.&nbsp; I'll look at fixing it.
1639075661
Mike W.
Pro
Sheet Author
The Aaron Could you show me what command(s) you are using ad how you are using them to achieve this? I assume I am probably doign it wrong. The Aaron said: Hmm.&nbsp; It's working fine for me.&nbsp; Do you want to PM me an invite to your game and GM me and I can come check it out? Mike W. said: Doing it twice did not turn it off either.
1639082818
The Aaron
Roll20 Production Team
API Scripter
I'm literally just using these: !token-mod --on show_tooltip !token-mod --off show_tooltip With the token selected. &nbsp;Do you have the token selected? &nbsp;The other thing is, do you have tooltip text? &nbsp;And finally, how are you verifying this works, are you hovering through token to get the tooltip? Or are you looking at the checkbox in the UI? (That will be wrong, probably)
1639091542
Mike W.
Pro
Sheet Author
Now this is strange, when I used the code you showed me - it works fine. Also now my script is working with either way to shut off the tooltip. I made no changes at all. Thanks again for helping me out. On a side note and FYI: If your use the tooltip command in a Journal Command Button in a Handout and have a colon as part of the tooltip text, you must use the HTML Entity&nbsp; &amp;colon; i n order to get that colon to be recognized and used. For example, I had a tooltip that said "For Partial Darkness: User Darkness penalties.". The tooltip only showed "For Partial Darkness&amp;" and nothing else. Replacing the 'colon' with&nbsp; &amp;colon; fixed the issue. The Aaron said: I'm literally just using these: !token-mod --on show_tooltip !token-mod --off show_tooltip With the token selected. &nbsp;Do you have the token selected? &nbsp;The other thing is, do you have tooltip text? &nbsp;And finally, how are you verifying this works, are you hovering through token to get the tooltip? Or are you looking at the checkbox in the UI? (That will be wrong, probably)
1639093622
The Aaron
Roll20 Production Team
API Scripter
API Buttons use the same syntax as url links. The Roll20 chat parser is simplistic and will treat a thing with a : in it as a URL.&nbsp;
1639096051
Mike W.
Pro
Sheet Author
Thanks for the information, I knew that but for some reason my mind did not click today - Must be the weather! The Aaron said: API Buttons use the same syntax as url links. The Roll20 chat parser is simplistic and will treat a thing with a : in it as a URL.&nbsp;
Related question.&nbsp; These are working for me, but they don't seem to persist for the default token.&nbsp; I turn on the tooltips, update the default token, but when I drag a new token out, the tool tips are off again.&nbsp; It's not really token-mod related because I can manually turn them on and it still does not work. Token with Tool Tip on and set to the default token for the character New token Dragged on, Tool Tip is off Looks like a bug in the tool tips honestly.&nbsp; Wonder if there is a way to write a script that would turn the tool tips on for a new token when it is dropped onto the map?&nbsp; I am looking to replace showing nameplates with using tool tips for names to help with screen clutter. The Aaron said: I'm literally just using these: !token-mod --on show_tooltip !token-mod --off show_tooltip With the token selected. &nbsp;Do you have the token selected? &nbsp;The other thing is, do you have tooltip text? &nbsp;And finally, how are you verifying this works, are you hovering through token to get the tooltip? Or are you looking at the checkbox in the UI? (That will be wrong, probably)
1639157480
The Aaron
Roll20 Production Team
API Scripter
It sounds like you just need to set the token back as the default token for that character: !token-mod --set defaulttoken
1639159534
Andrew R.
Pro
Sheet Author
Yes, that's a bug with the current tooltips implementation. I spotted and reported it when tooltips were announced. I hope it'll get fixed sometime. I'm using tooltips to show the 13th Age defenses, so I turn the tooltip on while prepping the session. No biggie. !token-mod --on show_tooltip
1639173791
Mike W.
Pro
Sheet Author
Any luck yet at fixing this? The Aaron said: Ug.&nbsp; I've confirmed that the patch did not fix it. =( Mike W. said: I just tested this again today and it is still not saving or implementing all the time.. The Aaron said: Today's patch is supposed to fix this issue, is it still persisting? Mike W. said: There is another issue I am also having. I have a macro men using Tokenmod that allows me to change a PCs sight from Basic to Peripheral to 360 - works fine. It also allows me to set Darkvision, Nightvision, Infravision, and Ultravision - also works fine. Thus I can set a token to Peripheral vision and give that token Darkvision as well. Then, for example, if I change the token to Nightvision, although the settings show on the token, the settings do not take effect until I then click Save Settings within the token itself. It appears that what I need is for Tokenmod to have a Save Settings switch for Dynamic Lighting.
1639175366
Andrew R.
Pro
Sheet Author
The Aaron said: It sounds like you just need to set the token back as the default token for that character That doesn't work for my 13th Age monster tokens setup as MOOKS per the documentation. :-(&nbsp; My player's CHARACTER tokens don't use tooltips so far. They really appreciate the tooltips on the monsters, it speeds up play a lot.&nbsp;
1639178006
The Aaron
Roll20 Production Team
API Scripter
Oh!? &nbsp;Tooltip state isn't saved for default tokens!?!?? &nbsp;I'll verify that and then escalate to the Devs.&nbsp;
1639178047
The Aaron
Roll20 Production Team
API Scripter
This is on the Roll20 side, it's not a thing I can fix. Mike W. said: Any luck yet at fixing this?
1639181292
Mike W.
Pro
Sheet Author
Ok thanks for looking into this. Perhaps you could add a tokenmod command that activates the Save Changes, thus forcing it to do so? The Aaron said: This is on the Roll20 side, it's not a thing I can fix. Mike W. said: Any luck yet at fixing this?
1639182488
The Aaron
Roll20 Production Team
API Scripter
The API doesn't have that kind of access. It's running on a server in the cloud, and only interacts with the backend.&nbsp;
1639187028

Edited 1639197940
Mike W.
Pro
Sheet Author
Well I guess I will have to live with that. Thanks. The Aaron said: The API doesn't have that kind of access. It's running on a server in the cloud, and only interacts with the backend.&nbsp;
1639189351
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
The Aaron said: Oh!? &nbsp;Tooltip state isn't saved for default tokens!?!?? &nbsp;I'll verify that and then escalate to the Devs.&nbsp; Yup. It was reported at the time. Given the nature of the feature which felt like a Hacktoberfest sort of thing, I don't have high hopes of any change in functionality.
1639225480

Edited 1639225749
Is there a way to set line breaks inside of a tooltip?&nbsp; Here is what I am working on to use on all my player characters. !token-mod {{ &nbsp; --set &nbsp; &nbsp; represents|@{Dave|character_id} &nbsp; &nbsp; name|"Dave" &nbsp; &nbsp; bar1_link|ac &nbsp; &nbsp; bar2_link|speed &nbsp; &nbsp; bar3_link|hp &nbsp; &nbsp; tooltip|"AC: @{selected|AC}; PP: @{selected|passive_wisdom}; Move Speed: @{selected|speed}; Save DC: @{selected|spell_save_dc}" &nbsp; &nbsp; defaulttoken &nbsp; --on&nbsp; &nbsp; &nbsp; show_tooltip }} The tooltip works mostly as intended, what it shows is something along the lines of AC: 21; PP: 19; MS: 45; Save DC: 17; what i'd like is&nbsp; AC: 21; PP: 19; MS: 45; Save DC: 17; Also, is there any ways I can improve this, so that I don't have to change the names every time, perhaps a quarry in form of a drop down menu for both of the Name fields? That way I have one button that I can just press for setting up a token, without editing it each time. And how can I also have it automatically grant basic vision, or night vison?
1639327531
Andreas J.
Forum Champion
Sheet Author
Translator
Rob F. said: Is there a way to set line breaks inside of a tooltip?&nbsp; Not currently, neither normally or with API. The Tooltip text is heavily sanitized, and doesn't allow any formatting right now. Hopefully that will change for later.
1639531759
The Aaron
Roll20 Production Team
API Scripter
Update v0.8.73 - Fixed a bug that crashed TokenMod when any message used an inline roll of a Tollable Table with no rows.&nbsp; (Thanks&nbsp; Shane M.&nbsp; ) Additionally, I've changed TokenMod so it will do a better job of ignoring messages that aren't meant for it. =D
1639587984
Andreas J.
Forum Champion
Sheet Author
Translator
Request: Minor QoL Have token-mod respond in some way if you call just " !token-mod " without parameters. Simply replying with a short description, link to the TokenMod Handout &amp; this forum thread, and mention of the !token-mod --help -command. If you are troubleshooting APIs and stuff, it's nice if one could just simply verify if the API is alive with the command, instead of having to make some longer command. For newer users/players in a game, it can be confusing if doing ! token-mod does nothing, especially if they don't happen to recall/known !token-mod --help being the exact command. Having it react to "!tokenmod" Either with a reply saying what the correct command is, or outright treating ! tokenmod same as ! token-mod Changing so "!token-mod --help" doesn't dump the whole documentation in the chat. Either shorten so --help only gives the highlights + handout+forum+wiki links when called. Then have new command for dumping the full documentation in the chat. Or have this happen when !token-mod is called without parameters. Handout/--help command giving link to the TokenMod -page, and this forum thread Both contain more examples and help, so adding link to them as "additional sources" would make sense.
1639588573
The Aaron
Roll20 Production Team
API Scripter
That's definitely on my list.&nbsp; I can probably hit the first bullet (and perhaps the second), but the help rewrite is a larger task that I've been working on.
1639784237

Edited 1639784315
Mike W.
Pro
Sheet Author
I am having issues with the following (All from chat as I am testing right now): Emits Bright Light is off. Emits Low Light is off. Directional Light is 0. I use this command:&nbsp; !token-mod --set emits_bright_light|on emits_low_light|on bright_light_distance|2 low_light_distance|5 has_directional_bright_light|on directional_bright_light_total|180 This sets all the fields, actually emits bright light but the light is 360 ° , even though the field on the token says 180 ° . The 180 ° &nbsp;does not take effect until I manually click "Save Changes" on the token. Emits Bright Light is already on. Directional Light is off. !token-mod – set has_directional_bright_light|on directional_bright_light_total|180 This does nothing. I am stumped, what am I doing wrong here?
1639786787
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
You are doing nothing wrong. The API does not respond correctly to that feature yet. Directional light and arc of vision require you to open and close the token settings at the very least before they take.&nbsp;
1639792696
Mike W.
Pro
Sheet Author
Thanks Keith Do you have any idea when this will be addressed?