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

[Roll Templates] Image URL as a Property

Since properties don't appear to be usable inside of a tag, is there a way to query an image URL inside of a rolltemplate. &lt;img src="{{image}}" alt="image" height="42" width="auto"&gt; {{image=<a href="https://vignette.wikia.nocookie.net/moderncombatgames/images/e/ef/MC5-Frag_grenade.png/revision/latest?cb=20140625132610" rel="nofollow">https://vignette.wikia.nocookie.net/moderncombatgames/images/e/ef/MC5-Frag_grenade.png/revision/latest?cb=20140625132610</a>}} While I could use the image tag normally, I'm trying to minimize the number of templates, and was wondering if anyone knew a good alternative. This is probably beyond what rolltemplates were designed for but I'm curious what other people's solutions might be.
1515531262
Jakob
Sheet Author
API Scripter
You can include images as links via [text](url), but I'd discourage that, since you would not want the images in your roll template to be clickable. However, you can easily put multiple images into one template: {{#image-grenade}}&lt;img src="PUT GRENADE URL HERE" alt="image" height="42" width="auto"&gt;{{/image-grenade}} {{#image-knife}}&lt;img src="PUT KNIFE URL HERE" alt="image" height="42" width="auto"&gt;{{/image-knife}} You can then activate an image to be shown by supplying {{image-grenade=1}} with the roll button.
1515534011

Edited 1515534054
Awesome that works great, although I'll have to fiddle with the size more, it seems to be going beyond max height. Also, for this all-in-one &nbsp;kind of template I'm doing, there is a bit of funkiness with allProps helper function. I'm wondering how to have multiple excluded properties as the example on the documentation only shows one property "attack". What's the correct syntax for multiple properties for allProps to ignore?
1515534283
Jakob
Sheet Author
API Scripter
You should probably use CSS here (instead of the height attribute) to have more fine-tuned control over how large the image gets. Also, for this all-in-one kind of template I'm doing, there is a bit of funkiness with allProps helper function. I'm wondering how to have multiple excluded properties as the example on the documentation only shows one property "attack". What's the correct syntax for multiple properties for allProps to ignore? If I remember correctly, just separate all the properties by spaces.
1515536862

Edited 1515537605
Done did the trick, did inline styling. Here's the html and CSS <a href="https://jsfiddle.net/uqy9b08w/2/" rel="nofollow">https://jsfiddle.net/uqy9b08w/2/</a> I was having trouble using classes the style wasn't working on the template for some reason, but inline styling worked so I'm going with what I see working. sorry for the ugly code. &{template:green2}{{name=Alicrast Calmaut}}{{subhead=M9 Beretta 9mm}}{{image-pistol=1}}{{Shot=[[1d20]]}}
1515538066

Edited 1515538084
Jakob
Sheet Author
API Scripter
Glad it works! If you want to get it working via classes instead, be sure to begin the selector with .sheet-rolltemplate-NAME, so e.g. .sheet-rolltemplate-example img { /* */ } Everything that doesn't begin with .sheet-rolltemplate will be prefixed with .charsheet instead, and hence it won't apply to the roll template.
Ah, I see. Thanks for the help. Hope this is useful to anyone finding it later as well.