Help with resizing replaceable images

Twine Version: Harlowe 3.3.8

So, in my twine game thing I want to make it so that when you press an image, it replaces that image with a different one, similar to how you can replace links with text using (link-replace:) . I have the code done, but the only problem is that I can’t resize the first image. It keeps saying “‘height=’ isn’t a valid Harlowe syntax for the inside of a macro call” (???)
Here’s my code:

(link: "<img src='https://i.imgur.com/Od2NSR9.png'"width="200px" height="200px">)[(link-replace: "<img src='https://i.imgur.com/gDV16oQ.png'"width="200px" height="200px">]

im making a game about bees
It works for the second one because it’s in a [ ] but not the first one because it’s a ( )

1 Like

I think the error you got was because of missing or misplaced punctuation marks!

Once I fixed those, it stopped giving me that error, but it gave me another error regarding the use of (link-replace:) and (link:) – basically, trying to use those macros without their own hook [ ] to attach to causes them to fail.

If we only use one macro before the hook, it seems to accomplish what you want:

(link-replace: "<img src='https://i.imgur.com/gDV16oQ.png' width='200px' height='200px'>")[<img src='https://i.imgur.com/Od2NSR9.png' width='200px' height='200px'>]

(I’m not sure if I put the pictures the right way, though!)

1 Like

Thanks so much!! Totally worked : D

1 Like