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.

1646347808
The Aaron
Forum Champion
API Scripter
And also do not have the lock overlay image.  Just for clarity, I'm pretty sure I don't have door script. Probably you're thinking of Matt's or Scott's script?
1646348041
The Aaron
Forum Champion
API Scripter
Jarren said: DM Eddie said: I like this but would there be a way to make a command that behaves like tokenlock did?  Where it locks all tokens on the map?  Am thinkin specifically for when traps trigger and I want everything to freeze.   I just updated my 'Lock' macro (previously using MapLock and TokenLock) to just use the new locking feature in TokenMod. After creating a map on a page and getting everything set, I just select all (Ctrl-A) on the map layer and use my lock macro (which is just !token-mod --on lockMovement). This works great to prevent accidental moving of the map image later on. You could do the same thing by just selecting everything on the Object layer and then using the TokenMod lock after a trap is triggered. But for locking just the player tokens, I found it was easier for me to just put the character_id's in an attribute on my MacroMule character (which stores the macros anyways) and just reference the attribute in the macro. That way I can update the 'AllPlayersIDList' attribute if I ever change characters or if they add familiars, etc. ?{Lock or Unlock | Lock,!token-mod --on lockMovement | Unlock,!token-mod --off lockMovement | Lock Players,!token-mod --ids @{MacroMule|AllPlayersIDList} --on lockMovement| Unlock Players,!token-mod --ids @{MacroMule|AllPlayersIDList} --off lockMovement} AllPlayersIDList @{CHARACTER1|character_id} @{CHARACTER2|character_id} @{CHARACTER3|character_id} ... This is functionally the same as the TokenLock script, because it only affected tokens that had something set in the 'controlled by' field.  I also like that I can still use 'Vision Crumbs' without inadvertently turning off the locking when using a macro to unlock all player-controlled tokens. So that's just an idea that might be helpful! You might be interested in the --active-pages and --flip options: !token-mod --ids @{MacroMule|AllPlayersIDList} --flip lockMovement --active-pages --active-pages will only look on pages where there are logged on users. --flip will just toggle the setting for each. 
1646374953
The Aaron said: You might be interested in the --active-pages and --flip options: !token-mod --ids @{MacroMule|AllPlayersIDList} --flip lockMovement --active-pages --active-pages will only look on pages where there are logged on users. --flip will just toggle the setting for each.  As always you are helpful and insightful! I don't think --flip is going to be as useful for me, because I don't typically have a lot of need to flip back and forth.  I'm typically using the Lock for transparent vision/light tokens and map images (so I want to keep them locked) and if I add a new item to the map page, it's easy for me to just select all and --on lockMovement. If I used --flip, then anything that was locked becomes unlocked.  And for the few times when I do want to 'stop the action', it's helpful to have it set to --off to make sure I'm getting all of my player's attention, and not accidentally unlocking something I wasn't trying to unlock. :)  For other people who are locking/unlocking tokens more often, --flip would definitely be an easier way to toggle, and could make it a 'one-click' macro button. But the --active-pages will be good to add to my macro.  I'm not typically using more than one active page, and I'm usually pulling out fresh tokens on new pages, but that could still potentially pop up from time to time, so that setting will help prevent issues when I've forgotten about this update in a couple months and how to go about adjusting the macro! Thanks!
1646388161
keithcurtis said: al e.  said:  I was asking if the token lock macro allowed interaction, but not movement. I will have time to test it out over them weekend, but I figured one of the illuminated would be able to answer and save the testing time. The token lock (and map lock) scripts are workarounds. They do not actually prevent you from changing anything, but they immediately reversethe change. They do have the advantage over the new lock feature of preventing re-sizing and rotation. Unfortunately yes. Players still can move their tokens but then they snap back.
1646663636

Edited 1646680347
(deleted) Edit: found it:  @{selected|bar1|max}
1646684746
The Aaron
Forum Champion
API Scripter
Zaodon said: (deleted) Edit: found it:  @{selected|bar1|max} BTW, you can get that functionality also with the bar1_reset,  bar2_reset, and bar3_reset pseudo attributes: !token-mod --set bar1_reset| (because of some necessary refactoring, the | needs to be on the end) This will copy the bar1_max value into the bar1_value property.  The nice thing is, you can do it for a bunch of tokens at once that don't have the same max value.
1647534906

Edited 1647535049
Hi! I was wandering if there's a script for activate darkvision on a token when using Goggles of Night? Or to set darkvision on his token when he clicks on the checkbox of that item on his character sheet?
1647535894
The Aaron
Forum Champion
API Scripter
Such a script could be written, I'd suggest posting a fresh thread in the API forum asking about it.
1647538041

Edited 1647538149
The Aaron said: Such a script could be written, I'd suggest posting a fresh thread in the API forum asking about it. Thanks Aaron!! But is it possible as a macro? I don't have access to the API :-) It is just for one player!
1647544449
The Aaron
Forum Champion
API Scripter
Nope, such automation is what the API is for. There isn't a way to do that without the API. 
1647580910
The Aaron said: Nope, such automation is what the API is for. There isn't a way to do that without the API.  And that's the reason why your API token-mod is such a big tool! I control sight and lighting, status icons etc. with it. Becoming blind? Click. See again? Click. SEVERAL PCs got poisoned? ONE click. And everytime I play with a DM without that tool, I see how cumbersome DMing can be. Thanks again for it, Aaron!
1647581327
The Aaron
Forum Champion
API Scripter
No problem. =D
1647715480
Nick O.
Forum Champion
Can tokenmod be used to play/stop an animation for an animated token? E.g., there are animated token packs that say, show a door opening, and I'd like to create a macro that would call token mod to tell the door to open, and then another call to doorknocker that would handle the dynamic lighting. 
1647721230
Nick O. said: Can tokenmod be used to play/stop an animation for an animated token? E.g., there are animated token packs that say, show a door opening, and I'd like to create a macro that would call token mod to tell the door to open, and then another call to doorknocker that would handle the dynamic lighting.  As of a couple of weeks ago the API did not have access to the animation controls. Matt's Door Script shows door open or closed, to the eye it appears as though it is moving, while it actually is swapping images.
1647788588

Edited 1647788617
The Aaron
Forum Champion
API Scripter
What Al E said. The API doesn't have access to animated graphic controls. It can create them, but can't control them. As I remember, creating them from the API creates them in a paused state, which basically makes them useless to the API. 
1648069758
Mike W.
Pro
Sheet Author
I may have missed it but is there a TokenMod API command that resets/turns off/sets to o all of the Dynamic Lighting settings for a Token?
1648100940
The Aaron
Forum Champion
API Scripter
There isn't a single setting for  that, but you could definitely write a macro that sets all of them. 
1648106145
Mike W.
Pro
Sheet Author
The Aaron said: There isn't a single setting for  that, but you could definitely write a macro that sets all of them.  Yeah I have done that but I wish there had been a simpler way as it took a lot for me to get it right. Thanks again for TokenMod. On a side question. I noticed that Token Marker have a different ID# in each game - even if the exact same token marker. Is there a way to get that ID# number using a macro and the name of the token marker?
1648127739
timmaugh
Pro
API Scripter
Mike W. said: On a side question. I noticed that Token Marker have a different ID# in each game - even if the exact same token marker. Is there a way to get that ID# number using a macro and the name of the token marker? If you just need the name and ID of a token marker (or of a bunch of token markers), Fetch + ZeroFrame can output that for you. Just assign the ones in question to a token, select the token, and then run: !The selected token has these markers assigned: @(selected.markers){&simple}
1648131991
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
You can also open the help handout for token-mod. It will list all of the installed token markers in a big block.
1648132735
timmaugh
Pro
API Scripter
Ah! I had forgotten about that! That's probably simpler. Until certain... other tools... become available...? No. Probably not. This will still be simpler. But we WILL have lasers. ... ...No? That's a 'no' on the "la-zors"? Honestly, what do I even pay you people for?
1648168934
Mike W.
Pro
Sheet Author
What I was hoping to do was write a macro, using Token Mod commands, to call a Token Marker by name, then get is ID so it can be set to to a token. Thus to be generic enough to use in any game that has the same Token Markers. This wihout having to use the handout, which I have already done, for each and every game. Thanks for the help on this.
1648175456
The Aaron
Forum Champion
API Scripter
You can just use the name without the tag on TokenMod, so long as it's unique.  So, for this: You can just do this: !token-mod --set statusmarkers|+mountains If the name has a space, like this: You'll need to use the tag version though: !token-mod --set statusmarkers|+Eye_Balls::2591986
1648184009
Mike W.
Pro
Sheet Author
Great, I will give this a try, Thanks again  The Aaron
Greetings, and thank you for this script! I was wondering if anyone had an idea for how I could use it to roll a token's hp. I've gotten it to roll current hp by using: !token-mod {{ --set bar3_value|[[@{selected|npc_hpformula}]] }} This is fine, however I have to edit the token to add it's max HPas the same number in order for the "health bar" to look right for my players. My first assumption was to try: !token-mod {{ --set bar3_value|[[@{selected|npc_hpformula}]] --set bar3_max|@{selected|bar3_value} }} But this seems to not work, even if I wrap it in square brackets. Is there a way to achieve this? Thanks so much for any help!
1648352697
Brandon D. said: Greetings, and thank you for this script! I was wondering if anyone had an idea for how I could use it to roll a token's hp. I've gotten it to roll current hp by using: !token-mod {{ --set bar3_value|[[@{selected|npc_hpformula}]] }} This is fine, however I have to edit the token to add it's max HPas the same number in order for the "health bar" to look right for my players. My first assumption was to try: !token-mod {{ --set bar3_value|[[@{selected|npc_hpformula}]] --set bar3_max|@{selected|bar3_value} }} But this seems to not work, even if I wrap it in square brackets. Is there a way to achieve this? Thanks so much for any help! !token-mod --set bar1_max|[[@{selected|npc_hpformula}]] !token-mod --set bar1_reset|
1648352787
The Aaron
Forum Champion
API Scripter
If you use just bar3, it will set the current and max value to the same number: !token-mod {{ --set bar3|[[@{selected|npc_hpformula}]] }}
Much love, both of you! Thank you!
1648368107
Andreas J.
Forum Champion
Sheet Author
Translator
I've recently updated the TokenMod wiki page with more example, along with dedicating a section for different methods of Token Selection: <a href="https://wiki.roll20.net/TokenMod#Token_Selection" rel="nofollow">https://wiki.roll20.net/TokenMod#Token_Selection</a>
1648398032

Edited 1648398061
I've another question! Is it possible to use the updated script: !token-mod {{ --set bar3|[[@{selected|npc_hpformula}]] }} To randomize a whole group's HP? Right now, if I have multiple creatures selected, even if they are associated with different characters, one formula is chosen and rolled, and that result is applied to every token selected. Is it possible to make it roll a unique value for each token selected? Thanks for your time!
1648483798
Brandon D. said: I've another question! Is it possible to use the updated script: !token-mod {{ --set bar3|[[@{selected|npc_hpformula}]] }} To randomize a whole group's HP? Right now, if I have multiple creatures selected, even if they are associated with different characters, one formula is chosen and rolled, and that result is applied to every token selected. Is it possible to make it roll a unique value for each token selected? Thanks for your time! You could use Timmaugh's SelectManager script to apply the same process to all selected tokens (instead of the same value ). I'm not super proficient with SelectManger, but I believe it would just require adding&nbsp;!forselected before your current TokenMod call (and removing the ! from the TokenMod call): !forselected token-mod {{ --set bar3|[[@{selected|npc_hpformula}]] }} Or on a single line: !forselected token-mod --set bar3|[[@{selected|npc_hpformula}]]
1648497460

Edited 1648499583
timmaugh
Pro
API Scripter
Jarren said: Brandon D. said: I've another question! Is it possible to use the updated script: !token-mod {{ --set bar3|[[@{selected|npc_hpformula}]] }} To randomize a whole group's HP? Right now, if I have multiple creatures selected, even if they are associated with different characters, one formula is chosen and rolled, and that result is applied to every token selected. Is it possible to make it roll a unique value for each token selected? Thanks for your time! You could use Timmaugh's SelectManager script to apply the same process to all selected tokens (instead of the same value ). I'm not super proficient with SelectManger, but I believe it would just require adding&nbsp;!forselected before your current TokenMod call (and removing the ! from the TokenMod call): !forselected token-mod {{ --set bar3|[[@{selected|npc_hpformula}]] }} Or on a single line: !forselected token-mod --set bar3|[[@{selected|npc_hpformula}]] So, the other thing you'll have to do to that command line is "defer" the inline roll. Without getting into the weeds of the timing, you have to "hide" the inline roll while Roll20 is dealing with the initial line, then expose it for each roll/token in turn. That would make the line look like this: !forselected(^) token-mod --set bar3|[^[^@{selected|npc_hpformula}^]^] Select a bunch of tokens, run this, and you should get individualized results for each.
1648589630
So is it my understanding that token-mod can work with any marker set?&nbsp; I thought it was limited to a couple of predefined ones. The Aaron said: You can just use the name without the tag on TokenMod, so long as it's unique.&nbsp; So, for this: You can just do this: !token-mod --set statusmarkers|+mountains If the name has a space, like this: You'll need to use the tag version though: !token-mod --set statusmarkers|+Eye_Balls::2591986
1648593857
Kraynic
Pro
Sheet Author
Darryn said: So is it my understanding that token-mod can work with any marker set?&nbsp; I thought it was limited to a couple of predefined ones. No, I use all custom markers (that I created and uploaded) in my games, and TokenMod uses them just fine as long as libTokenMarkers is installed.
1648627170
Brandon D. said: I've another question! Is it possible to use the updated script: !token-mod {{ --set bar3|[[@{selected|npc_hpformula}]] }} To randomize a whole group's HP? Right now, if I have multiple creatures selected, even if they are associated with different characters, one formula is chosen and rolled, and that result is applied to every token selected. Is it possible to make it roll a unique value for each token selected? Thanks for your time! If you use the VTT Enhancement suite (<a href="https://discord.com/channels/495906673446092800/495907770844053514" rel="nofollow">https://discord.com/channels/495906673446092800/495907770844053514</a>) you can just use the 'Hit Dice' function (context menu) there. It provides lot more functions, but for that it is the easiest way I guess.
1648633543

Edited 1648640654
Hi, I discovered an issue while using dynimic lighting basic setup is token dropped with vision OFF but configured with night vision ON with dimming NV effect and 5meters size i have a macro which regroup many vision macro but the main one i use is to toggle vision ON : !token-mod --set bright_vision|1 when i do that, i get vision, i get night vision, but my problem is, i get the "dynamic memory vision" equal to night vision even when i do this macro : !token-mod --set bright_vision|1 night_vision|1 night_vision_distance|5 night_vision_effect|dimming|0 result is the same with token_mod (or any script maybe ?) i got "holes" corresponding to my NV distance where i drop the token: meanwhile, when i drop the token, and turn on vision manually, i see the night vision already toggled on, and the "dynamic memory vision" as i called previously is correctly equal to my vision + night vision (i dropped it onlt 2 times diagonally, trying toi replicate the main position) is there a way to fix that ? thanks for your script anyway, its immensely usefull for a lot of tasks, i use it a lot ! have a good day
1648663733
I've seen the same thing and the only work around I have found it is open the token and turn vision off then back on again.&nbsp; I don't think it is an issue with Token Mod specifically.
1648666507
I also encountered the problem and think it is a roll20 problem. Funny though that it happens not all the time.
1648688502
yeah that's what i thought, but opening every sheet and doing it manually is a pain in the a** when you change page and let player drop their token but want to control where/when they can start to see with this problem you have to prepare everything or lose some minutes is there any chance roll20 devs could investigate into that ? i'm pretty new on the forums so i don't know how/where we could contact them about this matter if it's not related to the script, as i feel like that about this problem.
1648702212
The Aaron
Forum Champion
API Scripter
Sorry for the late response, I was without internet for a day.&nbsp; As others have mentioned, this is a Roll20 bug. I bring it up to the devs every month or so. I know they are interested in fixing it, and there is a renewed focus on the API lately. Here's hoping!
1648749646
Ok, thanks a lot for you answer, and work globally ! Fingers crossed during the time :)
1648852745
Is there a way to set bar visibility via tokenmod?
1648854294
Kraynic
Pro
Sheet Author
David B. said: Is there a way to set bar visibility via tokenmod? Yeah, it is in the help handout.&nbsp; I recommend popping that out in another window so you can use the browser control + F to find what you want.&nbsp; It looks like those commands were the second in the list when I put "bar" in as the search term.
1649768406
Hello everyone! I was looking through the roll20 documentation about tooltips and saw that through APIs it si possible to display the current status of a token (half-health, ecc.) and couldn't help but wonder if there was a way to do it using TokenMod. I'm not the most API savvy person, so apologies if it's an obvius question, and thanks to anyone that will help! The example on the roll20 documentation: <a href="https://wiki.roll20.net/images/2/2c/Tooltip-example-dec2021.gif" rel="nofollow">https://wiki.roll20.net/images/2/2c/Tooltip-example-dec2021.gif</a>
1649768870
The Aaron
Forum Champion
API Scripter
You can set the tooltip: !token-mod --on show_tooltip --set tooltip|"some text you want displayed" which is what you're seeing in that image.&nbsp; Automating getting various data in there would require a specific script.
1649771364
timmaugh
Pro
API Scripter
Or a little metamancery. =D APILogic can give you conditional checks, or Muler can give you static-access table. Then you'd put those constructs right in the Token-Mod line, and a single macro would give you the proper tooltip output, no matter the status of the token. I've left a lot of examples around the site, but I can provide another, if you think this approach would be helpful.
1649876155
The Aaron said: You can set the tooltip: !token-mod --on show_tooltip --set tooltip|"some text you want displayed" which is what you're seeing in that image.&nbsp; Automating getting various data in there would require a specific script. I see so I'll need something on top of Token Mod, that's exactly what I was unsure of, thank you very much! timmaugh said: Or a little metamancery. =D APILogic can give you conditional checks, or Muler can give you static-access table. Then you'd put those constructs right in the Token-Mod line, and a single macro would give you the proper tooltip output, no matter the status of the token. I've left a lot of examples around the site, but I can provide another, if you think this approach would be helpful. If you could be so kind as to share it, it would be greatly appreciated, than you!
1649878006
The Aaron
Forum Champion
API Scripter
So, my guess is that as the token's hti point bar changes, you'd like certain updates to show up in the tooltip?&nbsp; That would likely be a whole other script, but could probably be done with some Tim Metascript magic.&nbsp; I'd suggest starting a new thread with the explicit ask for what you want, and Tim or I or someone else will solve it for you. =D&nbsp; I have several little scripts that mark tokens as bloodied (half health) and similar, which could be extended to give annotations in the tooltips pretty easily.&nbsp; Feel free to link the other thread here for continuity. =D
1649881758
The Aaron said: So, my guess is that as the token's hti point bar changes, you'd like certain updates to show up in the tooltip?&nbsp; That would likely be a whole other script, but could probably be done with some Tim Metascript magic.&nbsp; I'd suggest starting a new thread with the explicit ask for what you want, and Tim or I or someone else will solve it for you. =D&nbsp; I have several little scripts that mark tokens as bloodied (half health) and similar, which could be extended to give annotations in the tooltips pretty easily.&nbsp; Feel free to link the other thread here for continuity. =D Thank you, I'll do just that! Yes, what I would like to achieve is something that tells my players when their friends or enemies are wounded, bloodied or dying, you hit the nail right on the head. I posted my original request here for anyone interested: <a href="https://app.roll20.net/forum/post/10808466/using-the-tooltip-to-show-a-characters-status-on-hover/?pageforid=10808466#post-10808466" rel="nofollow">https://app.roll20.net/forum/post/10808466/using-the-tooltip-to-show-a-characters-status-on-hover/?pageforid=10808466#post-10808466</a>&nbsp;&nbsp;