Character Vault
Any Concept / Any System
Compendium
Your System Come To Life
Roll20 for Android
Streamlined for your Tablet
Roll20 for iPad
Streamlined for your Tablet

Personal tools

Script:Change Token Image

From Roll20 Wiki

Revision as of 17:32, 26 March 2018 by Andreas J. (Talk | contribs)

Jump to: navigation, search

This script allows a user to change the image a token uses for display quickly without having to use the token context menu and submenus and popups.

Source: Github

The token should be from a Rollable Table. Due to Roll20 limitations as of 11/9/2015, it only works if the images in the Rollable Table are in your library. This is supposed to be fixed soon. (For me, it works even if, when searching, all I do is hit the star button to the upper right of an image, that is enough to place it in my library.)

The script will allow you to flip between two images (for rollable tables of 2 images), or increment from the first to the last image in the rollable table, then wrap around to the first, or allow you to pick the exact image you want by specifying its place in the index (starting with 0). If you select multiple tokens, the script assumes all tokens have the same images and are based on the same rollable table. If not, there is a switch you can use to tell it to not make this assumption.

If the script encounters an error, it will print the error to the chat window. Usually this will be index out of range or something, though friendlier such as "Token <name> has only <n> sides!"

This script changes the currentSide, and imgsrc attributes.

I made this to quickly change the appearance of tokens such as from live to dead (or appearing dead to undead), etc.

Choices include:

!change-token-img

Choose only one of the following:

  • --flip Change between the 0 and 1 image in the rollable table.
  • --incr Increment the displayed image index up until the last image, then sets index back to 0 (so it loops)
  • --set n Sets the chosen index to n.

Also:

  • --notsame If multiple are selected, use notsame to tell the script that each token has a different rollable table. Otherwise, to save time, the script assumes they are all the same so the images can be updated quicker.