0 votes
by (160 points)
reopened by
Im pretty new both to twine and to coding, but I tend to understand things rather quick.

I am using Twine 2 Harlowe 2, and am stuck on a stupid thing.

Since Harlowe does not allow any more or less reliable sidebars, Im using a header as a status bar. It will contain basic info like current status, links to detailed info and stats, and, which I find pretty important, a small image, avatar of a chosen character.

Character is chosen at the very start and remains unchanged, but the portrait may, as it indicates char's current state.

Now for the problem - how can I change the image in header, depending on the char choice? I was thinking on using setter links to set $mainAvatar to contain the html formatting, but it expectedly does no work..

So I was thinking maybe I could use some macro or command to assign certain tag (header) to precreated passage? Could not find it anywhere.

My next stop in my tries will be using a very complex if-else header system, but I am unsure how do do it correctly.

1 Answer

+1 vote
by (63.1k points)
selected by
Best answer

Tags are essentially read only, so you really aren't meant to change them dynamically. You actually can store and print html using strings, so I'm not sure why that didn't work for you. It would probably be better to use a (display:) anyway, though. For example, in your header-tagged passage: 

(display: $mainAvatar)

Where $mainAvatar holds the name of the passage containing the selected image. 

by (160 points)
Man this just make me feel so stupid that I didnt come up with the iea to dispay a passage inside passage...
Thank you so much, this suits perfectly
As for the html string, it seems I have a mistake somewhere, or just dont get it
I dont have access to my code right now, but I think I can live with that for now