Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

[Twine 2.x] [sugercube 2.x] Possible to have Images display depending on how a passage is tagged?

Just as an idea. I write a passage. tag it as 'home.jpeg' the thing looks in a predefined directory for 'home.jpeg' or 'thing.png'. I would like t obe able to do something like

Tag: Background:thing.png' and that image is the background image for say 'person.png' or 'object.png' to layer on top of. or for the layers 'RIGHT:person.png' or 'CENTER:person2.png' for positioning.

That way i can have it so there's a dedicated space above the writing for 'things' to help flesh out the writing. Would be kinda neat if variables existed so 'person' could be replaced by 'worried person' or 'angry person' or the like.

Tie that into an RPG random battle system so you can have each encounter have it's own visable enemy clusters, background, and enemies change/react as they get hurt/stunned/charmed/etc.

How hard would this be to do and at the same time if no tags exist you just get a plain text page?


  • You can access a list of the current passage's tags via the tags() story function, you could process that list within one of the Task Objects like predisplay or within a special passage like PassageReady and depending on which of the previous methods you chose you could use either Javascript or DOM Content macros like <<replace>> to insert the images into their relevant places in your HTML structure.
Sign In or Register to comment.