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

Token Image in Macros

May 08 (7 years ago)

Edited May 08 (7 years ago)
MyRoll20Stuffs
API Scripter
Is there a variable to reference for the token's image like @{selected|default_token} or something similar? Or a way to get the URL of the token so you can do:
[Default Token](@{selected|token_graphic}#.png)
SO any way to reference the token's image or the image on the character sheet that the token represents?

EDIT:
I'm looking at this https://wiki.roll20.net/Pathfinder_Character_Sheet but not seeing any references to graphics..
May 08 (7 years ago)
The Aaron
Pro
API Scripter
Nope. API is your only option. 
May 08 (7 years ago)
MyRoll20Stuffs
API Scripter
I suppose I could do it statically? Like go into the character sheet in question, right click + copy image url on bio page then use [Image](url#.png) would that work?
May 08 (7 years ago)
MyRoll20Stuffs
API Scripter
What I said results in this:

Is there a way to specify width/height or do I have to save a smaller version of the graphic to my library and go from there?
May 08 (7 years ago)
MyRoll20Stuffs
API Scripter
Resizing and uploading to library lets me do this:
May 08 (7 years ago)
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
I know it's possible via the API. The Aaron uses it for his turn tracking script. It would be nice if Roll20 had a small suite of image display macro commands, such as the ability to control max height or width, and to float left or right, but I don't know if this degree of control is possible as a standalone API. There would be a ton of uses for it.
May 08 (7 years ago)
The Aaron
Pro
API Scripter
Such styling wouldn't be hard in an API, but you'd get them on a single line.  Might be easier to get the Roll Template to restrict the size somehow.
May 08 (7 years ago)
Gold
Forum Champion
The Aaron's API script (non one-click at present) called ColorEmote can put your Portrait or your Token image into Chat in 5 different sizes.  I really enjoy ColorEmote and have some feedback on that script for Aaron.
May 08 (7 years ago)
vÍnce
Pro
Sheet Author
I'm still getting mileage from this little script Aaron made many moons ago.(shows the portrait image in chat)
//version: 1.0
//use !char-pic to show a character's portrait in chat.
on('ready', function() {
    on('chat:message', function(msg) {
       if (msg.type == "api" && msg.content.indexOf("!char-pic") !== -1) {
           var charid =msg.content.split(' ')[1];
           var c = getObj('character',charid);
           if(c) {
               var fPart = "<div style='margin-left: -20px; text-align:center; box-shadow: 2px 2px 5px #000; padding: 0px; border: 2px solid #000; border-radius:5px; overflow: hidden;";
               var Pic = fPart + "background-color:#FFF;'><img src='" + c.get('avatar') + "'></div>";
               sendChat('', "/direct " + Pic);
            }
       };
    });
});
.
May 08 (7 years ago)
MyRoll20Stuffs
API Scripter
Oooo thanks for this Vince and The Aaron! This function will be incredibly useful!