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.

Hey Aaron, I was wondering if you ever did anything with this:
1569496520
The Aaron
Roll20 Production Team
API Scripter
Not yet. Man, was that really a year ago? Time moves so quickly of late...
1569504533
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
I'd forgotten all about that. I think we have actually discussed that recently. In regards to generating hit points on tokens, maybe?
1569506379
The Aaron
Roll20 Production Team
API Scripter
Yeah, agree, seems like a month or so ago. 
Hey, I am having an issue and I wonder if there is a work around. I have this macro to try to speed up things when i get a token  !token-mod {{ --set width|1u height|1u represents|?{Character} name|?{name} showname|yes showplayers_name|yes }} The problem comes when I try to use more than 2 names in the same checkbox. It only writes the first one or when i try to add a character that has two names. For example if I want to name a character Ulfred Pflaume, only Ulfred is added to the token and the last name just disappear. Is not like a huge problem but is quite annoying since I have to edit the token after. Is this a roll20 thing or can something be done with the script? 
1569518581
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Try this: !token-mod {{ --set width|1u height|1u represents|?{Character} name|"?{name}" showname|yes showplayers_name|yes }}
1569521836

Edited 1569524093
Hey guys, I was hoping someone could help me with the code to change the "bar location" the default for modules is above and I like bottom overlapping... I'd like to mass change tokens on the pages to fit my preference. Can Token Mod change the bar location? I didn't see it in the documentation but might have missed it? **EDIT** Oh, so it seems that you can set up your default settings then ingame settings you can apply default settings from the "Experimental Features" section at bottom.&nbsp; <a href="https://app.roll20.net/forum/post/7412194/tokenmod-and-the-new-bar-positioning/?pageforid=7412401#post-7412401" rel="nofollow">https://app.roll20.net/forum/post/7412194/tokenmod-and-the-new-bar-positioning/?pageforid=7412401#post-7412401</a>
1569524759
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
That's the only way at the moment. The bar position is not touchable by the API. This has been requested a number of times. Also be aware, since the API cannot affect it, the defaulttoken command will reset the bar position. This fix has also been requested of the dev team.
Thanks Keith! You are always so helpful :)
1569527014

Edited 1569528476
The Aaron said: Not yet. Man, was that really a year ago? Time moves so quickly of late... IKR?&nbsp; But yeah, I went scrolling back through old posts on the thread looking for something and thought I'd ask about that one once I came across it.&nbsp; It's on page 8 here ... Did you and Jakob ever get together (entmoot?) and see if you could apply something similar to his strategies?&nbsp; I tend to use the two together (Tokenmod + ChatSetAttr APIs, for the uninitiated) in some macros, it'd be nice to see both sharing the same types of workaround syntax ... as long as it didn't break existing macros. As far as I'm concerned, you have had a lot on your hands with Roll20 doing alot to their platform redesigns, so its totally forgivable to miss some stuff you were planning.&nbsp; That total rework sent a lot of APIs rushing to restore their function - and some are still quite broken (some authors having abandoned all their works here on Roll20, or are taking extremely long breaks from it).&nbsp; At least you're still here plugging away at making an up-to-date API for us all to enjoy, and expanding on its function all the while...
1569556704

Edited 1569556928
The following reports 0 always, irregardless of the fact that it is a number value ... !token-mod {{ --ids -Lpkh5ZRJjzLH40cIcwR --set currentside|4 --current-page --ignore-selected --report gm:control|"{name} current side number is {currentside:change}..." }}
thx you kurt, is working perfect now :)
1569583759
The Aaron
Roll20 Production Team
API Scripter
Wolf Thunderspirit said: The following reports 0 always, irregardless of the fact that it is a number value ... !token-mod {{ --ids -Lpkh5ZRJjzLH40cIcwR --set currentside|4 --current-page --ignore-selected --report gm:control|"{name} current side number is {currentside:change}..." }} Try just {currentside}. &nbsp;:change would be 0 if you changed to the same side you're currently on.&nbsp;
Hey Aaron, I am looking into TokenMod for multiple things but there is a couple things that maybe you can help me understand. I've come across this site where the person uses TokenMod to do some nifty things with Macros and I've tried them out and nothing seems to happen. Website: [ Roll20 Player Controlled Condition Macros ] Lets use one of the macros as an example... /em has blessed you… &amp;{template:npcaction} {{name=Tagged: Blessed}} {{description=You bless up to three creatures of your choice within range. Whenever a target makes an attack roll or a saving throw before the spell ends, the target can roll a d4 and add the number rolled to the attack roll or saving throw. At Higher Levels. When you cast this spell using a spell slot of 2nd level or higher, you can target one additional creature for each slot level above 1st. }} !token-mod –ids @{target|1|token_id} @{target|2|token_id} @{target|3|token_id} –set statusmarkers|blue|angel-outfit [Additional Creature(s)? ](!&amp;#13;#y-Tagged-Add-Bless) After using the macro, I get prompted to click the 3 targets so bless can be used but after clicking the 3 targets no status marker or color is put on the token. So I am baffled if there is something I am doing wrong..
1569854194

Edited 1569854512
I'm not that great with code, but try replacing that one line with the text below.. !token-mod --ids @{target|1|token_id} @{target|2|token_id} @{target|3|token_id} --set statusmarkers|blue|angel-outfit It looks like it was missing a few '-' bits... EDIT: I've looked at that same website. I'm guessing that the HTML editor used to build the website actually turned '--' into an ' –'. I'm guessing the author never realised. - If you take a look at their screenshot near the top of the page, you can see that their code has '--' showing. That said, I may be wildly wrong, but that said... my suggested code works ok for me :)
1569854533
The Aaron
Roll20 Production Team
API Scripter
Many text editors replace -- with —, so that may be a problem.&nbsp; Also, be sure if players are going to use this that you turn on Players Can IDS in the settings, or toggle it with this command: !token-mod --config players-can-ids
The Aaron said: Many text editors replace -- with —, so that may be a problem.&nbsp; That substitution consistently drives me nuts when writing macros! :-P LOL
1569856332
The Aaron
Roll20 Production Team
API Scripter
I could probably detect and fix that on submission, but if you used — in the rest of your message, those would cause issues.&nbsp; I could certainly find it in macros and abilities and give warnings, or if I found no commands, give a whisper about it.&nbsp; Hmm.... I really need to write a unified command line parser...
Holy Crap ... That fixed everything! ... something so simple as to changing it to "--" thank you so much!
JinDaKiD said: Holy Crap ... That fixed everything! ... something so simple as to changing it to "--" thank you so much! If possible, notify the original macro author to edit his code and correct it.&nbsp; Not doing so perpetuates the problem for others, as it did for you.
Wolf Thunderspirit said: JinDaKiD said: Holy Crap ... That fixed everything! ... something so simple as to changing it to "--" thank you so much! If possible, notify the original macro author to edit his code and correct it.&nbsp; Not doing so perpetuates the problem for others, as it did for you. Agreed! Thank you for the heads up.
1572672482

Edited 1572672724
Hi, does anyone have a script for changing the purchased Roll20 Module Token Bar settings? Because I do not like their default bar settings, they can be seen below on the Token Baphomet: I'm looking for a script to change the token bar values to the following token Duke Thalamra Vanthampur (Bar 3 is their hp). And also to make it their default token, as I have to update over 200+ tokens manually to the way I like them, and that's not fun. (I would like their darkvision untouched and left the way it is) I only want to update the bar settings. TLDR I don't want tokens like the purchased default Baphomet. I want them like Duke Thalamra Vanthampur. :)
You can change the default setting under game settings to link the bars, then apply the default setting under the cog in game. There should be a button at the bottom next.
1572696880
GiGs
Pro
Sheet Author
API Scripter
He doesnt want to link the HP bar (for example), he wants to copy the HP value from the character sheet and put it in the bar, without linking the bar. Garrad, if you read the documentation for tokenmod, it explains how to do this.
Kilter said: You can change the default setting under game settings to link the bars, then apply the default setting under the cog in game. There should be a button at the bottom next. Thanks Kilter, that's actually really handy to know! :) GiGs said: He doesnt want to link the HP bar (for example), he wants to copy the HP value from the character sheet and put it in the bar, without linking the bar. Garrad, if you read the documentation for tokenmod, it explains how to do this. Correct GiGs! And to be honest I saw the lengthy documentation and thought it would be quicker and likely that someone else had already done something similar to this.&nbsp; I Posted to save my time, but I guess I'll have to figure it out on my own anyway :P
1572790583

Edited 1572791190
Correct GiGs! And to be honest I saw the lengthy documentation and thought it would be quicker and likely that someone else had already done something similar to this.&nbsp; I Posted to save my time, but I guess I'll have to figure it out on my own anyway :P Now now - in life there are no shortcuts.&nbsp; But is it a matter of not knowing how to, or laziness/ procrastination?&nbsp; If the former, I'm sure there would be many willing to help, even me if I could understand what it is you hope to accomplish.&nbsp; If the latter ... well ... you know.&nbsp; I think if it is the latter, the best advice I ever heard was about teaching a man to fish .... Questions about how to build macros from APIs will always come up if you don't learn how to be independent. But yes, the default changes make for the best method of changing the way your output looks.&nbsp; The 5e Shaped Sheet has a configuration utility (!shaped-config) in it that can also change which bars are used for what, then you can simply run !shaped-defaults to make sure it is in line with your settings, though when the sheet is converted over, it should do that automatically.&nbsp; But to ask Token Mod to do it would not really help you as much as the Roll20 App Defaults in Game Settings, Unless you wish to go through the painful process of doing each individually.&nbsp; Or is there a group of tokens you can work with all at once with the selected token method?
1574116384
The Aaron
Roll20 Production Team
API Scripter
Update v0.8.46 &nbsp;-- Fixed a bug where setting&nbsp; scale ,&nbsp; width ,&nbsp; height ,&nbsp; left , or&nbsp; top &nbsp;would result in the selection border and the area where a token could be selected being broken.&nbsp; (Thanks&nbsp; Cameron D.&nbsp; )&nbsp;&nbsp;
1574294595
The Aaron
Roll20 Production Team
API Scripter
Update v0.8.47 &nbsp;-- Enhanced --bar1_reset| and its brethren&nbsp;to use the max value on a freshly linked bar attribute.&nbsp; Now this works as expected (Thanks&nbsp; Cameron D.&nbsp; ): !token-mod {{ --set represents|Bob bar1_link|hp bar1_reset| }}
Is there a way to set the text overlay on a bar to see everyone?
1574951993
The Aaron
Roll20 Production Team
API Scripter
You mean the "18/27" part? &nbsp;Not yet, waiting on an interface from Roll20 to do that from the API.&nbsp;
Yes. That is what I meant. Thank you.
1575329894

Edited 1575423331
I've got an error in the API every time I set a marker on a token (PC and NPC) and it breaks the API in combat sometimes, someone knows why ? The command was just :&nbsp; !token-mod --set statusmarkers#!stopwatch EDIT: Found solution! See post for answer: <a href="https://app.roll20.net/forum/post/7955603/statusinfo-getting-error-no-attribute-or-sheet-field-found-for-character-id-in-api-when-applying-markers" rel="nofollow">https://app.roll20.net/forum/post/7955603/statusinfo-getting-error-no-attribute-or-sheet-field-found-for-character-id-in-api-when-applying-markers</a>
1575331503
The Aaron
Roll20 Production Team
API Scripter
That's bizarre. I'll have to try and duplicate that. Does it still do it when you disable all other scripts?
1575332845

Edited 1575423317
StatusInfo seems to be the culprit, the error does not appear when it is disabled, it just displays the info of the condition related to the marker, strange. EDIT: Found solution! See post for answer: <a href="https://app.roll20.net/forum/post/7955603/statusinfo-getting-error-no-attribute-or-sheet-field-found-for-character-id-in-api-when-applying-markers" rel="nofollow">https://app.roll20.net/forum/post/7955603/statusinfo-getting-error-no-attribute-or-sheet-field-found-for-character-id-in-api-when-applying-markers</a>
1575336587
The Aaron
Roll20 Production Team
API Scripter
I'm glad it wasn't TokenMod causing the issue. I'm at a convention in Orlando right now, but I'll try to take a look at why StatusInfo is causing the issue.&nbsp;
1575336702

Edited 1575423308
Found solution! See post for answer: <a href="https://app.roll20.net/forum/post/7955603/statusinfo-getting-error-no-attribute-or-sheet-field-found-for-character-id-in-api-when-applying-markers" rel="nofollow">https://app.roll20.net/forum/post/7955603/statusinfo-getting-error-no-attribute-or-sheet-field-found-for-character-id-in-api-when-applying-markers</a>
Hey, I'm having a weird issue where TokenMod is installed, but none of the commands are working. I've removed it, readded it, etc. But still seems broken, not even the help command is showing up in chat. Was working perfectly the other week. I have no idea what's going on.
1576327018
The Aaron
Roll20 Production Team
API Scripter
Try refreshing the api and game pages. Are there any errors in the api log? In the javascript console log? Are all other scripts working? Try disabling all other scripts and see if it starts working. If it does, there is a conflict in one of the others. Are you using the 1-click version? &nbsp;If so, try manually installing it.&nbsp;
1576372848

Edited 1576372884
The Aaron, when the Custom Tokens markers are a thing. Will you be able to add it to tokenmod?
1576374530
The Aaron
Roll20 Production Team
API Scripter
Heck yeah you will! &nbsp;I've already started on the code change. I intend to have a new version that supports both the old and new way ready for the api merge Tuesday.&nbsp;
1576386646
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
My hero!
1576436087

Edited 1576436258
Danny C. said: The Aaron, when the Custom Tokens markers are a thing. Will you be able to add it to tokenmod? The Aaron said: Heck yeah you will! &nbsp;I've already started on the code change. I intend to have a new version that supports both the old and new way ready for the api merge Tuesday.&nbsp; keithcurtis said: My hero! +1 to that Finally get a chance to use Stephen Lindberg's Custom Status Markers without needing to use a complicated API!
Hey, didn't have any other scripts running and the output console seemed to be stuck (was just a single line). I went ahead and removed the script&nbsp; copied the game and reinstalled it there. Seems to be working fine now. Something must've went wobbly. Thanks for the help! :)
1576530303
The Aaron
Roll20 Production Team
API Scripter
Update 0.8.48 -- Added support for Custom Token Marker sets (Status Markers).&nbsp; (Thanks&nbsp; keithcurtis ) Available Status Markers are displayed in the help and can be used just like before.&nbsp; The only difference is that the names may not be unique (see mountains in the image).&nbsp; If there is more than one status marker with the same name, you can use the tag (the value in [ ] ): !token-mod --set statusmarkers|+mountains:3 Adds the mountains:1990 &nbsp;status marker to the selected tokens with the number 3 on it. !token-mod --set statusmarkers|+mountains::1991:3 Adds the mountains::1991 &nbsp;status marker to the selected tokens with the number 3 on it. Custom Token Marker sets are still in development, so please give this a try on Dev and see if you run into any problems. Github: <a href="https://github.com/shdwjk/Roll20API/blob/master/TokenMod/TokenMod.js" rel="nofollow">https://github.com/shdwjk/Roll20API/blob/master/TokenMod/TokenMod.js</a>
The Aaron said: Update 0.8.48 -- Added support for Custom Token Marker sets (Status Markers).&nbsp; (Thanks&nbsp; keithcurtis ) Available Status Markers are displayed in the help and can be used just like before.&nbsp; The only difference is that the names may not be unique (see mountains in the image).&nbsp; If there is more than one status marker with the same name, you can use the tag (the value in [ ] ): !token-mod --set statusmarkers|+mountains:3 Adds the mountains:1990 &nbsp;status marker to the selected tokens with the number 3 on it. !token-mod --set statusmarkers|+mountains::1991:3 Adds the mountains::1991 &nbsp;status marker to the selected tokens with the number 3 on it. Custom Token Marker sets are still in development, so please give this a try on Dev and see if you run into any problems. Github: <a href="https://github.com/shdwjk/Roll20API/blob/master/TokenMod/TokenMod.js" rel="nofollow">https://github.com/shdwjk/Roll20API/blob/master/TokenMod/TokenMod.js</a> Thanks for this, Aaron. Will this update eventually be in the one-click install?
1576627196
The Aaron
Roll20 Production Team
API Scripter
In fact, it should be there now!
The Aaron said: In fact, it should be there now! Whoo-hoo, thank you!
1578239590

Edited 1578240341
Is there a command to reveal a token's HP values to players i.e. change the HP bar setting to "Visible to everyone"?
1578247585
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
This should do it: !token-mod --on&nbsp;showplayers_bar1 Assuming you are using bar1 for HP. Adjust as needed.
1578250534
The Aaron
Roll20 Production Team
API Scripter
You can find them in the Boolean Arguments section of the help. Here are some of the ones that might interest you: showname showplayers_name showplayers_bar1 showplayers_bar2 showplayers_bar3 showplayers_aura1 showplayers_aura2 playersedit_name playersedit_bar1 playersedit_bar2 playersedit_bar3 playersedit_aura1 playersedit_aura2 You can use them as Keith showed above: !token-mod --on showplayers_bar1 showplayers_bar2 showplayers_bar3 or !token-mod {{ --on showplayers_bar1 showplayers_bar2 showplayers_bar3 }} You can also use the set command, and specify on or off: !token-mod {{ --set showplayers_bar1|on showplayers_bar2|1 showplayers_bar3|true }} Which might be useful if you find you want to toggle it with an option: !token-mod {{ --set showplayers_bar1|?{show|on|off} showplayers_bar2|?{show} showplayers_bar3|?{show} }}