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.

1702748725
The Aaron
Roll20 Production Team
API Scripter
I don't believe status markers can be webm files.  Status Markers get uploaded on the Game Details Page.  There is then a menu of them you can choose by name.  It sounds like you're setting the token's image to a webm file.  That works, but the API doesn't have the ability to cause them to play.   Setting status markers works like this: !token-mod --set statusmarkers|+blue
Timothy B. said: I'm trying to use TokenMod to add status markers using animated webm files. It kind of works, but instead of placing the file over the token, it replaces it. It also doesn't loop the animation. Is this at all possible? Custom Status Markers need to be added into sets outside &nbsp;of the game prior to being able to be used in the game. If you are using TokenMod to change a token's image, then it is just replacing the image, not adding a Status Marker. <a href="https://wiki.roll20.net/Token_Markers" rel="nofollow">https://wiki.roll20.net/Token_Markers</a>
1702755608
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Also, I do not think that .webm is a usable format for Token Markers. AFAIK, it's PNG at 512px only.
Yes, thank everyone. My mistake was trying to figure this all out at 5am, I kinda got caught up playing with api scripts all night. You are correct, I was using the token image replacement rather than the token marker code. In my haste I was under the impression that it was completely bypassing existing token markers and using images instead, which if that were possible would probably allow me to use a webm file. I failed to realize it was using existing token markers.
1702772344
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
There is a similar script that can attach images to tokens. Look up Token Condition &nbsp;(Also by the Aaron!). It is available through One-Click.
keithcurtis said: There is a similar script that can attach images to tokens. Look up Token Condition &nbsp;(Also by the Aaron!). It is available through One-Click. Thanks Keith, you always point me in the right direction. And thanks The Aaron for the mod, that's exactly what I was looking for.
1704168208

Edited 1704168350
Hi all, I have a macro for the D&amp;D 5E spell Enlarge Reduce, for the D&amp;D 5E OGL sheet by Roll20. It's all working except that it Enlarges and Reduces both the source and target tokens when it should just be the target token. Debug output shows that the correct token_id or character_id, I tried both, are being used. I'm probably missing something obvious... !Scriptcard {{ --#sourceToken|@{selected|token_id} --#targetToken|@{target|token_id} --#bodyfontface|Helvetica --#oddrowfontcolor|#290000 --#evenrowfontcolor|#290000 --#bodyfontsize|12px --#titlecardbackgroundcolor|#930c10 --#titlecardbackgroundcolor|#672223 --#titlefontcolor|#fffebd --#titlefontsize|1.5em --#titlefontshadow|0 --#oddrowbackground|#f7ce65 --#evenrowbackground|#f7ce65 --#oddrowbackground|#b3ab96 --#evenrowbackground|#b3ab96 --#subtitlefontcolor|#fffebd --#tablebgcolor|#fffebd --#Debug|1 --#lineheight|10pt --#buttonfontsize|10px --#buttonbackground|#930c10 --#buttonbackground|#672223 --#buttonbackground|rgba(103,34,35,1); display:inline-block; --#buttonfontface|Tahoma --#buttonpadding|8px --#bodyfontface|Helvetica --#bodyfontsize|14px --#Title|Enlarge Reduce --#leftsub|1 Action --#rightsub|Duration: 1 minute --#emoteText|[*S:character_name] Casts Enlarge Reduce. --&amp;Description|You cause a creature or an object you can see within range to grow larger or smaller for the duration. Choose either a creature or an object that is neither worn nor carried. If the target is unwilling, it can make a Constitution saving throw. On a success, the spell has no effect.%br%If the target is a creature, everything it is wearing and carrying changes size with it. Any item dropped by an affected creature returns to normal size at once.%br%Enlarge. The target’s size doubles in all dimensions, and its weight is multiplied by eight. This growth increases its size by one category—from Medium to Large, for example. If there isn’t enough room for the target to double its size, the creature or object attains the maximum possible size in the space available. Until the spell ends, the target also has advantage on Strength checks and Strength saving throws. The target’s weapons also grow to match its new size. While these weapons are enlarged, the target’s attacks with them deal 1d4 extra damage.%br%Reduce. The target’s size is halved in all dimensions, and its weight is reduced to one-eighth of normal. This reduction decreases its size by one category—from Medium to Small, for example. Until the spell ends, the target also has disadvantage on Strength checks and Strength saving throws. The target’s weapons also shrink to match its new size. While these weapons are reduced, the target’s attacks with them deal 1d4 less damage (this can’t reduce the damage below 1). --&gt;WhatSpellSlot| --&gt;OutputText| --X| --:OutputText| --+|[rbutton]Show Description::OutputDescription[/rbutton] --X| --:OutputDescription| --+|[f11][&amp;Description][/f] --X| --:WhatSize| --+Enlarge or Reduce Target?|[br][rbutton]Enlarge::Size;2[/rbutton][rbutton]Reduce::Size;.5[/rbutton] --X| --:Size| --=EorR|[&amp;reentryval] --@forselected|token-mod _ignore_selected _ids @{target|character_id} _set scale|*[$EorR] --&lt;| --:WhatSpellSlot| --+At what level is the spell being cast?| --+|[rbutton]1::WhatLVL;1[/rbutton][rbutton]2::WhatLVL;2[/rbutton][rbutton]3::WhatLVL;3[/rbutton][rbutton]4::WhatLVL;4[/rbutton][rbutton]5::WhatLVL;5[/rbutton][rbutton]6::WhatLVL;6[/rbutton][rbutton]7::WhatLVL;7[/rbutton][rbutton]8::WhatLVL;8[/rbutton][rbutton]9::WhatLVL;9[/rbutton] --X| --:WhatLVL| --=SlotLevel|[&amp;reentryval] --=SlotsTotal|0 --=SlotsExpended|[*S:lvl[$SlotLevel]_slots_expended] --?[$SlotsExpended.Raw] -eq [$SlotsTotal.Raw]|[ --&gt;NoSlotsLeft| --]|[ --?[$SlotLevel] -eq 0|NoSlot --=SlotsLeft|[$SlotsExpended] - 1 --!a:[*S:character_id]|lvl[$SlotLevel]_slots_expended:[$SlotsLeft] --+|Level [$SlotLevel] Slots Left: [$SlotsLeft] --&gt;WhatSize| --X| --:NoSlot| --X| --:NoSlotsLeft| --+|[*S:character_name] has no level [$SlotLevel.Total] spell slots available. --X|NoSlotsLeftStop }}
1704174464
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Is there a token mod command in that macro?
Keith, there is a token-mod call in there. In this part here: --:Size| --=EorR|[&amp;reentryval] --@forselected|token-mod _ignore_selected _ids @{target|character_id} _set scale|*[$EorR] --&lt;| Timothy, if you are sending in the ids you shouldn't need the @forselected with token-mod --@token-mod|_ignore_selected _ids @{target|character_id} _set scale|*[$EorR] That should work as long as you have it configured that players can use ids, which you can confirm with !token-mod --config
1704183611
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Joshua N. said: Keith, there is a token-mod call in there. In this part here: --:Size| --=EorR|[&amp;reentryval] --@forselected|token-mod _ignore_selected _ids @{target|character_id} _set scale|*[$EorR] --&lt;| Thanks, I was searching on "!token-mod", not being familiar with the syntax of putting an API call inside a metascript call inside a ScriptCards macro. :D
Thanks guys. Weird but _ignore_selected doesn't work, the debug output calling to the api looks like --ignore_selected when it should be --ignore-selected. If I use _ignore-selected it outputs correctly and works. Using SelectManager was me desperately trying to figure it out,
1704266390
The Aaron
Roll20 Production Team
API Scripter
If you have any calls to @{target|...}, the selected property is not passed to the API. I don't know if that's related, but something to be aware of.&nbsp;
1704379403
timmaugh
Pro
API Scripter
Timothy B. said: Thanks guys. Weird but _ignore_selected doesn't work, the debug output calling to the api looks like --ignore_selected when it should be --ignore-selected. If I use _ignore-selected it outputs correctly and works. Using SelectManager was me desperately trying to figure it out, Yeah, a fairly typical way scripters indicate new arguments in their command lines is by a space followed by double hyphens: !scripthandle --arg1=foo --arg2=tacos ScriptCards uses this convention, too (every line begins with the double hyphens), so to get around the fact that intended-outbound command lines might have similar argument-demarcation, Kurt built the ability to designate outbound double-hyphens with the underscore. Since the pattern that ScriptCards looks for is "whitespace-double-hyphen", it only looks to replace the underscore at the beginning of a word (that is, following whitespace). Hopefully that makes sense.
Hello all and apologies if this has been answered already, my searching FU has failed me.&nbsp; I know from reading there may/may not be a bug with this. I am starting Phandelver with a group of new players to D&amp;D, well rolepalying in general.&nbsp; I have already got Phandelver and I have created an adventure from the module. I want to set all the monsters in my game to be: Bar 1 - Monsters current HP - This is always correct and set right it seems Bar 2 - Monsters AC - Here lies the problem Now when I drag a monster onto the board its bar 2 attribute is already set to npc_ac but it doesn't display anything.&nbsp; If I change it to something else and save then change it back it works.&nbsp; I then thought, OK I will use !tokenmod to set it after I have dropped so I did: !tokenmod --sel --set bar2_link|npc_ac This didn't work.&nbsp; I thought it may be bacuase it is already set to npc_ac so I did this: !tokenmod --sel --set bar2_link|ac !tokenmod --sel --set bar2_link|npc_ac Nope, no dice.&nbsp; The only way I worked out to get this to work, which has worked, is to open every monster token bio then close it.&nbsp; The npc_ac then, without me changing anything, started working.&nbsp; Now this is not a problem here but I have a couple of other games on the go and I want to change all the tokens to act the same as this. do I use !chatsetattr -all or has someone come up with a better way OR is it a bug that cannot be squashed except with a jumpgate...
1704914281
The Aaron
Roll20 Production Team
API Scripter
That is really peculiar behavior.&nbsp; The NPC characters in question here, are they from the module, from the compendium, or created by you? Do you have the Token Defaults / Character Sheet Defaults set in the Game Settings to use AC in Bar 2?
1704918657

Edited 1704918757
The Monster tokens are all from the module. Token defaults are set in the game settings as both empty this time round , though I have tried it with npc_ac in bar 2 as well.&nbsp; AC gives a different value with monsters I think for some reason and npc_ac I read should be used. Character sheet defaults are set tothe defaults that the game created. Don't want to hog this possible "off topic", I do want to use !tokenmod if I can or happy to start a new thread for this.
Hi! I am using TokenMod for the first time, and I have a map with torches that change different colors. I have macros set up to do this: !token-mod --ids -NoKum0PnnHDqL76d8QN --set lightColor#93c47d !token-mod --ids -NoKvIB8xvr9G9-RLDq4 --set lightColor#ffffff !token-mod --ids -NoKvWLwdPJULltWfThs --set lightColor#0000ff !token-mod --ids -NoKvJWpWFMc3a2lFkA- --set lightColor#ff0000 There are five different macros, with the same format as above, just the colors change. However, I'm finding that sometimes, the colors don't change, or they change to the wrong values. It seems like if I leave the game and re-enter, it fixes itself, but I suspect that when my players are in the game with me, we would all have to leave and re-enter to fix the issue. Is there something I'm doing wrong that can cause this behavior, or is there a way I can force the script to reload while still in the game? Thanks!
1705532498
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Hi Josh! Some settings are still resistant to updating when done through the VTT. You might be able to force an update by opening the DL settings on the token and then closing them again, which is faster than reloading the entire game.
Hi I have just found Token mod and it is amazing! I have an issue when trying to expand the tooltip description bar !token-mod {{ &nbsp;&nbsp;&nbsp; --set &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; tooltip|"aaaaa" &nbsp;&nbsp;&nbsp;&nbsp; --on &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; show_tooltip }} Using this command to expand the tooltip, the formatting of the description is unusable Is there a way to reformat this command ? as to extend the horizontal axis of the description?
1705671551
The Aaron
Roll20 Production Team
API Scripter
The visual aspect of the Tooltip is not something the API can change unfortunately.&nbsp;
The Aaron said: The visual aspect of the Tooltip is not something the API can change unfortunately.&nbsp; Ok thanks!
Hi I have been trying to add NightVision effects Nocturnal Can you tell me what I am doing wrong? ?{ Light/Vision options: |DarkVision (Noct60), !token-mod --on night_vision_effect_nocturnal }
1705674933
The Aaron
Roll20 Production Team
API Scripter
The night_vision_effect property is not a simple on/off, you have to set one of the values.&nbsp; Here's the relevant section from the help: Night Vision Effect Night Vision Effect specifies how the region of night vision around a token looks. There are two effects that can be turned on:&nbsp; dimming &nbsp;and&nbsp; nocturnal . You can disable Night Vision Effects using&nbsp; off ,&nbsp; none , or leave the field blank. Any other value is ignored. Available Night Vision Effect Properties: night_vision_effect Enable the nocturnal Night Vision Effect on a token: !token-mod --set night_vision_effect|nocturnal
I recently began using this API's '--move' funciton for fun shenanigans in-game, and it's been working great! I am curious, however, if it is possible for dynamic lighting barriers to restrict this movement. Let me give an example.&nbsp; I currently use this for my Tempest Cleric's Thudnerbolt Strike feature:&nbsp; @{Goodwin|wtype}&amp;{template:traits} {{name=Thunderbolt Strike}} {{source=Tempest Cleric - 6th Level Feature}} {{description=Goodwin's lightning blasts into **@{target|a Large or smaller creature you dealt lightning damage to|token_name}**, pushing them 10 feet away!}} !token-mod {{{ --ids @{target|a Large or smaller creature you dealt lightning damage to|token_id} --move ?{Which direction? (Compass-style)| North,=0&amp;#124;10ft| Northeast,=45&amp;#124;14.1ft| East,=90&amp;#124;10ft| Southeast,=135&amp;#124;14.1ft| South,=180&amp;#124;10ft| Southwest,=225&amp;#124;14.1ft| West,=270&amp;#124;10ft| Northwest,=315&amp;#124;14.1ft} }}} It functions really well for what I need, but it can push tokens through dynamic lighting barriers if used when a token is near enough to one. Any thoughts? Thanks in advance.&nbsp;
1706417125
The Aaron
Roll20 Production Team
API Scripter
That's something I've intended to add, but haven't gotten around to yet.&nbsp;
Hello, Just started getting into scripts and I already love this. The versatility is amazing! My first "project" to do with this is do a simple macro drop down of the statuses so players and myself can easily assign one as needed. I do have a HP script that I modified to indicate health statuses. I wanted to know if there is a way to make the tokenmod ignore specific status(es) that are on the creature token? Currently when I run the "clear all" macro it removes all status including the 5 specific ones that I would like for it to ignore. My current work around is to add hit points then subtract it so that it updates with the HP status again. Any help is appreciated.
1708009081
The Aaron
Roll20 Production Team
API Scripter
I think you'll have to build an explicit clear all command like: !token-mod --set statusmarkers|-blue|-red|-green|-happy|-sad That would leave any of the status not listed on the token unchanged.
Thats what I was afraid of. Thank you for the response tho, I'll just add a line to heal and damage line to get back to their current HP status.
Help Please. Try to use&nbsp; !token-mod --set currentside|2 to change the side of a token. Made a table and label each 1 and 2. Will not change. Copy the token from my market place to my library and recreated the table. Same issue.&nbsp;
1708415136
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Hi Craven! At this point in time, API scripts cannot affect most Marketplace images. My suggestion would be to download the image(s) and upload it to your own library, and try that for the source.
1708468920

Edited 1708469169
Hello all, I have these altitude token markers I bought from the Marketplace. The markers work with TokenMod. What I want to do is create a Macro that quickly lets the GM/a player to select a token and an altitude, and apply the relevant marker without needing to create a separate command for each one. In theory, I'd love to be able to set up a [+] and [-] Macro button which increases or decreases the altitude by a step up/down, but I don't think that's within the scope of the API. Instead, just being able to quickly select and apply an altitude marker and replace or remove any existing one would suffice. I appreciate any assistance. Thank you.
1708469078
The Aaron
Roll20 Production Team
API Scripter
Craven, one thing to be aware of is that changing a Rollable Table does not change the Rollable Table Tokens you have already created from it.&nbsp; If you changed out the images in the table for copies uploaded to your user library, but did not create a new token, the old token will still have the Marketplace images, and thus won't work with the API currently.&nbsp; Create a new token and it should work with the new User Library images.
1708469636
The Aaron
Roll20 Production Team
API Scripter
Jeff P.:&nbsp; Probably that would be easiest to manage with a custom script.&nbsp; If you want to do it with TokenMod, you could pretty easily with the caveat that it would clear all TokenMarkers when you apply it.&nbsp; It would look something like: !token-mod --set statusmarkers|=?{Elevation|None,|5ft,5ft::4706416|10ft,10ft::4706417}
The Aaron said: Jeff P.:&nbsp; Probably that would be easiest to manage with a custom script.&nbsp; If you want to do it with TokenMod, you could pretty easily with the caveat that it would clear all TokenMarkers when you apply it.&nbsp; It would look something like: !token-mod --set statusmarkers|=?{Elevation|None,|5ft,5ft::4706416|10ft,10ft::4706417} That's what I figured, but honestly, the drop-down menu you provided is perfect for my needs! It saves me time from having to select each token and scroll to the bottom of the markers and find the right number each time, which honestly was the main goal. Thank you!
1708476836
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
The Aaron said: Craven, one thing to be aware of is that changing a Rollable Table does not change the Rollable Table Tokens you have already created from it.&nbsp; If you changed out the images in the table for copies uploaded to your user library, but did not create a new token, the old token will still have the Marketplace images, and thus won't work with the API currently.&nbsp; Create a new token and it should work with the new User Library images. Hi Jeff! If you create the rollable token and set it as the default token for a character sheet you can easily pull that token out over and over again every time you need it, without creating a new one from the Collections tab. You could even set your elevation macro to be a token action for that character, so the token action button is available whenever you have the elevation token selected.
1708477891

Edited 1708563158
The Aaron said: It would look something like: !token-mod --set statusmarkers|=?{Elevation|None,|5ft,5ft::4706416|10ft,10ft::4706417} Quick question, when I set to None, the current marker doesn't disappear. I messed around with the code/help/first page of this thread a bit, but I wasn't able to make it work. I appreciate any assistance. Thank you EDIT: Nevermind, I figured out a work-around! I appreciate all the help!
1708566238
The Aaron
Roll20 Production Team
API Scripter
Sorry for the delay, glad you got it working!
Hi, very much enjoying token mod, looking for some help 1) I am struggling to find anywhere one how to change the bar settings can you direct me to where i can read on that? 2) This is my current command, I want to change the size and HP for each token can you tell me how to do that? !token-mod --set currentside|3 !splay Bear roar#2 Krompton Wildshapes into a Bear!
1709522402
Andrew R.
Pro
Sheet Author
You could use the --scale command to adjust the token size, and the --set bar1_value (or bar2_value or bar3_value) command to adjust the HP depending on which bar is the HP in your game.&nbsp; You should tell us what game system, character sheet, and token setup you're using if you need more detailed help. 13th Age setups differ from D&amp;D 5e setups, for example.&nbsp;
1709525077
The Aaron
Roll20 Production Team
API Scripter
Some useful options: Size: width -- this sets the width&nbsp; height -- this sets the height scale -- this sets the width and height both to the same value Follow any of these with a number with units for a specific size, or a mathematical operation and number for a relative adjustment scale|*2 width|70px height|2u Bars: bar1_value -- the current value of bar 1 bar1_max -- the max value of bar 1 bar1 -- sets the current and max value to the same number follow with a value or a mathematical operation and number for relative changes bar1|65 bar1_current|-30 bar1_max|+20
Here is my current macro for each individual transformation (included simplesound mod and FX) Is there a way to place all of my transformations into one macro.&nbsp; A query function? thanks in advance. !token-mod {{ --set currentside|3 bar1_value|34| bar1_max|34 bar2_value|-1| bar2_max|2 height|9s| width|9s }} !splay Bear roar#2 /fx explode-slime Krompton Wildshapes into a Bear!
1714000538

Edited 1714003235
Looking for a little assistance. I'm trying to change the AC on a token using the following ScriptCards macro What I've posted here is just a snippet of the whole code. --:Mage-armor| --+|[c][&amp;SM_Token][/c] --#rightsub|Status --@act| -1| 4800| _Mage Armor [*[&amp;ThisTarget]:character_name] --delete-le 0 --@token-mod|_set bar3|13+@{selected|dexterity_mod} --+|[c][b]You touch a willing creature who isn’t wearing armor, and a protective magical force surrounds it until the spell ends.[/c][/b] --+|[c][b]The target’s base AC becomes 13 + its Dexterity modifier.[/c][/b] --+|[c][b]The spell ends if the target dons armor or if you dismiss the spell as an action[/c][/b] --^MARK| But what happens is the token shows 13+2 instead of just showing 15.
Hey EZ, ScriptCards can do inline math with [= ] . So your --@token-mod line could look like: --@token-mod|_set bar3|[= 13 + @{selected|dexterity_mod} ] ScriptCards can even do the object modification itself with `--!t` and using attribute referencing from --#sourceToken it would look like: --#sourceToken|@{selected|token_id} --!t:[*S:id]|bar3_value:[= 13 + [*S:dexterity_mod] ]
Joshua N. said: Hey EZ, ScriptCards can do inline math with [= ] . So your --@token-mod line could look like: --@token-mod|_set bar3|[= 13 + @{selected|dexterity_mod} ] ScriptCards can even do the object modification itself with `--!t` and using attribute referencing from --#sourceToken it would look like: --#sourceToken|@{selected|token_id} --!t:[*S:id]|bar3_value:[= 13 + [*S:dexterity_mod] ] Joshua - Thank you, that solved my problem.