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

1525742073

Edited 1525742302
MyRoll20Stuffs
API Scripter
Is there a variable to reference for the token's image like&nbsp;@{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&nbsp; <a href="https://wiki.roll20.net/Pathfinder_Character_Sheet" rel="nofollow">https://wiki.roll20.net/Pathfinder_Character_Sheet</a> but not seeing any references to graphics..
1525742306
The Aaron
Pro
API Scripter
Nope. API is your only option.&nbsp;
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?
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?
Resizing and uploading to library lets me do this:
1525746008
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.
1525748357
The Aaron
Pro
API Scripter
Such styling wouldn't be hard in an API, but you'd get them on a single line.&nbsp; Might be easier to get the Roll Template to restrict the size somehow.
1525757115
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.&nbsp; I really enjoy ColorEmote and have some feedback on that script for Aaron.
1525762356
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() { &nbsp; &nbsp; on('chat:message', function(msg) { &nbsp; &nbsp; &nbsp; &nbsp;if (msg.type == "api" && msg.content.indexOf("!char-pic") !== -1) { &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;var charid =msg.content.split(' ')[1]; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;var c = getObj('character',charid); &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;if(c) { &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;var fPart = "&lt;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;"; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;var Pic = fPart + "background-color:#FFF;'&gt;&lt;img src='" + c.get('avatar') + "'&gt;&lt;/div&gt;"; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;sendChat('', "/direct " + Pic); &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; } &nbsp; &nbsp; &nbsp; &nbsp;}; &nbsp; &nbsp; }); }); .
Oooo thanks for this Vince and The Aaron! This function will be incredibly useful!