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] changing token imgsrc

1385638314

Edited 1385652966
tontione
Pro
Sheet Author
Hi, this is my first script for roll20, so please tell me if i did something wrong, or if there is a better way to do it. :) It works only on dev server for the moment, as imgsrc is not available on prod server. The idea is to easily change tokens display image. It works like this : 1- create a token with the new image 2-select this token 3-click on "source" macro button to memorize the new image 4- select the tokens you want to modify 5- click on "target" marco button =&gt; the images of selected tokens change for the source one ! Macro "source" : !source Macro "target" : !target API script : <a href="https://gist.github.com/tontione/7693794" rel="nofollow">https://gist.github.com/tontione/7693794</a> Next step : make a code to change all tokens with the same image by just selecting one of them. :)
1385702674
Stephen S.
Pro
Marketplace Creator
Sheet Author
API Scripter
Is it logging gsource as expected... with log(gsource).... but "forgetting it" when you come back for it?
1385714479
tontione
Pro
Sheet Author
I'm not sure to understand your question. gXXXX vars are global vars, so memorized by the server out of call. gsource is the original imgsrc, and gsourceconv the converted src with the "thumb" version of the picture, needed to work. gsource is logged correctly, it allows you to check the original URL of the picture, the last one you selected with !source macro. If you use again !source, gsource will change for the new selected picture url. Does it answer to your question ?