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

ChangeTokenImage: Decrement Value?

Concerning the ChangeTokenImage API script , is there a way to add a decrement value? I understand decrementing as something the API coding is possibly capable of, but it's extremely way over my head to try to implement on my own. My goal is to streamline the Three Dragon Ante table I have in my game, so players can each have their own counter for being in the hole. I'm planning on making a rolling table of 101 images, numbered 0-100 set as a token on the board to represent how much in the hole they are. I'm currently utilizing --incre to tick up and --set 0 to reset the counter back to 0. However, knowing my players, they will goof this up almost immediately and the first time someone has to reset their counter to 0 and tick back up to say, 50, they'll quit the game entirely. I can usually Google around and puzzle out the solutions to my API questions, but this one is far too advanced for me! Thanks ahead of time! (Also, first time posting, I really hope I did it correctly! owo; ) —Lynn
1583205865
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Not sure about ChangeTokenImage, but TokenMod absolutely has this capability and an awful lot more. From the documentation: SideNumber This is the index of the side to show for Multi-Sided tokens. Indicies start at 1. If you have a 6-sided token, it will have indicies 1, 2, 3, 4, 5 and 6. An empty index is considered to be 1. If a token doesn't have the index specified, it isn't changed. NOTICE:  This only works for images in the User Image library. If your token has images that are stored in the Marketplace Library, they will not be selectable with this command. You can download those images and upload them to your User Image Library to use them with this. Available SideNumber Properties: currentside Setting a token to index 2: !token-mod --set currentside|2 Not specifying an index will set the index to 1, the first image: !token-mod --set currentside| You can shift the image by some amount by using  +  or  -  followed by an optional number. Moving all tokens to the next image: !token-mod --set currentside|+ Moving all tokens back 2 images: !token-mod --set currentside|-2 By default, if you go off either end of the list of images, you will wrap back around to the opposite side. If this token is showing image 3 out of 4 and this command is run, it will be on image 2: !token-mod --set currentside|+3 If you preface the command with a  ? , the index will be bounded to the number of images and not wrap. In the same scenario, this would leave the above token at image 4: !token-mod --set currentside|?+3 In the same scenario, this would leave the above token at image 1: !token-mod --set currentside|?-30 If you want to chose a random image, you can use  * . This will choose one of the valid images at random (all equally weighted): !token-mod --set currentside|*
Ah!! I have TokenMod as well and I had no idea it had this function. Just tested it and it works like a charm. Thanks so much! For the record, the macros I have are as followed, for anyone who finds this in the future: Increment: !token-mod --set currentside|+1 Decrement macro: !token-mod --set currentside|-1 Reset macro: !token-mod --set currentside|1 As a note, leaving out the numbers for decr and incr did not function, so it looks like it needs to have a number after the +/-! Thanks again for your help, you really saved me here! —Lynn