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 .
×
Pre-order D&D 2024 now and get an exclusive bonus, only on Roll20!
Create a free account

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

1717637356
The Aaron
Roll20 Production Team
API Scripter
I can't imagine how TokenMod could affect that.  It doesn't have any events for `add:graphic` so should not become active in those cases.
Jarren said: This is a current known bug, reported here . I suggest adding your comment there to see if others also have some resolution if they disable TokenMod, and if that's the case then I'm sure TheAaron will start taking a look right away! :)  You can also  file a  Help Center Request  to get more visibility on the issue. Thanks for the heads up i'll look into it there than.
1718211071

Edited 1718300260
Playing D&D 5e using the  D&D 5E for Roll20  character sheet. When I use the following macro to set a token's vision, the night vision color becomes set to black (#000000) instead of "transparent" as designated in the macro: !token-mod {{ --set bright_vision|on night_vision|on night_vision_distance|60 night_vision_effect|nocturnal night_vision_color|transparent has_directional_bright_light|off directional_bright_light_center|360 directional_bright_light_total|0 light_color|transparent }} Here is a screen shot of the token settings after using this macro: EDIT: I got the color setting to change correctly by adding the following to the macro before the final "}}": --ignore-selected --ids @{target|Target 1|token_id} The annoying consequence of this is that I now can't select multiple tokens when applying these vision settings. I have two PCs who have items that give them darkvision; I use this macro when they activate those items.
1718300740

Edited 1718300784
Hi there I wasn't sure where to post this (and it could possibly be a bug with a jumpgate update itself). I GMed a game yesterday where one of my players were perfectly able to use the currentside property to switch sides of their token. I have come on today to make changes to the macro that does this (the character can now change sizes so was adding that into the macro). I have found that the currentside property no longer is working. I have created multiple new multisided tokens, wrote the command directly into chat while token selected, but there is nothing happening. The rest of the tokenmod commands work perfectly (the resizing, adding of status marker, moving) just not the currentside. Trying in a non-jumpfgate game it works perfectly which is why i think it is a jumpgate centric problem but thought I would ask/make it known here. I wonder if they have broken multisided tokens.
RPGMer said: I have found that the currentside property no longer is working. I have created multiple new multisided tokens, wrote the command directly into chat while token selected, but there is nothing happening.  What is the macro code you are using?
Apologies, I wrote all that and forgot to include the actual macro; !token-mod --set currentside|2 !modbattr --sel  --silent --other_resource|-1 /w gm Number of shifts left: [[@{other_resource}-1]] I have it set as a token action to make sure they have the token selected when performing the macro. I have it on another token that also and that doesn't work either. All i can conclude is that they did something in the latest jumpgate update that effected multi-sided tokens
1718406149
The Aaron
Roll20 Production Team
API Scripter
One thing to check is if the images you are using in the sides are in the user library or marketplace.  The production API can't set marketplace images at all, even by setting the current side.
They are both images I've uploaded myself. It was working perfectly when we played on Tuesday but then when I was testing the changes to the macros on Wednesday it no longer switched.
Hi scripters, is there a way to use TokenMod (and potentially other scripts) to do this: Select some tokens Set the color dot status marker (say purple) for each token with ascending number 1, 2, 3 ... Something like below but 1 goes to 2 for the next token, 3 the next token, and so on --set statusmarkers|purple:1 I'm not too bothered if the method runs out of numbers after 9, would be nice if it can cycle through colours but 9 numbers is usually plenty. The intent is to quickly and easily number any tokens. I know about TokenNameNumber but wanting a way that doesn't require the token names to be set with the placeholder. Something that will work with any token with minimal setup.
I don't have a specific solution that matches what you are looking for, but there are two other options that may satisfy you: Create a single macro that will number all selected tokens without any previous setup .  Just select a group of tokens and run this command (I have it saved as a Collections Macro called 'RenumberTokens': !token-mod --set name|"?{New Token Name?|@{selected|token_name}} %%NUMBERED%%" !tnn --renumber Yes, it will still add numbers to the tokens, but it satisfies your intent to quickly and easily number any tokens and doesn't require  having their default token set with %%NUMBERED%%. You can also turn on the Colored Dots option with TokenNameNumber . Just use the TNN command '!tnn-config --toggle-use-dots' and each token will get a unique set of colored dots.  You can configure which dots to use (or not use) in the config menu as well, so if you use a red dot for some specific other meaning, then you can exclude it from being used for TNN. In terms of giving each token a unique number on a colored dot, that should be possible.  FlyMore can add numbers to colored dots (or custom status markers), so you'd just need a way to add logic for randomizing the number and making it unique on each token. I believe some combination of the Metascripts  can do this.
1719584439

Edited 1719584618
timmaugh
Pro
API Scripter
Here is how to do that with the Metascript Toolbox in combination with TokenMod: !forselected(^) token-mod --set statusmarkers|-purple[]|-purple[]|{^&if {&i+1} > 9}purple[]:{^&math floor({&i+1} / 10)}|{&end}purple[]:{^&math {&i+1} % 10} That will first remove all purple markers from each token (it should only take one instance of  -purple[]  to remove all purple markers, but it isn't working for me, for whatever reason -- I've reached out to Aaron for some help on that). For now, the above command is set up to work from 1-99, so I only have to remove up to 2 purple markers, anyway. Then it uses the forselected index tag {&i} to know what number of token it is working with (it counts up with every new token selected and worked on). I add 1 to the base: {&i + 1}  ...so that we start at 1 rather than 0. After that, it's just math... if we're over 9, we'll need a tens digit, so we extract that... then the ones digit is just {&i} modulo 10. As an Added Trick... For my set up, I used a similar command to first name my tokens (though this could be combined with the TokenMod line, above). I manually selected them on the VTT and ran: !forselected token-mod --set name|Obelisk{&i+1} That gave me tokens named Obelisk1, Obelisk2, etc. From then on, when I want to select those tokens as a group, I don't have to physically select them on the VTT... I can use: {&select Obelisk*} ...and they will become the selected tokens for the purposes of the message. So I can add that {&select} tag to the first command and arrive at: !forselected(^) token-mod --set statusmarkers|-purple[]|-purple[]|{^&if {&i+1} > 9}purple[]:{^&math floor({&i+1} / 10)}|{&end}purple[]:{^&math {&i+1} % 10} {&select Obelisk*} Then I don't have to actually select the tokens on the VTT. EDIT : The above could easily be expanded to accommodate orders of magnitude... so up to 999 tokens, or up to 9999 tokens... but... what kind of masochist do you want to be? I always say, "Set your sights high," but... I mean... damn. =D
Reposting this because it must have got missed in the flurry of other posts :) Playing D&D 5e using the  D&D 5E for Roll20  character sheet. When I use the following macro to set a token's vision, the night vision color becomes set to black (#000000) instead of "transparent" as designated in the macro: !token-mod {{ --set bright_vision|on night_vision|on night_vision_distance|60 night_vision_effect|nocturnal night_vision_color|transparent has_directional_bright_light|off directional_bright_light_center|360 directional_bright_light_total|0 light_color|transparent }} The work-around that I mentioned in my previous post (adding  --ignore-selected and  --ids @{target|Target 1|token_id}) stopped working after the first day for some reason. Yes, I tried clearing cache, logging out then back in and  re-starting, and also in incognito mode. This also happens when I use Firefox instead of Chrome. This may have something to do with the color for night vision always defaults to black    (#000000), no matter what I set up under the game settings (yes, I've sent in a bug report about that weeks ago, and they've been 'looking into it')
Thanks Jarren and Timmaugh, both of your methods work as advertised. Will play around with both to see which one suits the group best.