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 .
×
Advertisement Create a free account

[Script Update] TokenMod -- An interface to adjusting properties of a token from a macro or the chat area.

1556054689
Looks like Roll20 just added numerical text to tokens by default.... Any change there will be a tokenmod update to help us deal with this annoyance.  I use token mode to auto set features on the token, etc.  
1556057072

Edited 1556058506
Agree.&nbsp; They should have provided us a means of turning this 'feature' off in the settings They did.&nbsp; But the default setting should be off.&nbsp; <a href="https://app.roll20.net/forum/post/7396014/token-bar-redesign-bug-thread" rel="nofollow">https://app.roll20.net/forum/post/7396014/token-bar-redesign-bug-thread</a> Also, now the statusmarker and bottom bar combined make seeing the token art impossible at certain sizes.&nbsp; Why Roll20, why? TetNak said: Looks like Roll20 just added numerical text to tokens by default.... Any change there will be a tokenmod update to help us deal with this annoyance.&nbsp; I use token mode to auto set features on the token, etc.&nbsp;&nbsp;
1556065059
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Wolf Thunderspirit said: Agree.&nbsp; They should have provided us a means of turning this 'feature' off in the settings They did.&nbsp; But the default setting should be off.&nbsp; <a href="https://app.roll20.net/forum/post/7396014/token-bar-redesign-bug-thread" rel="nofollow">https://app.roll20.net/forum/post/7396014/token-bar-redesign-bug-thread</a> Also, now the statusmarker and bottom bar combined make seeing the token art impossible at certain sizes.&nbsp; Why Roll20, why? TetNak said: Looks like Roll20 just added numerical text to tokens by default.... Any change there will be a tokenmod update to help us deal with this annoyance.&nbsp; I use token mode to auto set features on the token, etc.&nbsp;&nbsp; You can turn off the numbers in the game settings page. I have not yet heard if the settings are reachable by API.
1556067290
The Aaron
Forum Champion
API Scripter
I asked about API access to the setting but haven’t heard back yet.&nbsp;
1556070818

Edited 1556071065
keithcurtis said: Wolf Thunderspirit said: Agree.&nbsp; They should have provided us a means of turning this 'feature' off in the settings They did.&nbsp; But the default setting should be off.&nbsp; <a href="https://app.roll20.net/forum/post/7396014/token-bar-redesign-bug-thread" rel="nofollow">https://app.roll20.net/forum/post/7396014/token-bar-redesign-bug-thread</a> Also, now the statusmarker and bottom bar combined make seeing the token art impossible at certain sizes.&nbsp; Why Roll20, why? TetNak said: Looks like Roll20 just added numerical text to tokens by default.... Any change there will be a tokenmod update to help us deal with this annoyance.&nbsp; I use token mode to auto set features on the token, etc.&nbsp;&nbsp; You can turn off the numbers in the game settings page. I have not yet heard if the settings are reachable by API Thanks.&nbsp; Learn something new every day. EDIT: Doesn't seem to work on tokens that have already been built.&nbsp; Those you have to tackle manually.&nbsp; ::facepalm::
1556072938
The Aaron
Forum Champion
API Scripter
You can apply the defaults to all tokens on the settings page in game, at the bottom in Experimental Features:
1556073134
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
TetNak said: keithcurtis said: Wolf Thunderspirit said: Agree.&nbsp; They should have provided us a means of turning this 'feature' off in the settings They did.&nbsp; But the default setting should be off.&nbsp; <a href="https://app.roll20.net/forum/post/7396014/token-bar-redesign-bug-thread" rel="nofollow">https://app.roll20.net/forum/post/7396014/token-bar-redesign-bug-thread</a> Also, now the statusmarker and bottom bar combined make seeing the token art impossible at certain sizes.&nbsp; Why Roll20, why? TetNak said: Looks like Roll20 just added numerical text to tokens by default.... Any change there will be a tokenmod update to help us deal with this annoyance.&nbsp; I use token mode to auto set features on the token, etc.&nbsp;&nbsp; You can turn off the numbers in the game settings page. I have not yet heard if the settings are reachable by API Thanks.&nbsp; Learn something new every day. EDIT: Doesn't seem to work on tokens that have already been built.&nbsp; Those you have to tackle manually.&nbsp; ::facepalm:: Take a look at this post . You should be able to change all of your existing content without having to do it all manually.
1556083479
Yeah.&nbsp; Thanks.&nbsp; I found it.&nbsp; Still though, not helpful for tokens not deployed.&nbsp;&nbsp;
1556101492
The Aaron
Forum Champion
API Scripter
Those should get the defaults applied when you drop them on the map. Is that not happening? You might need to take this to the feedback thread.&nbsp;
1556102272
The Aaron
Forum Champion
API Scripter
Looks like this has been reported as a bug:&nbsp; <a href="https://app.roll20.net/forum/post/7396014/token-bar-redesign-bug-thread/?pageforid=7397779#post-7397779" rel="nofollow">https://app.roll20.net/forum/post/7396014/token-bar-redesign-bug-thread/?pageforid=7397779#post-7397779</a>
1556112277
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
TetNak said: Yeah.&nbsp; Thanks.&nbsp; I found it.&nbsp; Still though, not helpful for tokens not deployed.&nbsp;&nbsp; Well, shoot. You're right. :/ I didn't drag out new tokens after testing, just checked those in play. I had assumed that it would get all default tokens as well as those deployed.
1556115647
Yeah.&nbsp; It says it is working on all of them (by the # of tokens it reports), but when you drag out new tokens it doesn't work.&nbsp;&nbsp;
I posted this as a question as a new thread, but it may have been more sensible to mention it here: <a href="https://app.roll20.net/forum/permalink/7412194/" rel="nofollow">https://app.roll20.net/forum/permalink/7412194/</a> Sorry!
1556664319
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
No API access to the new features... yet. It has been requested.
1556732436

Edited 1556732461
trying !token-mod --set defaulttoken&nbsp; to save the new bar location but it does not seem to be working. Maybe I am doing something wrong? I click the token. I type "!token-mod --set defaulttoken" but no effect. I checked and other functions are working (such as setting a dot on the token. I confirmed the token has "Represents Character" set. I have tried with multiple tokens. Any idea what I may have wrong.
1556733178
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
The new token settings do not have API hooks yet. I just tested and setting the default token with token mod does not save the new settings, whereas the manual method does. API access has been requested, we may have to wait.
1556735114
The Aaron
Forum Champion
API Scripter
Oh! &nbsp;There's a good distinction to make there with the API. Setting default token is a function call in the API, do it has a bug where it doesn't save that data which is separate from allowing the API scripts to set it.&nbsp;
1557337434
Is there a way to set a Token Name to its Token Name + %%NUMBERED%% using a macro? So far I've tried variations of !token-mod --set name|npc_name "%%NUMBERED%%" Without success. Many thanks
1557338820
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Try: !token-mod --set name|"@{selected|npc_name} %%NUMBERED%%"
1557544881
Beautiful. Thank you.
1557685048
Elemental Flame
Pro
Marketplace Creator
I apologize if this was brought up before, but I did a quick search and didn't see anything. I just spent more time than I would like to admit troubleshooting an issue I was having. I often transmogrify a page to another game then back to copy the tokens, dynamic lighting, etc. I was attempting to TokenMod some tokens to flip shownames on a page I had copied back into my game last night and it wasn't working. I thought the API had died and kept restarting my sandbox to no avail. I couldn't run any of my usual TokenMod macros on tokens I had copied back. I dragged a new token onto the board and TokenMod worked so I chalked it up as not working on transmogrified tokens. It's a small price to pay, but no biggie. I went back to the original page though and found a number of tokens with shownames off. A few tries and I confirmed that my TokenMod changes on my copied page weren't updating there but were changing tokens on the original page. This isn't a complaint and I wouldn't say it's a problem with the script since Transmogrifier is experimental anyway. I did want to post it to maybe save some time for anyone out there like me who didn't know what was up. :)
1557685421
The Aaron
Forum Champion
API Scripter
So, this is a bug in Roll20 that I have brought up with the developers DIRECTLY many times.&nbsp; Token IDs (all IDs, really) are Unique across the game.&nbsp; When you drag in a new copy of a token for a creature, it has a new ID.&nbsp; This is absolutely a written rule and the way things always work... ...except that if you transmogrify a map out of the game, rename it, and transmogrify it back, all the tokens retain the same Token ID.&nbsp; This causes the scripts to be unable to identify the correct token, and so anywhere you specify a token id, it will find the earliest instance of that token id and change it.&nbsp; There isn't really a way to get around this other than re dragging in all the tokens again.&nbsp; I might be able to do some hackery with the current page id of the person executing the command to force it to find the ones on the current page, but I'll have to look (Honestly, this comes up so rarely that I haven't had that thought until just now.).
1557688965
Elemental Flame
Pro
Marketplace Creator
I doubt it's even worth the time to fix if I'm the first person mentioning it, lol. I wouldn't expect you to try to find a work around for an experimental feature -- I just wanted to save time for people who might run into it. Knowing this, I'll copy and paste tokens from the original page. Most times that's not a huge issue, this just happened to be a large map with 50+ character tokens so I was taking shortcuts, lol.
1557690055
The Aaron
Forum Champion
API Scripter
You're not the only one, it's just a rare enough occurrence that it's hard to find information on it, so I'm glad you posted.&nbsp; I messaged the devs again just to keep it on the radar. As you say, possibly the easiest thing to do is to delete all the things on the token and GM layers, then select them all on the source page and paste them on the new one.&nbsp; Sometimes it can help to add a token snapped in the top left corner and one in the bottom right corner to make alignment easier when you copy paste.&nbsp; Note that, if you left click a spot before hitting the paste shortcut, it will center the pasted content at that point.
1557708839
Elemental Flame
Pro
Marketplace Creator
Boy does this community come up with some brilliant work-arounds... that's a solid tip, thanks!
1557709482
The Aaron
Forum Champion
API Scripter
No worries! &nbsp;I've spent a few hours in game. =D
Heck, he's even spent at least 10 minutes in mine ;-) lol The Aaron said: No worries! &nbsp;I've spent a few hours in game. =D
1557762399
Is there a way to Copy a token, in preparation for Pasting, using a script? I am trying to create a way to drag a monster onto the table, click a button, and have it renamed, copied and then hidden away on the DM layer, all in prep for Pasting. I have this: __________________________________________________________ !token-mod --set name|"@{selected|npc_name} %%NUMBERED%%" !duplicate @{selected|token_id} !token-mod --set layer|gmlayer ___________________________________________________________ But the Duplicate is either not working, or I'm doing it wrong... In either case, there is nothing to Paste when I run this on a selected token. Many thanks.
1557763555
The Aaron
Forum Champion
API Scripter
I have no idea about the !duplicate command.&nbsp; If I had to guess, I'd say the token is coming from the Marketplace and not a User Library, so the script is failing to create the copy.&nbsp; Even if the duplicate does work, you might have issues with the token not being selected for the second TokenMod command.
1557764042
Alright. Many thanks. Is there any way of making a Copy command with script, just to test? Thanks again.
1557766044
The Aaron
Forum Champion
API Scripter
There isn't a way to access the ctrl-c/cmd-c copy on the client side from the API.&nbsp; The best the API can do is create a new graphic with the same settings as another graphic.&nbsp; That will behaving like a copy (which is what that !duplicate command does, if it's a real script and not an example), but it can not create a graphic with a Marketplace image, only user images.
1557766362
Ok.&nbsp; Many thanks for all your help.
1559339160

Edited 1559339404
Lex
Pro
I have a small snippet I use when I make a new token. First I drag the image, then open the Edit Token and set it to the right Represents Character e.g. a Guard, then Save Changes. And then I use this small snippet: !token-mod {{ --set width|70 height|70 bar3_link| bar2_link| bar1_link| bar1|@{selected|npc_hpbase} bar2_value|@{selected|npc_ac} bar3_value|@{selected|passive_wisdom} showname|yes showplayers_name|no }} My issue is I can't figure out why but when I use that, it removes the Represents Character from being a Guard, and removes the name! Seems like it's a bug because afaik it should not be removing that from the Token.
1559340006
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
I would suggest adding in the last command of "defaulttoken". No idea why it is removing the name. Does it remove it immediately, or only when your draw it again from the journal tab?
1559340203
Lex
Pro
It removes it immediately. I don't want to change the defaulttoken. I use the snippet to make custom one-off tokens of generic characters in my library.
1559342855
The Aaron
Forum Champion
API Scripter
hmm.. What other scripts are you running, if any?
1559342912
The Aaron
Forum Champion
API Scripter
I just tried that command and didn't have the issues you described.&nbsp; What version of TokenMod?
1559345769
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
You could also try it the other way around. Drag out the generic token you want to use and while it's selected, target the art you want it to have as an image. Roughly the same amount of steps, but fewer "moving parts". This also has the benefit of maintaining any settings that token mod is locked out of at the moment, like bar position and size: !token-mod --set imgsrc|@{target|token_id} --ids @{selected|token_id}
1559358935

Edited 1559358983
Lex
Pro
Thank you for the help. It seems to only happen in Chrome where I have VTT Enhancement and the 5e userscript, and not in Firefox where I don't have those. So whatever the issue, it's on my end. I managed to come up with a workaround by adding this to the macro: name|"@{selected|npc_name}" represents|"@{selected|npc_name}"
1559389478
The Aaron
Forum Champion
API Scripter
Great! &nbsp;Check the settings on the extension, there might be something you can turn off.&nbsp;
Is it possible to use a target and have a selected token in the same macro?&nbsp; My token gets deselected when targeting, then the selected part doesn't work.&nbsp; In this game I'm a player without access to ids
1560285006
The Aaron
Forum Champion
API Scripter
It isn't, there's a long time bug with Roll20 that forces the selected token information to not get passed to the api when @{target} is used.&nbsp;
1560286112

Edited 1560286271
I figured that was the problem.&nbsp; I can use a target to print their name, but can target myself to change bar1_value without --ids? Here's what I'm trying to do.&nbsp; The message displays just fine, but I can't figure out how to use tokenmod to change my token's bar1_value. !token-mod --set bar1_value|-1 &amp;{template:default} {{name=@{Target|character_name} is inspired!}} {{Add 1d6 to one ability check, attack roll, or saving throw.&nbsp; You can do this after you make the roll, but before you know if it succeeds or fails.}}
1560289945

Edited 1560355418
Mark B. said: I figured that was the problem.&nbsp; I can use a target to print their name, but can target myself to change bar1_value without --ids? Here's what I'm trying to do.&nbsp; The message displays just fine, but I can't figure out how to use tokenmod to change my token's bar1_value. !token-mod --set bar1_value|-1 &amp;{template:default} {{name=@{Target|character_name} is inspired!}} {{Add 1d6 to one ability check, attack roll, or saving throw.&nbsp; You can do this after you make the roll, but before you know if it succeeds or fails.}} try replacing "target" with "selected" if it's a character you can control.&nbsp; ex: {{name=@{Target|character_name} is inspired!}} becomes {{name=@{selected|character_name} is inspired!}} also, using the @{selected|character_id} behind --ids in tokenmod works real well
The target is not a character I can control.&nbsp; However, the DM is going to turn on player-can-ids, so problem solved! :D
1560300256
The Aaron
Forum Champion
API Scripter
Oh good!&nbsp; I'm going to make a few updates to that permission system, but now I can delay that a bit in favor of other things.&nbsp; I have the functions to make it easy to tell if a player controls a token, so I'll set it up to let anyone use --ids for tokens they control, and add options for player controlled tokens and any token.&nbsp;&nbsp;
Mark B. said: The target is not a character I can control.&nbsp; However, the DM is going to turn on player-can-ids, so problem solved! :D Your DM is very trusting of you ;-) You could make all sorts of manipulations to both other people's tokens and npc tokens with that turned on.&nbsp; Practice your "Muhahahaha!" evil laugh till he does so, twirl the mustache, and rub your hands together maniacally.&nbsp; lol
1560355860

Edited 1560355879
The Aaron
Forum Champion
API Scripter
I use that super power in the game I play in to fix things for the GM. =D ( ...and subtly rename the other players' tokens... =D )
1560360142
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
We have enough issues come up during the course of any game, that any player who tried intentional shenanigans would have the others fall on him like a "ton of rectangular building things".