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 - Turn on/off Lights for only a specific token, not the selected

Hey All, I'm a new user of the API, and am trying to use the !Token_mod Script in some Macros. One of my players, "T" has a sword that emits light when unsheathed. I'm trying to set up a macro that either Myself or T can use to change the dynamic light settings for ONLY T's token. The problem I Have is that when I use "!token-mod --set light_radius|40 light_dimradius|20" for example, it will change the light settings for whatever token is selected at the moment. is there a way to force the macro to always select T's token when changing the settings? I know there's the --ids | token id command, but I'm unsure how to use the syntax. Any help would be appreciated. Thanks in advance,
1612044047
The Aaron
Roll20 Production Team
API Scripter
No problem.  There are 2 ways to go about this: 1) Use the token ID with --ids and --igonore-selected !token-mod --set light_radius|40 light_dimradius|20 --ignore-selected --ids -Jasdf891234sf You would get the token's id with something like: /w gm Token ID is: @{selected|token_id} This is a bit tedious though, as the token_id is unique to that token, so as soon as you go to a different page, or even copy and paste it, you have a different id. 2) Use the character ID so that all tokens representing that character are changed: !token-mod --set light_radius|40 light_dimradius|20 --ignore-selected --ids @{T|character_id} That way, it doesn't matter which one of the tokens, you just change them all.  You can further refine that to only affect tokens for that character that are on the current page (--current-page), or only on pages with people on them (if you split the party) (--active-pages): !token-mod --set light_radius|40 light_dimradius|20 --ignore-selected --active-pages --ids @{T|character_id} That would be how I would do it.
1612045699

Edited 1612045745
Edit: haha The Scripteromancer wins again :) Probably the easiest method  I can think of is to use character name. In the example below you replace the word test with your players character name. Example: !token-mod  --ignore-selected  --ids @{test|character_id} --on light_hassight  light_otherplayers  --set  light_radius|40 light_dimradius|20 !token-mod  --ignore-selected  --ids @{test|character_id} --off light_hassight  light_otherplayers  --set  light_radius|0 light_dimradius|0