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.

1653488093
The Aaron
Roll20 Production Team
API Scripter
Lol. no problem.  Sorry for the confusion, I was thinking of the emits_bright_light/emits_low_light pair.  I think what you're hitting is actually the UDL API bug that Roll20 has yet to fix.  This is a good test case, and I'll pass it on to the devs.
I have been using Roll20 as a player for about a year and a half but am just now DMing my first long-term using the platform. I am looking for useful macros that will help me stay organized. These are some of the things I am looking for. I will also add that I have been going through forums and tutorial videos for the better part of a week. I have gotten so close with building some but I am getting frustrated! 1. I saw a video demonstrating the ability to use a "set-status" macro that gives you a pop-up window with all the statuses listed alphabetically by name. And then a "clear staus" macro that would remove all token markers assigned to a particular token. I got the pop-up window with the statuses to appear but when I select one it does not apply the status token. 2. Looking for a macro that allows me to roll checks/saves for all my monsters at once against AOE or other effects that will target multiple monsters at once. 3. Looking for a macro that will roll initiative for all my monsters at once. I'm just not sure exactly where to go to find these solutions.
1653754563
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Hi DSpence! Here are my suggestions: 1 If you post the macro you are using, we might be able to figure out the issue. There are a couple of possibilities, but it's good not to go down into unneeded rabbit holes. 2. The Script Group Check (One Click), and it's helper script Apply Damage (Apply Damage). The newer script SmartAOE (discussed here , but install from One Click) does an amazing job, but requires a bit steeper learning curve and prep time. 3. GroupInitative (One Click) is the king of this.
1653765085

Edited 1653765606
DSpence said: I have been using Roll20 as a player for about a year and a half but am just now DMing my first long-term using the platform. I am looking for useful macros that will help me stay organized. These are some of the things I am looking for. I will also add that I have been going through forums and tutorial videos for the better part of a week. I have gotten so close with building some but I am getting frustrated! 1. I saw a video demonstrating the ability to use a "set-status" macro that gives you a pop-up window with all the statuses listed alphabetically by name. And then a "clear staus" macro that would remove all token markers assigned to a particular token. I got the pop-up window with the statuses to appear but when I select one it does not apply the status token. 2. Looking for a macro that allows me to roll checks/saves for all my monsters at once against AOE or other effects that will target multiple monsters at once. 3. Looking for a macro that will roll initiative for all my monsters at once. I'm just not sure exactly where to go to find these solutions. Hi Spence, maybe it's even my video?! I have a macro to set the status (standard status icons) working as you describe: !token-mod {{ --set statusmarkers|?{Status| Blessed,!chained-heart| Burning,!chemical-bolt| Charmed,!broken-heart| Concentrating,!stopwatch| Dodging,!strong| Exhaustion,radioactive:+1| Grappled,!grab| Incapacitated,!sleepy| Invisible,!ninja-mask| Fly,!fluffy-wing| Frightened,!screaming| Hasted,!tread| Paralyzed,!interdiction| Petrifyed,!frozen-orb| Poisoned,!drink-me| Prone,!back-pain| Protected,!white-tower| Raged,!fist| Restrained,!padlock| Shield,!bolt-shield| Sleeping,!sleepy| Slowed,!snail| Stunned,!interdiction| Unconcious,!broken-skull| Webbed,!cobweb} }} And the corresponding macro to delete all status: !token-mod --set statusmarkers|=red|-red And as Keith suggested, I am also using the Group Check macro for bulk saves. But this is problematic for high level monsters because of the resistances they have. Great for multiple low-level minions. I am using it clad in this macro: !group-check {{ --?{Attribute|Dexterity|Constitution|Wisdom} Save --process --subheader vs DC ?{DC} --button ApplyDamage !apply-damage ~dmg [[?{Damage}]] ~type ?{Damage on Save|Half,half|None,none} ~DC ?{DC} ~bar 2 ~saves RESULTS(,) ~ids IDS(,) }} (not completely self-explaining :-) ) And to roll multiple initiatives I am using the VTT Enhancement suite available here: <a href="https://discord.com/channels/495906673446092800/495907770844053514" rel="nofollow">https://discord.com/channels/495906673446092800/495907770844053514</a> This enables you to roll ANY macro on multiple tokens. And what is also great: you can simply roll HP for multiple NPCs if you don't want to have all zombies in your game with 22hp ;-) There are many nice functions there. I scratched up a little video on what I am using:&nbsp;<a href="https://youtu.be/Sj_heOcBbKQ?list=PLzs3ADFT29RmxvO5S3YSTmG9NsEuZskIx" rel="nofollow">https://youtu.be/Sj_heOcBbKQ?list=PLzs3ADFT29RmxvO5S3YSTmG9NsEuZskIx</a>. Hope that helps.
1653765515
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Another possibility for dealing with modifying damage after it has been dealt (for the resistances example above) is Auto Buttons . Super handy for resistances and vulnerabilities.
1653786285

Edited 1653789698
Trying to create a script for a token action that allows the player to choose the side of the token and also input the new name of the token for characters with two personas and similar situations. So far, I have: !token-mod {{ --set name|?{New Name?|Noa} currentside|+ }} /fx glow-magic @{selected|token_id} The name change works without error. The /fx works fantastically. But the currenside functions don't seem to work and there is no error output. I have also tried using a query, or making different macros for different sides... but the currentisde functions don't seem to work. I've tried in both firefox and chrome, same exact (lack of) output. Is there some reason the currentside functions wouldn't be working? Am I missing something? Figured it out, see below!
1653788373

Edited 1653788404
Kraynic
Pro
Sheet Author
Grendell said: The name change works without error. The /fx works fantastically. But the currenside functions don't seem to work and there is no error output. The images you are using for the token... are they in your art library, or are they from the marketplace? The api can't interact with marketplace images, so if they are, you need to import them into your art library to be able to manipulate them with TokenMod.&nbsp;
1653789640

Edited 1653789833
I figured it out...! Edit: This is for a character with two personas, Noa and Pip, but would work great for any character with two forms! Made a rollable table with two entries, Noa (side 1) and Pip (side 2). Put the images in my library, dragged the images from my library to the rollable table, brought out a new token from the table, and then used the following script, works like a charm: !token-mod {{ --set ?{Choose Form|Noa,currentside#1 name#Noa |Pip,currentside#2 name#Pip } }} /fx burst-magic @{selected|token_id}
Here's an easy one. How can you set a minimum value to a change? I'd like to specify a particular minimum value for a change to a bar value: !token-mod --sel --set bar2_value|-1 Where bar2_value would be bounded to a minimum of 2. Thanks for your help!
1654363685
The Aaron
Roll20 Production Team
API Scripter
Probably by just specifying it as part of a formula with a group, something like: !token-mod --sel --set bar2_value|=[[{@{selected|bar2_value}-1,2}kh]]
1654363740
The Aaron
Roll20 Production Team
API Scripter
There's probably a Tim's Meta Magic Script method of expanding this to a whole group of selected tokens.&nbsp;
Thanks! I do use ScriptCards for this, how would that work? Use a variable? --=Bar2Mod|[*T:t-bar2_value]-1 {MIN:2} --@token-mod|&nbsp;_ignore-selected _ids @{selected|token_id} _set bar2_value|[$Bar2Mod] Would that do it? I guess the same to establish a maximum value. I don't want to actually use the attribute's max value as it's being used for something else. I don't include an "=" sign if I want to simply replace the value correct? Thanks again. (and apologies for throwing scriptcards syntax at you) (for context I'm using token-mod add/remove a shield and to inc/reduce a characters AC by 1 or more (if the shield is magic; to a max of 10) and Armor Type rating by 1 to a minimum of 2 (max 10). This is 1e AD&amp;D.)
1654370647
The Aaron
Roll20 Production Team
API Scripter
I really have no idea. =D I just know it should be possible.&nbsp;
It works! Gracias. One more thing, I'm trying to reset a token's AC to a negative number but the minus sign keeps subtracting from the current value. How would I replace a positive value with a negative one? (do I need quotes?) Thanks
1654396386
The Aaron
Roll20 Production Team
API Scripter
To assign a negative number, preface it with an =: !token-mod --set bar3_value|=-2
1654883127
timmaugh
Pro
API Scripter
David M. said: Thanks! I do use ScriptCards for this, how would that work? Use a variable? --=Bar2Mod|[*T:t-bar2_value]-1 {MIN:2} --@token-mod|&nbsp;_ignore-selected _ids @{selected|token_id} _set bar2_value|[$Bar2Mod] Would that do it? I guess the same to establish a maximum value. I don't want to actually use the attribute's max value as it's being used for something else. I don't include an "=" sign if I want to simply replace the value correct? Thanks again. (and apologies for throwing scriptcards syntax at you) (for context I'm using token-mod add/remove a shield and to inc/reduce a characters AC by 1 or more (if the shield is magic; to a max of 10) and Armor Type rating by 1 to a minimum of 2 (max 10). This is 1e AD&amp;D.) Sorry... just saw this. To apply this over a mess of tokens at once, you'd want SelectManager, Fetch, and ZeroFrame. Then your @token-mod line can become: --@forselected| token-mod&nbsp;_set bar2_value|at(selected.bar2mod) That at(selected.bar2mod) is a guess at what might be behind your [$Bar2Mod] SC variable. If every token/character had a bar2mod attribute, this (the above) is how you could reference it. The above line would execute the token-mod command once for each token, feeding each token's bar2mod attribute to the command line.
So I know we have !token-mod --set defaulttoken But do we have a way to remove the default token for a sheet?
Another random thought I had, is it possible to look up the character size from the pathfinder community sheet, and set the token size based off that value?
David B. said: Another random thought I had, is it possible to look up the character size from the pathfinder community sheet, and set the token size based off that value? Yes and no.&nbsp; The problem is that Tokenmod will deal with token inputs/ manipulations, ChatSetAttr deals with Character Sheet inputs/ manipulations.&nbsp; They'll be two separate calls and loaded variables.&nbsp; There is no way to actually automate the process. You could, however, macro it, but you'd have to convert the sizing from PF to sizing for the token.&nbsp; For that you'd need a drop down query sent to Tokenmod
1655007150
The Aaron
Roll20 Production Team
API Scripter
David B. said: Another random thought I had, is it possible to look up the character size from the pathfinder community sheet, and set the token size based off that value? I bet this could be done with some of Tim's meta scripts.&nbsp;
1655077494
timmaugh
Pro
API Scripter
I mean... it might be easier than that... you can retrieve a value from a sheet with an @{selected|theThingIWantToKnow}... no need for CSA . After that it's math turtles all the way down to get the token size you want to feed to TokenMod . For a single token, provided you could do the math in an inline roll, you wouldn't even have to involve metascripts. On the other hand, if you couldn't do the math in an inline roll, you could use the MathOps metascript to output a number. And if you had more than a single token you wanted to resize in this way, it would take SelectManager , Fetch , and ZeroFrame , as I just demonstrated, above. You'd select all the tokens you want to change, then issue a command that started: !forselected(^) token-mod... ...and then, along the way, you'd replace that Roll20 construct of @{selected|theThingIWantToKnow} ...with the Fetch construction (delayed by SelectManager's declared deferral character: ^): @^(selected.theThingIWantToKnow) That will mean that a unique, individual value will be retrieved for each token you are resizing, according to what is on their character sheet. That's about the closest I can get without understanding the Pathfinder sheet values for the size of a token, and what kind of math would be involved in setting the token size. If you could provide that, I could give you a more complete command line to try.
Normally you are going to see Tiny, Small, Medium, Large, Huge, Gargantuan. Medium is normally 1 square, small is 0.5, large is 2x2, Huge is 3x3, and Gargantuan is 4x4
Hello, The script doesn't appear anymore in the one-click drop-down menu, at least for me....
1655390360
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
David B. said: Normally you are going to see Tiny, Small, Medium, Large, Huge, Gargantuan. Medium is normally 1 square, small is 0.5, large is 2x2, Huge is 3x3, and Gargantuan is 4x4 If the sheet uses words instead of numerical values, you will probably need a specialized scriptlet to make the translation.
1655390461
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
sebastien g. said: Hello, The script doesn't appear anymore in the one-click drop-down menu, at least for me.... Token-mod? or one of the other scripts in the recent discussion? If token mod (or any script you expect to see) is not appearing in the drop down, double check to make sure it isn't already installed. Be sure to check the disabled script names as well.
My bad it was already installed with another billions others API..... Thx keith keithcurtis said: sebastien g. said: Hello, The script doesn't appear anymore in the one-click drop-down menu, at least for me.... Token-mod? or one of the other scripts in the recent discussion? If token mod (or any script you expect to see) is not appearing in the drop down, double check to make sure it isn't already installed. Be sure to check the disabled script names as well.
1655429348
timmaugh
Pro
API Scripter
keithcurtis said: David B. said: Normally you are going to see Tiny, Small, Medium, Large, Huge, Gargantuan. Medium is normally 1 square, small is 0.5, large is 2x2, Huge is 3x3, and Gargantuan is 4x4 If the sheet uses words instead of numerical values, you will probably need a specialized scriptlet to make the translation. Muler will do it. =D I just need a minute to tinker.
1655489146
timmaugh
Pro
API Scripter
Managing PathFinder Sizes with TokenMod and Metascripts David B. said: Normally you are going to see Tiny, Small, Medium, Large, Huge, Gargantuan. Medium is normally 1 square, small is 0.5, large is 2x2, Huge is 3x3, and Gargantuan is 4x4 OK, using that information, you can accomplish it with Muler (with or without ZeroFrame). Muler will store the translation of the character size attribute into a number and allow you to retrieve it into your TokenMod command line. You can store the result of the math (the actual pixel size) if you don't want to use ZeroFrame, or store just the multiplier if you want to resolve the final pixel size in an inline roll. OPTION 1 (WITH ZeroFrame)... !token-mod --set height|[\][\]70 * get.TableMule.PathFinderSizes.@{selected|character_size}/get\]\] width|[\][\]70 * get.TableMule.PathFinderSizes.@{selected|character_size}/get\]\]{&amp;mule TableMule.PathFinderSizes} This assumes that the page grid size is 70, and it assumes that the attribute you want from the character is called character_size . Change those values as necessary. To use this, you'll need this setup: 1) Establish/create a character for storing Muler tables (abilities that follow a particular format). I used a character called "TableMule". If you use a different name, replace the occurrences of "TableMule" (above) with the name of your character. Make sure that anyone who would run the TokenMod command has control rights to this character. 2) On this character, create an ability where you'll store the translation of sizes into multipliers. This ability will be your "mule". I called my ability "PathFinderSizes". Again, if you use a different name, make the appropriate replacements, above. 3) Enter the following data into the ability: Tiny=.25 Small=.5 Medium=1 Large=2 Huge=3 Gargantuan=4 Make sure that these names match the options on the PathFinder sheet (including capitalization). OPTION 2 (WITH ZeroFrame) Another option with ZeroFrame would leave the inline roll verbiage in the mule. This option makes the inline rolls easier to spot since you don't have to defer the rolls because they are stored in the mule (see the mule verbiage, below). The command to use would be: !token-mod --set height|get.TableMule.PathFinderSizes.@{selected|character_size}/get width|get.TableMule.PathFinderSizes.@{selected|character_size}/get{&amp;mule TableMule.PathFinderSizes} Your setup would be identical, except that your mule would now look like this: Tiny=[[.25 * 70]] Small=.[[5 * 70]] Medium=[[1 * 70]] Large=[[2 * 70]] Huge=[[3 * 70]] Gargantuan=[[4 * 70]] This option is attractive in that it preserves the scaling factor in the data, allowing you to see how each size increment relates to the next. It also would allow you to change the page value (70) if that became necessary. OPTION 3 (WITHOUT ZeroFrame) If you don't want to use ZeroFrame, you can change the data you store in the mule to be the result of your page scale (default is 70) multiplied by thescale factor (x2, x3, x4, etc.). In other words, using the same command as Option 2 : !token-mod --set height|get.TableMule.PathFinderSizes.@{selected|character_size}/get width|get.TableMule.PathFinderSizes.@{selected|character_size}/get{&amp;mule TableMule.PathFinderSizes} ...except that your mule would store actual values: Tiny=17.5 Small=35 Medium=70 Large=140 Huge=210 Gargantuan=280 BONUS: Extend this with SelectManager &amp; Fetch The above command lines are setup to affect 1 token at a time. Though TokenMod can affect many tokens at once, the resolution of the @{selected|character_size} attribute call will populate with the value of the first selected token, and all the tokens you have selected will get set with that value. To get differentiated values for each individual token, install SelectManager and Fetch , and alter your command line slightly. In each option, nothing would change about your mule or how you store your data. The only change would be the command line. The following versions will work with a single token selected, or with many tokens selected. OPTION 1 (Extended) !forselected(^) token-mod --set height|[\][\]70 * get^.TableMule.PathFinderSizes.@^(selected.character_size)/^get\]\] width|[\][\]70 * get^.TableMule.PathFinderSizes.@^(selected.character_size)/^get\]\]{^&amp;mule TableMule.PathFinderSizes} OPTION 2 &amp; 3 (Extended) !forselected(^) token-mod --set height|get^.TableMule.PathFinderSizes.@^(selected.character_size)/^get width|get^.TableMule.PathFinderSizes.@^(selected|character_size)/^get{^&amp;mule TableMule.PathFinderSizes}
1656867476

Edited 1656867696
Hi, idk if this macro is still good to use - it's been 2 yrs since i played and idk if there is anything outdated or improved on. NPC !token-mod {{ --set bar1_value|@{selected|hp|max} bar1_max|@{selected|hp|max} bar2_link|npc_speed bar3_link|npc_ac --set light_angle|360 --set light_losangle|120 --set light_radius|0 --set light_dimradius|0 name|"@{selected|character_name} %%NUMBERED%%"}} --off showname --off showplayers_name --off showplayers_bar1 --off showplayers_bar2 --off showplayers_bar3 --off showplayers_aura1 --off showplayers_aura2 --off light_hassight --off light_otherplayers --ids @{selected|character_id}}} !token-mod --set bar1_link| bar2_link| bar3_link| !token-mod --set defaulttoken !ta attacks spells saves checks reactions traits /w gm @{selected|character_name} has been set up as a Mook for PC !token-mod {{ --set bar1_value|@{selected|hp|max} --set bar1_max|@{selected|hp|max} --set bar2_link|ac --set bar3_link|passive_wisdom --on showname --off showplayers_bar1 --off showplayers_bar2 --off showplayers_aura1 --off showplayers_aura2 --set defaulttoken }} Lastly - I recall there was always an issue to handle Passive Perception - has ROLL20 fixed this issue, where we can trigger passive perception for other apis / macros / calls???? Cause I would love to utilize players passive Perception to auto finds things when they move around the map.
1656873042
The Aaron
Roll20 Production Team
API Scripter
For the TokenMod commands, the only thing you might need to revisit is the light and vision settings.&nbsp; Here's a post with all the UDL stuff explained for TokenMod:&nbsp; <a href="https://app.roll20.net/forum/post/4225825/script-update-tokenmod-an-interface-to-adjusting-properties-of-a-token-from-a-macro-or-the-chat-area/?pageforid=9064542#post-9064542" rel="nofollow">https://app.roll20.net/forum/post/4225825/script-update-tokenmod-an-interface-to-adjusting-properties-of-a-token-from-a-macro-or-the-chat-area/?pageforid=9064542#post-9064542</a> For the Automated Passive Perception, that would be really cool, but is caveated on some tedious things: "Where can the character see from where they are?"&nbsp; There is no built in facility to answer that question.&nbsp; To get there you'd need to build your own ray casting vision system (which I totally want to do) which respects DL Walls.&nbsp; "What is there to see?"&nbsp; You'd need to seed the map with things that can be seen, annotated for how difficult they are to see, and how far they can be seen from.&nbsp; You'd likely want to change the chances of success based on distance.&nbsp; you might even need to determine limited locations where things can be seen from (say, a rune on the back of a chair). "What vision do they have?" You'd also need to factor in the range between viewer and viewed and apply whatever sight capabilities each have.&nbsp; See invisible 10ft radius?&nbsp; Darkvision 60ft radius?&nbsp; You might need to flag some things as only visible to some sight types, obviously (invisible, ethereal, etc), or maybe a sight type prevents you from seeing it (can't see color with darkvision, can't perceive light with devil's sight, etc). "Does the difficulty change outside movement?"&nbsp; Maybe when someone brings light nearer, you can see better.&nbsp; Maybe there is a cycle to things, vibrates every 3 rounds.&nbsp; Maybe it's a creature and they do something to change their stealth role, etc. Complicated.&nbsp; I'd love to tackle it sometime when I have time. In the meantime, It's a Trap is probably your best bet for automating behavior based on location.
for light and vision - I have this. Are they still valid? !token-mod {{?{What Type of Vision - DIM/BRIGHT| None/Blind, --set aura1_radius#0 --set aura2_radius#0 | Candle 10ft, --set aura1_radius#10 --set aura2_radius#10 | Misc 15ft, --set aura1_radius#15 --set aura2_radius#15 | Misc 20ft, --set aura1_radius#20 --set aura2_radius#20 | Misc 25ft, --set aura1_radius#25 --set aura2_radius#25 | Misc 30ft, --set aura1_radius#30 --set aura2_radius#30 | Lamp Covered 35ft, --set aura1_radius#35 --set aura2_radius#35| Torch Light 40ft, --set aura1_radius#40 --set aura2_radius#40 | Lamp 45ft, --set aura1_radius#45 --set aura2_radius#45 | Hooded Lamp 60ft, --set aura1_radius#60 --set aura2_radius#60 |}}} and !token-mod {{?{What Type of Vision - DIM/BRIGHT |None/Blind, --set has_bright_light_vision#no emits_bright_light#no bright_light_distance#0 has low_light_vision#no emits_low_light#no low_light_distance#0 has_night_vision#no has night_vision_distance#0 night_vision_tint #transparent |Candle 5/5, --set has_bright_light_vision#yes emits_bright_light#yes bright_light_distance#5 has low_light_vision#yes emits_low_light#yes low_light_distance#5 has_night_vision#no night_vision_tint #transparent |Torch Light 20/20, --set has_bright_light_vision#yes emits_bright_light#yes bright_light_distance#20 has low_light_vision#yes emits_low_light#yes low_light_distance#20 has_night_vision#no night_vision_tint #transparent |Lamp 30/15, --set has_bright_light_vision#yes emits_bright_light#yes bright_light_distance#30 has low_light_vision#yes emits_low_light#yes low_light_distance#15 has_night_vision#no night_vision_tint #transparent |Hooded Lamp 30/30, --set has_bright_light_vision#yes emits_bright_light#yes bright_light_distance#30 has low_light_vision#yes emits_low_light#yes low_light_distance#30 has_night_vision#no night_vision_tint #transparent |Covered Hooded Lamp 30/5, --set has_bright_light_vision#yes emits_bright_light#yes bright_light_distance#30 has low_light_vision#yes emits_low_light#yes low_light_distance#5 has_night_vision#no night_vision_tint #transparent |Day Open 60/60, --set has_bright_light_vision#yes emits_bright_light#yes bright_light_distance#60 has low_light_vision#yes emits_low_light#yes low_light_distance#60 has_night_vision#no night_vision_tint #transparent |Day Woods 30/30, --set has_bright_light_vision#yes emits_bright_light#yes bright_light_distance#30 has low_light_vision#yes emits_low_light#yes low_light_distance#30 has_night_vision#no night_vision_tint #transparent |Day Forest 15/15, --set has_bright_light_vision#yes emits_bright_light#yes bright_light_distance#15 has low_light_vision#yes emits_low_light#yes low_light_distance#15 has_night_vision#no night_vision_tint #transparent |DV Open 0/60, --set has_bright_light_vision#no emits_bright_light#no bright_light_distance#00 has low_light_vision#no emits_low_light#no low_light_distance#00 has_night_vision#yes night_vision_distance#60 night_vision_tint#000000 |DV Woods 0/30, --set has_bright_light_vision#no emits_bright_light#no bright_light_distance#00 has low_light_vision#no emits_low_light#no low_light_distance#00 has_night_vision#yes night_vision_distance#30 night_vision_tint#000000 |DV Forest 0/15, --set has_bright_light_vision#no emits_bright_light#no bright_light_distance#00 has low_light_vision#no emits_low_light#no low_light_distance#05 has_night_vision#yes night_vision_distance#15 night_vision_tint#000000 |Cavern 25/25, --set has_bright_light_vision#yes emits_bright_light#yes bright_light_distance#25 has low_light_vision#yes emits_low_light#yes low_light_distance#25 has_night_vision#no night_vision_tint #transparent |Dungeon 20/20, --set has_bright_light_vision#yes emits_bright_light#yes bright_light_distance#20 has low_light_vision#yes emits_low_light#yes low_light_distance#20 has_night_vision#no night_vision_tint #transparent |Custom 10/10, --set has_bright_light_vision#yes emits_bright_light#yes bright_light_distance#10 has low_light_vision#yes emits_low_light#yes low_light_distance#10 has_night_vision#no night_vision_tint #transparent|}}}
1656901816
The Aaron
Roll20 Production Team
API Scripter
That first macro just sets auras, but I assume you know that.&nbsp; The second one looks like it should be right for UDL.
Question, I'm trying to figure out how to use Token Mod to set the status markers on tokens, but the command I want to create is from an API.&nbsp; So I am trying to figure out how to call token mod (or other APIs) with Select Manager.&nbsp; Does anyone have an example of calling token-mod with select manager (and the characters name) to set a status marker (or really anything else).&nbsp; Meta scripts confuse me LOL
1657035066
The Aaron
Roll20 Production Team
API Scripter
That's actually pretty close to the SelectManager example in the wiki:&nbsp; <a href="https://wiki.roll20.net/Script:SelectManager#Example" rel="nofollow">https://wiki.roll20.net/Script:SelectManager#Example</a> Something like this, I think: !forselected(^) token-mod --set statusmarkers|+flying-taco:3 --ids @^(selected.token_id)
1657042998

Edited 1657043597
Well that's the first time I have ever been able to make this work LOL.&nbsp; Instead of !forselected is there a way to say select &lt;Name&gt; along with this?&nbsp; In the API I have I know the character/token name or can get the ID's and I'd like the macro button I'm creating to select the token first then set a status icon.&nbsp; I'm trying to do something like this (to inject or select a token on the VTT) !forselected(^) {&amp; inject -N0wEOJ2iAV_D4HbZLSZ} token-mod --set statusmarkers|+aura:3 --ids @^(selected.token_id) The Aaron said: That's actually pretty close to the SelectManager example in the wiki:&nbsp; <a href="https://wiki.roll20.net/Script:SelectManager#Example" rel="nofollow">https://wiki.roll20.net/Script:SelectManager#Example</a> Something like this, I think: !forselected(^) token-mod --set statusmarkers|+flying-taco:3 --ids @^(selected.token_id)
1657048783
timmaugh
Pro
API Scripter
Darryn said: Well that's the first time I have ever been able to make this work LOL.&nbsp; Instead of !forselected is there a way to say select &lt;Name&gt; along with this?&nbsp; In the API I have I know the character/token name or can get the ID's and I'd like the macro button I'm creating to select the token first then set a status icon.&nbsp; I'm trying to do something like this (to inject or select a token on the VTT) !forselected(^) {&amp; inject -N0wEOJ2iAV_D4HbZLSZ} token-mod --set statusmarkers|+aura:3 --ids @^(selected.token_id) You can do that, sure. Each of the meta structures has a different purpose, so it's just a matter of what you want/need to do. forselected - lets you run a command individually over a set of tokens (^) - a deferral character lets you break up syntax structures (combinations of characters) so they aren't detected until the API receives the individual commands {&amp; inject ...} - adds a token to the set of already selected tokens (as opposed to {&amp; select ... } which replaces the set of selected tokens with those you designate) @(selected.token_id) - a Fetch construction to get the token ID during the meta processing; the usage, above, is interrupted by the deferral character So, what do you need? If you are only going to deal with one character/token, you won't need the forselected portion of SelectManager. Then again, if you're going to just be working with a single token, you won't even need the {&amp;inject} statement, since TokenMod has an --ids &nbsp;argument, and you could just supply the token, there. On the other hand, using forselected and {&amp;inject} together means that you will be acting over a number of tokens, but before you begin iterating over the set of selected tokens, you want to make sure certain tokens are included (the set you are injecting). You might have some tokens selected on the tabletop, and you are OK affecting them as well as those you inject. The command you showed, above, looks like it should work. Did you run into a problem? If you can't get it to behave the way you want, if you share a little more detail of just what you're trying to do I might be able to help steer you in the right direction. A Note on Timing (shortening your command line) By default, TokenMod will act on the tokens you have selected (unless you include the --ids argument). Using the --ids argument can be a way to designate the tokens to act on even if you don't have them selected on the game board. For your purposes, however, that shouldn't matter: {&amp;inject...} will run at meta-speed, meaning it will have already run by the time TM gets the message. By the time TM "sees" the set of selected tokens in the message, the newly injected tokens will already be there. In fact, forselected operates like a "normal" script, acting at normal speed. So {&amp;inject} will already have done its work by the time forselected comes along. Effectively, there will simply be more tokens to iterate over. Also, even though forselected is a "normal" script, because the message begins !forselected and not !token-mod , it will run before TokenMod, dispatching each iterative TM call and providing those messages with a single selected token. For all of these reasons, by whatever combination of {&amp;inject...} , forselected , and TokenMod you use, you shouldn't have to use the --ids argument of TokenMod... the tokens will already be there by the time TM sees the message.
1657071232

Edited 1657071286
Well, going to have to digest all that Tim LOL.&nbsp; I did try that command and nothing happened earlier, but now it did work they way I wanted it.&nbsp; I really am just wanting it to affect a single token.&nbsp; I've been reading through the docs on Select Manager and have not been able to figure out how to do that, but I think (based on what you said) that I can change the inject to select, but when I do that tells me nothing is selected. !forselected(^) {&amp; select -N0wEOJ2iAV_D4HbZLSZ} token-mod --set statusmarkers|+aura:3 --ids @^(selected.token_id)
1657117384
timmaugh
Pro
API Scripter
I should really put a couple of videos together on using the metascripts. =D The message you're getting is coming from Fetch, which is telling you that there isn't anything selected from which to get the token_id. I'm going to take a wild guess and say that you DON'T have ZeroFrame installed... just SelectManager and Fetch... and that Fetch is installed before SelectManager. Am I right? If so, here's what's going on: scripts queue up in the order they get processed as your sandbox goes into its "ready" state. Metascripts shin-kick their way to the head of that queue so that they get processed before standard scripts, but they are still in their own queue. In other words, if Fetch is installed before SelectManager, they will both register before standard scripts, but Fetch will register first, and it will be processed first. So when your message comes through, first Fetch tries to pull the token_id from the selected token (there isn't one)... and then later SelectManager adds the specified token to the set of selected. Kinda backwards. To solve that, ZeroFrame creates its own registry of the metascripts you have installed. It basically says: "I will register before all of the standard scripts, and all of metascript peeps can register with me. Then I will control which of them runs in what order." Every one of the other metascripts have a "priority" with which they register to ZeroFrame...&nbsp; 99% of the time, you're going to want SelectManager to run before any of the other metascripts, so it has a higher priority than Fetch. No matter what order SM and Fetch are installed, with ZeroFrame also installed SM will default to run before Fetch (this can be changed with ZeroFrame, but that's beyond the scope of what you need to do). Just by installing ZeroFrame, you'll fix the message you're getting, above. (Or you can reorder your metascripts by uninstalling Fetch and installing it again -- effectively installing it after SelectManager.) Now, back to what you're trying to do... If you are only trying to modify one token, TokenMod's --ids argument will do what you need it to do (without selecting the token and without any metascripts): !token-mod --set statusmarkers|+aura:3 --ids -N0wEOJ2iAV_D4HbZLSZ The {&amp;select...} verbiage can really help for a script that doesn't have the ability to designate a token in the command line this way, but it can be used in place of the --ids argument for TokenMod. It does not require the forselected handle at the beginning of the line; it will work on its own. The following is functionally the same as the previous command: !token-mod --set statusmarkers|+aura:3 {&amp; select -N0wEOJ2iAV_D4HbZLSZ} Tangent of Use: There are reasons you might want to use the latter formulation... for instance if you have a list of characters and/or party sub-divisions that you would want to quickly access without having to find them on the gameboard. By putting them in a roll query (processed before metascripts), you can effectively choose from that list which characters to affect with your TokenMod command: {&amp; select ?{Who|Dingus|Modus|Dingus and Modus,Dingus&amp;comma; Modus} By the time SelectManager sees the command line, it will see one of the following: {&amp; select Dingus} {&amp; select Modus} {&amp; select Dingus, Modus} If you don't use the --ids argument of TokenMod, the script will affect the selected tokens; it will just affect them all the same. In this case, no matter which of the 3 options get returned from your roll query, you will effectively be replacing the set of selected tokens on the gameboard with the response you provide... and *those* are the tokens TokenMod will affect. Tangent of Tangent of Use: Now you get into a realm where you might want to use forselected ... if you have to set individual information for each token. The forselected handle can be used independently of {&amp;select...} . Without the {&amp;select...} statement, forselected will just iterate over the tokens you have selected on the game board. If you have to set the aura marker value to increment by a separate value for each token, you might need to pull that from the token/character. In that case, you'd use forselected to separate/iterate every call, and then a Fetch construction to get the increment value (maybe that's called "fatigue"): !forselected(^) token-mod --set statusmarkers|+aura:+@^(selected.fatigue) That will use the tokens selected at the time the command is run, and increment their aura status marker by the value of their fatigue attribute. Taking a step further, you can use the {&amp;select... statement, and control which of them are affected: !forselected(^) token-mod --set statusmarkers|+aura:+@^(selected.fatigue)&nbsp;{&amp; select ?{Who|Dingus|Modus|Dingus and Modus,Dingus&amp;comma; Modus} Now, no matter if you just choose one token or multiple, you'll get the right value to process, and everyone will have the appropriately incremented status marker.
Aaron - the code I posted few post backs seems to be not working.&nbsp; Aura isnt being applied nor light/vision is being applied.&nbsp;
Update - Learned BUMP doesnt work with TokenMod if the token is in the GM Layer. So the Macros work, got that fixed now but still having issue on part of the code: Everything is working except for this one. The Map setting is full daylight, but the character vision is all blacked out. |DV Open 0/60, --set has_bright_light_vision#no emits_bright_light#no bright_light_distance#00 has low_light_vision#no emits_low_light#no low_light_distance#00 has_night_vision#yes night_vision_distance#60 night_vision_tint#000000 |DV Woods 0/30, --set has_bright_light_vision#no emits_bright_light#no bright_light_distance#00 has low_light_vision#no emits_low_light#no low_light_distance#00 has_night_vision#yes night_vision_distance#30 night_vision_tint#000000 |DV Forest 0/15, --set has_bright_light_vision#no emits_bright_light#no bright_light_distance#00 has low_light_vision#no emits_low_light#no low_light_distance#05 has_night_vision#yes night_vision_distance#15 night_vision_tint#000000
1657242136
The Aaron
Roll20 Production Team
API Scripter
Hmm.&nbsp; Bump should respond to TokenMod changes regardless of layer.&nbsp; If you select the slave token (transparent), it should propagate changes just as if a player made them.&nbsp; I'll have to try and reproduce that.&nbsp;&nbsp;
Well now... That is a lot to to take in.&nbsp; I will say that I only have Select Manager installed, not Fetch at all.&nbsp; Didn't know it was even needed.&nbsp; I have a lot of reading to do LOL timmaugh said: I should really put a couple of videos together on using the metascripts. =D The message you're getting is coming from Fetch, which is telling you that there isn't anything selected from which to get the token_id. I'm going to take a wild guess and say that you DON'T have ZeroFrame installed... just SelectManager and Fetch... and that Fetch is installed before SelectManager. Am I right? If so, here's what's going on: scripts queue up in the order they get processed as your sandbox goes into its "ready" state. Metascripts shin-kick their way to the head of that queue so that they get processed before standard scripts, but they are still in their own queue. In other words, if Fetch is installed before SelectManager, they will both register before standard scripts, but Fetch will register first, and it will be processed first. So when your message comes through, first Fetch tries to pull the token_id from the selected token (there isn't one)... and then later SelectManager adds the specified token to the set of selected. Kinda backwards. To solve that, ZeroFrame creates its own registry of the metascripts you have installed. It basically says: "I will register before all of the standard scripts, and all of metascript peeps can register with me. Then I will control which of them runs in what order." Every one of the other metascripts have a "priority" with which they register to ZeroFrame...&nbsp; 99% of the time, you're going to want SelectManager to run before any of the other metascripts, so it has a higher priority than Fetch. No matter what order SM and Fetch are installed, with ZeroFrame also installed SM will default to run before Fetch (this can be changed with ZeroFrame, but that's beyond the scope of what you need to do). Just by installing ZeroFrame, you'll fix the message you're getting, above. (Or you can reorder your metascripts by uninstalling Fetch and installing it again -- effectively installing it after SelectManager.) Now, back to what you're trying to do... If you are only trying to modify one token, TokenMod's --ids argument will do what you need it to do (without selecting the token and without any metascripts): !token-mod --set statusmarkers|+aura:3 --ids -N0wEOJ2iAV_D4HbZLSZ The {&amp;select...} verbiage can really help for a script that doesn't have the ability to designate a token in the command line this way, but it can be used in place of the --ids argument for TokenMod. It does not require the forselected handle at the beginning of the line; it will work on its own. The following is functionally the same as the previous command: !token-mod --set statusmarkers|+aura:3 {&amp; select -N0wEOJ2iAV_D4HbZLSZ} Tangent of Use: There are reasons you might want to use the latter formulation... for instance if you have a list of characters and/or party sub-divisions that you would want to quickly access without having to find them on the gameboard. By putting them in a roll query (processed before metascripts), you can effectively choose from that list which characters to affect with your TokenMod command: {&amp; select ?{Who|Dingus|Modus|Dingus and Modus,Dingus&amp;comma; Modus} By the time SelectManager sees the command line, it will see one of the following: {&amp; select Dingus} {&amp; select Modus} {&amp; select Dingus, Modus} If you don't use the --ids argument of TokenMod, the script will affect the selected tokens; it will just affect them all the same. In this case, no matter which of the 3 options get returned from your roll query, you will effectively be replacing the set of selected tokens on the gameboard with the response you provide... and *those* are the tokens TokenMod will affect. Tangent of Tangent of Use: Now you get into a realm where you might want to use forselected ... if you have to set individual information for each token. The forselected handle can be used independently of {&amp;select...} . Without the {&amp;select...} statement, forselected will just iterate over the tokens you have selected on the game board. If you have to set the aura marker value to increment by a separate value for each token, you might need to pull that from the token/character. In that case, you'd use forselected to separate/iterate every call, and then a Fetch construction to get the increment value (maybe that's called "fatigue"): !forselected(^) token-mod --set statusmarkers|+aura:+@^(selected.fatigue) That will use the tokens selected at the time the command is run, and increment their aura status marker by the value of their fatigue attribute. Taking a step further, you can use the {&amp;select... statement, and control which of them are affected: !forselected(^) token-mod --set statusmarkers|+aura:+@^(selected.fatigue)&nbsp;{&amp; select ?{Who|Dingus|Modus|Dingus and Modus,Dingus&amp;comma; Modus} Now, no matter if you just choose one token or multiple, you'll get the right value to process, and everyone will have the appropriately incremented status marker.
Newbie Question Which is the correct way to code this: Player has bright light for the first 60ft than can see an additional 60ft but dim light. total vision distance is 120. I dont know how roll20 applies this logic, as in 120 dim radius from token then 60 bright raidus from token or 60 bright radius from token and another 60 from the end of bright light radius. bright_light_distance#60 low_light_distance#60 lightColor|#ffff00 bright_light_distance#60 low_light_distance#120 lightColor|#ffff00
1657389330
The Aaron
Roll20 Production Team
API Scripter
With TokenMod, I try to match the input format for the Token Properties as closely as possible.&nbsp; With LDL,&nbsp; you had two numbers you set: Total distance and When does it start to fade .&nbsp; With UDL, they changed the interface to have two different numbers: distance for bright light and distance for dim light (low light).&nbsp; Each of the distances for UDL are only measuring that specific part, so a Bright of 10ft and a Low of 20ft means you have a total light radius of 30ft (10ft + 20ft).&nbsp; So your setting should be: bright_light_distance#60 low_light_distance#60 lightColor|#ffff00 It makes a bit more sense than it used to (but annoyingly, in the backend it's still the same so you have to do extra work to make it work out from the UI standpoint!! =D), but if you're used to the old way, it can be a bit confusing.
1657390430

Edited 1657390621
ok, so the dim light starts at the end of the bright light. Thanks
Ack - guess I got a follow up then |Covered Hooded Lamp 30/5 - so I should put Bright at 5 and Dim at 25, so the total is 30 max distance correct?
I am also having another issue - specifically with directional lighting. So, let's say initially, all my token directional lighting is set to 360 total, 0 center. When I go down the list, everything seems fine until Bullseye latern. When I check the token, it does show 60 total, 270 center but it never applies it. Now let's pretend I manually apply it. Cool, working as intended now. Then I go change into any other vision, such as candle, torch, whatever.. Now all of them visually still has the 270 center, but in the dynamic page, it shows 360 / 0 respectively, just not applied.&nbsp; not sure how to fix this. !token-mod {{?{What Type of Vision - DIM/BRIGHT |None/Blind, --set has_bright_light_vision#no emits_bright_light#no bright_light_distance#0 has low_light_vision#no emits_low_light#no low_light_distance#0 has_night_vision#no has night_vision_distance#0 night_vision_tint #transparent |Candle 10ft 5/5, --set has_bright_light_vision#yes emits_bright_light#yes bright_light_distance#5 has low_light_vision#yes emits_low_light#yes low_light_distance#5 has_night_vision#yes night_vision_distance#5 night_vision_tint #transparent has_directional_bright_light#yes directional_bright_light_total#360 bright_light_Center#00 lightColor#434343 |Torch Light 40ft 20/20, --set has_bright_light_vision#yes emits_bright_light#yes bright_light_distance#20 has low_light_vision#yes emits_low_light#yes low_light_distance#20 has_night_vision#yes night_vision_distance#5 night_vision_tint #transparent has_directional_bright_light#yes directional_bright_light_total#360 directional_bright_light_center#00 lightColor#434343 |Lamp 45ft 30/15, --set has_bright_light_vision#yes emits_bright_light#yes bright_light_distance#30 has low_light_vision#yes emits_low_light#yes low_light_distance#15 has_night_vision#yes night_vision_distance#5 night_vision_tint #transparent has_directional_bright_light#yes directional_bright_light_total#360 directional_bright_light_center#00 lightColor#434343 |Hooded Lamp 60ft 30/30, --set has_bright_light_vision#yes emits_bright_light#yes bright_light_distance#30 has low_light_vision#yes emits_low_light#yes low_light_distance#30 has_night_vision#yes night_vision_distance#5 night_vision_tint #transparent has_directional_bright_light#yes directional_bright_light_total#360 directional_bright_light_center#00 lightColor#434343 |Covered Hooded Lamp 35ft 30/5, --set has_bright_light_vision#yes emits_bright_light#yes bright_light_distance#30 has low_light_vision#yes emits_low_light#yes low_light_distance#5 has_night_vision#yes night_vision_distance#5 night_vision_tint #transparent has_directional_bright_light#yes directional_bright_light_total#360 directional_bright_light_center#00 lightColor#434343 |Bullseye Lantern 120ft 60/120, --set has_bright_light_vision#yes emits_bright_light#yes bright_light_distance#60 has low_light_vision#yes emits_low_light#yes low_light_distance#60 lightColor#434343 has_night_vision#yes night_vision_distance#5 night_vision_tint #transparent has_directional_bright_light#yes directional_bright_light_total#60 directional_bright_light_Center#270 |Day Open 60/60, --set has_bright_light_vision#yes emits_bright_light#yes bright_light_distance#60 has low_light_vision#yes emits_low_light#yes low_light_distance#60 has_night_vision#no night_vision_tint #transparent |Day Woods 30/30, --set has_bright_light_vision#yes emits_bright_light#yes bright_light_distance#30 has low_light_vision#yes emits_low_light#yes low_light_distance#30 has_night_vision#no night_vision_tint #transparent |Day Forest 15/15, --set has_bright_light_vision#yes emits_bright_light#yes bright_light_distance#15 has low_light_vision#yes emits_low_light#yes low_light_distance#15 has_night_vision#no night_vision_tint #transparent |DV Open 0/60, --set has_bright_light_vision#yes emits_bright_light#no bright_light_distance#00 has low_light_vision#no emits_low_light#no low_light_distance#00 has_night_vision#yes night_vision_distance#60 night_vision_tint#000000 |DV Woods 0/30, --set has_bright_light_vision#yes emits_bright_light#no bright_light_distance#00 has low_light_vision#no emits_low_light#no low_light_distance#00 has_night_vision#yes night_vision_distance#30 night_vision_tint#000000 |DV Forest 0/15, --set has_bright_light_vision#yes emits_bright_light#no bright_light_distance#00 has low_light_vision#no emits_low_light#no low_light_distance#05 has_night_vision#yes night_vision_distance#15 night_vision_tint#000000 |Cavern 25/25, --set has_bright_light_vision#yes emits_bright_light#no bright_light_distance#25 has low_light_vision#yes emits_low_light#no low_light_distance#25 has_night_vision#no night_vision_tint #transparent |Dungeon 20/20, --set has_bright_light_vision#yes emits_bright_light#no bright_light_distance#20 has low_light_vision#yes emits_low_light#no low_light_distance#20 has_night_vision#no night_vision_tint #transparent |Custom 10/10, --set has_bright_light_vision#yes emits_bright_light#no bright_light_distance#10 has low_light_vision#yes emits_low_light#no low_light_distance#10 has_night_vision#no night_vision_tint #transparent|}}}
1657413842
The Aaron
Roll20 Production Team
API Scripter
I believe you're running into the Roll20 UDL API bug.&nbsp; It has yet to be fixed.&nbsp; The only way to fix it is to open the token settings and save the token.
Question around customer status markers.&nbsp; My DM has a different sent of status markers (that I also would like to try in my games), but I can't get tokenmod to set them.&nbsp; From a script I forget who wrote (Token Maker Info??? command !markernames) this is the token that they are using for concentration. I'm trying to set this with these commands !token-mod --set statusmarker|3239103:Concentration !token-mod --set statusmarker|Concentration !token-mod --set statusmarker|Concentration:3239103 None work.&nbsp; Can Token Mod work like this?
1657416135

Edited 1657419999
The Aaron
Roll20 Production Team
API Scripter
If you run !token-mod --help It will show a table of all the loaded TokenMarkers: For custom Token Markers, it shows both the Name and the Tag.&nbsp; If the Name is unique, you can use it to refer to the custom Token Marker. !token-mod --set statusmarkers|diamond &nbsp; If it isn't unique (or contains a space), you need to use the Tag: !token-mod --set statusmarkers|Eye_Balls::2591986 Note that if TokenMod does not show the Custom Token Markers, you probably still need to upload them to the game on the Game Details page.