Proposal: (img:) macro for simplified inclusion of images
At present, the only way to include images in a Harlowe game is using the standard HTML <img>
tag (or through CSS classes, which amounts to much of the same thing). This makes it slightly tricky to use images dynamically, placing them within variables/arrays to be called on later, for things like tokens, icons, and so on. It's not impossible, of course, but users without much grounding in HTML are going to find it tricky.
So my suggestion is the (img:)
macro, which could be structured something like (img: String)
where the string is the filename (similar to how (bg:)
does it). So (img: "icon.png")
would find the file named "icon.png" in the same folder as the published file and display it.
This way, users could not only write a section of text like This creature looks (img: "DangerSign.png") **DANGEROUS** to you!
(creating something that looks like "This creature looks (set: $diceFaces to (a: (img: "dice_1.png"), (img: "dice_2.png"), ...))
or (icon-undo: (img: undo.png))
and so on.
There are some additional thoughts about this that came to mind, such as perhaps having an additional optional string for defining the image in one of several pre-set, built-in styles, such as "icon" for an inline image that takes its size from the line-height value, useful for highlighting keywords (or as it might look, (box:)
.