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
Forum Champion
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.
1653742799
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}
1654362668
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
Forum Champion
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
Forum Champion
API Scripter
There's probably a Tim's Meta Magic Script method of expanding this to a whole group of selected tokens.&nbsp;
1654366050
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
Forum Champion
API Scripter
I really have no idea. =D I just know it should be possible.&nbsp;
1654373943
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
Forum Champion
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.
1654912331
So I know we have !token-mod --set defaulttoken But do we have a way to remove the default token for a sheet?
1654915065
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
Forum Champion
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.
1655247539
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}