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

Using An Image as A Macro Button

Question I'm Looking To See if there is a way by which I can Nest a macro to re cast for example magic Missile and use an image in place of a line of text for the macros button for example in stead of pressing the Next Missile button I'd like to Use the Magic missile Icon To Cast the Second and Third Missiles. I've tried to use HTML code to replace the Bracket and such but that just scrambles the macro. any help Is Appreciated. Thank You Kindly. 
1575333632

Edited 1575333673
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
I think the syntax for displaying an image makes doing this without resorting to API, a custom roll template added to the sheet code, or the html editing you've tried, impossible. [[image](imageurl)](macroname) would be the syntax, and I don't think that kind of nesting would work. You can use emojis for the button name—that even works in the macro and token action bar—but if anyone figures out an easy way to do this, I'd be deeply impressed.
1575356939
Mike deBoston
Compendium Curator
You can do this with a little homework and the Stylus browser extension. Here I created a custom icon for sword attacks and a different one for spell attacks. I just grabbed the first photo I could find on Imgur and the first background color that came to mind... These are ugly, I know. Before, pink macro buttons After, ugly images from Imgur Right click on the button, select "copy link location", and you'll get something like: ```<a href="https://app.roll20.net/editor/~-LYx8dU98jTUzbMv99io|repeating_spells_-lf77ecpx2zqp6tiuofh_spelldmg```" rel="nofollow">https://app.roll20.net/editor/~-LYx8dU98jTUzbMv99io|repeating_spells_-lf77ecpx2zqp6tiuofh_spelldmg```</a> Then I configured the CSS to look for "spelldmg", the text at the end of the link. It will be different for different character sheets. Here's the code that worked for this example: @-moz-document url-prefix("<a href="https://app.roll20.net/editor/" rel="nofollow">https://app.roll20.net/editor/</a>") { /* weapon damage */ div.sheet-templateButton a[href$="dmg"] { display: inline-block !important; width: 100px; padding-left: 60px; height: 50px; background-color: green !important; background-image: url(<a href="https://i.imgur.com/xjqO9eW.jpg" rel="nofollow">https://i.imgur.com/xjqO9eW.jpg</a>) !important; background-size: 50px 50px; background-repeat: no-repeat; } /* spell damage */ div.sheet-templateButton a[href$="spelldmg"] { display: inline-block !important; width: 100px; padding-left: 60px; height: 50px; background-color: blue !important; background-image: url(<a href="https://i.imgur.com/Z7pqhNN.jpg" rel="nofollow">https://i.imgur.com/Z7pqhNN.jpg</a>) !important; background-size: 50px 50px; background-repeat: no-repeat; } } This isn't really a ready-to-use solution, but it's a template you can customize. Let me know if you have questions.
1575358729
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
That's pretty clever. You'd need all players to install the style, but cool.
1575366346
Mike deBoston
Compendium Curator
Sure, but at this point there's about a half-dozen really solid reasons to install the add-on, and after that installing each style is just a click. Useful subset of State icons Compact Token Macro bar Compact Macro bar Compact Combat Turn tracker Inline lines for roll templates That's a decent amount of screen real estate to recapture.
1575367281
GiGs
Pro
Sheet Author
API Scripter
Still, asking all players to install the add-on is still a bit of an ask. A lot of people dont like to use extensions, some players arent technically proficient enough to be comfortable using addons that require you to install extra bits, and some just wont to install this particular kind of extension. I always feel a little awkward when seeing solutions posted for a group using stylus, because I know they just aren't going to work for a lot of groups (I wont use them in my games, for instance).&nbsp; I'm not saying such solutions shouldnt be made - I'm sure they are great solutions for some groups, and they have the advantage of not needing the API. I'm just saying Keith's point is not a trivial concern, and stylus shouldnt be assumed to be an easy solution that will work for everyone.&nbsp;
1575386628
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
That was indeed my concern. I will point out however, that I had a Roll20 training session with my players instead of our regular game night. We did a lot of screen sharing. As soon as they saw the way my styled Roll templates looked, along with some other elements, they all wanted them. Since stylus is a browser extension, I could email them the link, and also emailed them the styles. Stylus's Import/Export made that pretty simple.
1575407216
Mike deBoston
Compendium Curator
Sure, I'd prefer these things to be built into Roll20, but I don't think these cosmetic features (smaller list of State icons, custom icons (not unicode) for the Macro bar, etc.) are going to be official features for a long time. I guess I see it as a smaller ask (for a non-technical regular group) than asking them to buy a Pro account, find APIs, and modify or extend that script, and ultimately have probably about the same level of risk of being unsupported or broken by a Roll20 change in the future. And generally, I'd rather say "Yes and here's the cost" than "no".
1575407920
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Absolutely. It was a good suggestion. Just pointing out the caveats for those unfamiliar with Stylus.