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.

1609351653

Edited 1609351919
Styx
Pro
Question - Is it possible to use Token-Mod to group selected (or preset) tokens? Example  - I'm about to start a ROTF campaign and one of my players had already bought a dogsled and 2 dogs in session zero. I'd like to see if I can set a Token Action macro to toggle grouping of the 3 separate tokens I have for the 2x dogs and 1x sled (potentially adding the PC token at some point too). I've seen the Carry Token script, but found it too easy to deselect the group when moving the grouped tokens, thus breaking the "carry" function. EDIT: Thinking about this, I can't see how there could be a way that is different to the click+drag select process or even if there was a way that it would be temporary. Hmm.. Side note, I edited the "Vision" macro I posted above to apply only to Prop Tokens while also setting their Name to the changed Light Source. Only sharing this because I love the QoL change this has brought me as a new DM who does data analytics for a living and gets too easily caught up in automation efficiencies ;) Thank you again
1609362129
The Aaron
Roll20 Production Team
API Scripter
Grouping isn't exposed to the API.
@Styx, you could accomplish this with the Marching Order script. It lets you save token formations so they'll follow the leader in roughly the same formation, and you can even have multiple formations active simultaneously.
Persephone said: @Styx, you could accomplish this with the Marching Order script. It lets you save token formations so they'll follow the leader in roughly the same formation, and you can even have multiple formations active simultaneously. Cool, thanks, I'll look into that! I had a feeling @The Aaron
Hey Aaron, just wanted to say thanks for all you've done for all of us fellow nerds! I apologize if this has already been addressed, but I've been trying to make a macro with tokenmod that both lights a torch and snuffs a torch with one macro as to not crowd the macro bar. What I currently have sets bright light for 20 feet and also snuffs the torch if the token is already emitting light, but still does not add the 20 feet of dim light that comes with lighting a torch. Maybe you can help! I'm new to scripts and macros in general, but trying to learn! Here's what I have so far: !token-mod {{   --on     has_bright_light_vision     emits_bright_light     emits_low_light   --set     bright_light_distance|!20     low_light_distance|!20 }}
1609526302
The Aaron
Roll20 Production Team
API Scripter
You could try this: !token-mod {{   -- flip     has_bright_light_vision     emits_bright_light     emits_low_light   --set     bright_light_distance|!20     low_light_distance|!20 }} I tend to prefer using a Roll Query to be prompted for the type of light: !token-mod ?{Light|None,--off has_bright_light_vision emits_bright_light emits_low_light --set bright_light_distance#0 low_light_distance#0|Torch,--on has_bright_light_vision emits_bright_light emits_low_light --set bright_light_distance#20 low_light_distance#20} I just typed that up to demonstrate, but you can add many, many different light options with that method.  Note that you replace the pipe for TokenMod arguments with a # so you don't have to escape it.
Ahh thank you so much Aaron! You're the man 😊
I had been playing around with night_vision_tint, but then I've of course been stung eventually by the subtractive light issue obscuring the map. I use token-mod to ensure consistent token settings, but can't see how to set it to transparent. To head off any "it defaults to it" comments, I need to confirm that players haven't set it differently in their vault to avoid the Roll20 bug. Thanks for your help with this one! (and happy new year to all)
1609542695
The Aaron
Roll20 Production Team
API Scripter
You can just use the word "transparent": token-mod --set night_vision_tint|transparent
Looking to run a macro for setting token image as below !token-mod --set imgsrc|<a href="https://s3.amazonaws.com/files.d20.io/images/189907702/FE-msNwgc5faHtxLThCYqQ/max.png?1609711437" rel="nofollow">https://s3.amazonaws.com/files.d20.io/images/189907702/FE-msNwgc5faHtxLThCYqQ/max.png?1609711437</a>} --ids @{selected|token_id} --set showname|no but then have a second macro to revert to default character token image.&nbsp; !token-mod --set imgsrc| @{selected|character_id} &nbsp; --set showname|yes What is the call for a selected tokens default token image? Thanks in advance.
This is with a token linked to a character of course.&nbsp; Like it to be setup generic so its just a matter of choosing token to revert to default character token image.
1609740323
The Aaron
Roll20 Production Team
API Scripter
Hmm. I don't believe character IDs are supported for setting the image source, but I'll look into adding it.&nbsp;
Great thanks.&nbsp;&nbsp;
I'm having an issue where I try to blind someone using a macro, but it ONLY blocks bright light. It does not block dim light. Makes for an odd effect for sure. Is there a way to do this or can I just change the field of vision to 0 degrees? I didn't see a command posted a while ago of how to change the field of vision in chat/macro.
1610327366
The Aaron
Roll20 Production Team
API Scripter
Can you post the command you're using?&nbsp; UDL is still a developing technology, sorry.
1610495181

Edited 1610496215
The Aaron said: Can you post the command you're using?&nbsp; UDL is still a developing technology, sorry. No reason to be sorry! I appreciate all the work! I've started learning how to do all this just to make the D&amp;D experience more streamlined and immersion focused. I used a lot of different variations of this to try to figure it out, but here is one: &nbsp;!token-mod {{ ?{Light|Torch, --on &nbsp;&nbsp;&nbsp;&nbsp;emits_bright_light &nbsp;&nbsp;&nbsp;&nbsp;emits_low_light --set &nbsp;&nbsp;&nbsp;&nbsp;bright_light_distance#20 &nbsp;&nbsp;&nbsp;&nbsp;low_light_distance#20| Muted Torch, --on &nbsp;&nbsp;&nbsp;&nbsp;emits_bright_light &nbsp;&nbsp;&nbsp;&nbsp;emits_low_light --set &nbsp;&nbsp;&nbsp;&nbsp;bright_light_distance#10 &nbsp;&nbsp;&nbsp;&nbsp;low_light_distance#10| Candle, --on &nbsp;&nbsp;&nbsp;&nbsp;emits_bright_light &nbsp;&nbsp;&nbsp;&nbsp;emits_low_light --set &nbsp;&nbsp;&nbsp;&nbsp;bright_light_distance#5 &nbsp;&nbsp;&nbsp;&nbsp;low_light_distance#5| Extinguish, --off &nbsp;&nbsp;&nbsp;&nbsp;emits_bright_light &nbsp;&nbsp;&nbsp;&nbsp;emits_low_light| Blind, --off &nbsp;&nbsp;&nbsp;has_bright_light_vision &nbsp;&nbsp;&nbsp;has_night_vision} }} -----I've also used, in conjunction with blind, light_hassight and has_low_light_vision but to no avail. I wasn't sure of the list of commands other than the ones you posted in page 16 of this thread: showname showplayers_name showplayers_bar1 showplayers_bar2 showplayers_bar3 showplayers_aura1 showplayers_aura2 playersedit_name playersedit_bar1 playersedit_bar2 playersedit_bar3 playersedit_aura1 playersedit_aura2 light_otherplayers light_hassight isdrawing flipv fliph aura1_square aura2_square has_bright_light_vision bright_vision has_night_vision night_vision emits_bright_light emits_bright emits_low_light emits_low
Using TokenMod to set the value for the Updated Dynamic Lighting. I am having trouble getting the directional lighting to work correctly for a Bullseye Lantern it is 60 foot bright and 60 foot dim. If I manually change the Token Properties it work, but it does not work with TokenMod. There are three settings listed for directional dim light, are this included in Token Mod? <a href="https://roll20.zendesk.com/hc/en-us/articles/360046490373-API-Support#directional-vision-and-lighting-0-2" rel="nofollow">https://roll20.zendesk.com/hc/en-us/articles/360046490373-API-Support#directional-vision-and-lighting-0-2</a> has_directional_dim_light directional_dim_light_center directional_dim_light_total Bob
1611095253
The Aaron
Roll20 Production Team
API Scripter
The _dim_ versions on that link are a lie.&nbsp; They only exist for bright light.&nbsp; Here's the command that should set those: !token-mod {{ --on has_directional_bright_light emits_low_light emits_bright_light has_bright_light_vision --set directional_bright_light_center|90 directional_bright_light_total|60 low_light_distance|25 }} But it breaks UDL.&nbsp; You can use that, and then just open and save the token and it will fix it.&nbsp; They tried to roll out a fix to that before Christmas, but it broke things and they rolled it back.&nbsp; Hopefully they'll get a fix for it sometime soon.
Hi The Aaron, first can I say I love your mods :D Second is there a way to append certain text after a tokens name using tokenmod? For example I am using tokennamenumber, and I would like to be able to add %%NUMBERED%% after the name so that the api will add incremental numbers after the name when multiple tokens are added to the map.
1611149424
The Aaron
Roll20 Production Team
API Scripter
Yup! !token-mod --set name|"@{selected|token_name} %%NUMBERED%%" You could use character_name instead if you'd rather &nbsp;
The Aaron said: Yup! !token-mod --set name|"@{selected|token_name} %%NUMBERED%%" You could use character_name instead if you'd rather &nbsp; Yeah, I have something like this as part of my monster setup macro. Set default token, change token name to Creature %%NUMBERED%%, set bar2 to npc_ac, set aura 2 to dark red (for emoting purposes).
1611175326
The Aaron
Roll20 Production Team
API Scripter
The Aaron said: The _dim_ versions on that link are a lie.&nbsp; They only exist for bright light.&nbsp; Here's the command that should set those: !token-mod {{ --on has_directional_bright_light emits_low_light emits_bright_light has_bright_light_vision --set directional_bright_light_center|90 directional_bright_light_total|60 low_light_distance|25 }} But it breaks UDL.&nbsp; You can use that, and then just open and save the token and it will fix it.&nbsp; They tried to roll out a fix to that before Christmas, but it broke things and they rolled it back.&nbsp; Hopefully they'll get a fix for it sometime soon. As it turns out, there are properties, but they are _low_ instead of _dim_.&nbsp; They're still broken in the same way, but you'll be able to set them when I next push out TokenMod.&nbsp; This will be the command: !token-mod {{ --on has_directional_bright_light has_directional_low_light emits_low_light emits_bright_light has_bright_light_vision --set directional_bright_light_center|90 directional_bright_light_total|60 directional_low_light_center|90 directional_low_light_total|60 low_light_distance|25 }}
Ok so my next thing is about setting dark vision distance - I can't get it to seem to work. This is my mess of a macro at the moment (I can probably clean it up) !token-mod {{ &nbsp; --on showname showplayers_name&nbsp;&nbsp; &nbsp; --off showplayers_bar2 showplayers_bar1&nbsp; showplayers_bar3 &nbsp; --on showplayers_aura1 showplayers_aura2 &nbsp; --set bar1_link|fortune bar2_link|toughness_bonus bar3_link|Wounds ?{Nightvision|No, --on has_bright_light_vision --off has_night_vision --set_night_vision_distance#0|Yes, --on has_night_vision --set_night_vision_distance#20 } ?{Light|None,--on has_bright_light_vision emits_bright_light emits_low_light --set bright_light_distance#0 low_light_distance#0|Torch,--on has_bright_light_vision emits_bright_light --set bright_light_distance#20 } ?{IsNPC|No, --set bar1_link|fortune bar2_link|toughness_bonus bar3_link|Wounds -off showplayers_bar2 showplayers_bar1&nbsp; showplayers_bar3|Yes, --set bar1_link|none bar2_link|none bar3_link|none } &nbsp; --set defaulttoken }}
1611234497
The Aaron
Roll20 Production Team
API Scripter
Looks like you have an extra _ here: --set_night_vision_distance#20 Should be: --set night_vision_distance#20 Haven't tried it, that's just what I spotted in my phone.
I'm having a hard time for some reason (Mostly due to limited understanding of macros most likely)&nbsp; Of getting a Roll Queries macro to work that lets my players resize their tokens.&nbsp; !token-mod --set width|25ft height|35ft But i'm having a hard time wrapping my head around it. :/&nbsp; Expesh when it comes to getting it so I can just put in the number and it auto adds the ft to it. Although i guess i could just have players put that in themselves worse case. Wish i could get it to scale and just change the height with that in mind.
1611269585
The Aaron
Roll20 Production Team
API Scripter
Try this: !token-mod --set scale|?{Size in feet}ft Scale is the same as setting height and width to the same thing. When you put a ?{a query} into a macro, it will get replaced by whatever you answer with, so the above, if you typed 25 would end up as: !token-mod --set scale|25ft
The Aaron said: Try this: !token-mod --set scale|?{Size in feet}ft Scale is the same as setting height and width to the same thing. When you put a ?{a query} into a macro, it will get replaced by whatever you answer with, so the above, if you typed 25 would end up as: !token-mod --set scale|25ft Thank you very much. Worked great ^__^ Been loving the Token mod btw. Use it all the time.&nbsp;
1611273275

Edited 1611273344
Hi The Aaron! So I'm still unsure how to macro a blind. How do I switch off the token from "has vision"? I've tried !token-mod {{ --off &nbsp;&nbsp; has_vision }} But it doesn't work. I've also tried !token-mod {{ --off &nbsp;&nbsp;&nbsp; has_bright_light_vision &nbsp;&nbsp;&nbsp; has_dim_light_vision }} But it only shuts off bright light, and I can still see dim light.
1611276466

Edited 1611276483
The Aaron
Roll20 Production Team
API Scripter
For UDL, this is a good way: !token-mod {{ --on has_limit_field_of_vision has_limit_field_of_night_vision --set limit_field_of_vision_total|0 limit_field_of_night_vision_total|0 }} For LDL, this works: !token-mod {{ --set light_losangle|0 }} The nice thing about this method (0º field of view) is that they are still bound by walls, and they can still see their token, they just can't see anything else.
The Aaron said: For UDL, this is a good way: !token-mod {{ --on has_limit_field_of_vision has_limit_field_of_night_vision --set limit_field_of_vision_total|0 limit_field_of_night_vision_total|0 }} For LDL, this works: !token-mod {{ --set light_losangle|0 }} The nice thing about this method (0º field of view) is that they are still bound by walls, and they can still see their token, they just can't see anything else. You're the man! Thanks!! :)
Hi&nbsp; The Aaron &nbsp; I apologize if you've already addressed this, but I'm new to Roll20 and have ben setting up my campaign on here so my players can enjoy this VTT instead of looking through the camera on my phone at my badly drawn maps and mini's. As I joined about a week and a half ago on one of my set up sessions I had an offer to update to "Updated Dynamic Lighting". Today I came across a video on YT showing your fantastic API script ( shameless creeping) . I've tried to run it on my campaign nut it's not working.&nbsp; Am I being a complete DULLARD or does it not work on the Updated Dynamic Lighting yet? I'm not getting any errors showing on the API scripts page&nbsp;
1611347148
The Aaron
Roll20 Production Team
API Scripter
It should work pretty well for UDL, but UDL is pretty new and there are some things that are still broken on Roll20's side.&nbsp; The settings for UDL are different than LDL, so if you've found some macros out on the web, they might be for LDL and need adjusting.&nbsp; If you want to post some commands you're trying to use, we can try and adjust them for UDL, if that's the problem.
Hello everyone, Sorry if this is a stupid question, but is it possible to set bar1, bar2 and bar3 to the values set in char sheet attributes but without linking them?
1611429770
The Aaron
Roll20 Production Team
API Scripter
You can certainly set them manually like: !token-mod {{ --set bar1_current|@{SomeChar|hp} bar1_max|@{SomeChar|hp|max} bar2_current|@{SomeChar|ac} bar3_current|@{SomeChar|speed} }}
Yeah, thanks, but is it possible to somehow get the charsheet name from represent character value instead of manually editing&nbsp; @{charname|hp} ? The Aaron said: You can certainly set them manually like: !token-mod {{ --set bar1_current|@{SomeChar|hp} bar1_max|@{SomeChar|hp|max} bar2_current|@{SomeChar|ac} bar3_current|@{SomeChar|speed} }}
1611430528

Edited 1611430555
The Aaron
Roll20 Production Team
API Scripter
This would work: !token-mod {{ --set bar1_current|@{selected|hp} bar1_max|@{selected|hp|max} bar2_current|@{selected|ac} bar3_current|@{selected|speed} }}
Oh my god! Thank you very much. I was so over complicating things. :) I was trying to do it like this: !token-mod {{ --set bar1_current|@{selected|character_name|hp} bar1_max|@{selected|character_name|hp|max} }} The Aaron said: This would work: !token-mod {{ --set bar1_current|@{selected|hp} bar1_max|@{selected|hp|max} bar2_current|@{selected|ac} bar3_current|@{selected|speed} }}
1611430971
The Aaron
Roll20 Production Team
API Scripter
No problem! Sometimes it's hard to see the forest for the trees, to be sure. =D
The Aaron said: It should work pretty well for UDL, but UDL is pretty new and there are some things that are still broken on Roll20's side.&nbsp; The settings for UDL are different than LDL, so if you've found some macros out on the web, they might be for LDL and need adjusting.&nbsp; If you want to post some commands you're trying to use, we can try and adjust them for UDL, if that's the problem. I got it to work by setting up the info on Legacy Lighting and avoiding the updated Dynamic Lighting for now
1611755413
The Aaron
Roll20 Production Team
API Scripter
I hate to say it, but that's probably the best approach for now.
I'm not able to get bar1_max|@{selected|hp|max} to work. Whenever I try it says "No attribute was found for @{selected|hp__max}" I'm trying to get an entire monster build into a macro, as !token-mod {{ &nbsp;&nbsp;&nbsp;&nbsp;--set &nbsp;&nbsp;&nbsp;&nbsp;bar1_link| &nbsp;&nbsp;&nbsp;&nbsp;bar2_link|npc_ac &nbsp;&nbsp;&nbsp;&nbsp;bar3_link| &nbsp;&nbsp;&nbsp;&nbsp;showname|yes &nbsp;&nbsp;&nbsp; bar1_value| &nbsp;&nbsp;&nbsp; bar1_max| &nbsp;&nbsp;&nbsp; bar2_value|@{selected|npc_ac} &nbsp;&nbsp;&nbsp;&nbsp;bar2_max|@{selected|npc_ac} &nbsp;&nbsp;&nbsp;&nbsp;bar3_value|@{selected|hp} &nbsp;&nbsp;&nbsp;&nbsp;bar3_max|@{selected|hp|max} &nbsp;&nbsp;&nbsp;&nbsp;showplayers_bar3 &nbsp;&nbsp;&nbsp;&nbsp;name|"@{selected|character_name} %%NUMBERED%%" &nbsp;&nbsp;&nbsp;&nbsp;token_name|"@{selected|character_name} %%NUMBERED%%" &nbsp;&nbsp;&nbsp;&nbsp;--set defaulttoken }}
1611983062
The Aaron
Roll20 Production Team
API Scripter
That's peculiar. Where does that message show up, in chat? &nbsp;Are you on the Dev server or production? What other scripts do you have installed? &nbsp;Also, what browser are you using?
1612010818

Edited 1612012702
The message shows up in chat. I'm about 90% sure I'm on the production server, as I've never actively tried to be on the Dev server. I have Token Name Number, Roll20 Audio Master, TokenMod, Group Initiative, Token Action Maker, StatusInfo, and Change Token Name. Based on you asking, I switched from Mozillia to Chrome and it works better, but still not perfect. I don't get the error message, but it also won't fill in the current HP. I don't want to roll for HP for each monster, just have the default HP set. I see that in Attributes there isn't anything filled in for HP on the character sheet where I would expect it to be, and I can't find an Attribute that lines up with it. I'm using the 5e Roll20 sheet. I was under the impression &nbsp;that linking hp for monsters is a bad thing because then if you change one monster’s hp (say from taking damage) then it would affect all of the tokens of that monster.&nbsp;
1612012894
The Aaron
Roll20 Production Team
API Scripter
Try taking the ! off the front and running it. Post a screenshot of the results.
I've solved the problem so far as I see it by changing both bar3_value and bar3_max to hp|max and it's doing what it's supposed to. I don't know if that will conflict or cause problems down the line but so far so good?
1612022779
The Aaron
Roll20 Production Team
API Scripter
I suppose as long as you got it working, then good enough!
I'm encountering a problem using @{selected}. If I highlight more than 1 token and attempt to execute my macro, it applies one token's information to all tokens. Is there a way to have a group selected and then have the tokenmod affect each token individually?
1612043642
The Aaron
Roll20 Production Team
API Scripter
There isn't currently, I'm afraid.&nbsp; It's on my list to figure out a way to do that, but hasn't gotten done yet.