Need help for changing images [Twine Sugarcube 2.36.1]


Hi, There is a picture in the storycaption section on the left. and I want to change this image by pressing the button on the right side. Does anyone have the code and how can i use the code? Help please. Its Sugarcube 2.36.1

Hi!

What code do you currently have in the StoryCaption passage?

There are multiple ways to change the image in that block, depending on what you are trying to do. It can be done with variables, passage names or tags.

The variable option would be:

:: StoryCaption
<<if $variableImage is "this value">>
    <img>
<<elseif $variableImage is "a different value">>
   <img>
<<else>>
   <img>
<</if>>

and you could change the value of the variable inside the link (going to the next passage):

[[Next|PASSAGE NAME][$variableImage to "that value"]]
<<link [[Next|PASSAGE NAME]]>><<set $variableImage to "that value">><</link>>

Hi thank you for answer but I dont know nothing about coding

I add image using this code: img src=“URL” width=“500” height=“400”

can you write me sample code?

For example, I have an apple in my hand and this apple image appears in the StoryCaption.

I find a shovel on the ground and I pick this up.

The apple photo will disappear and be replaced by the shovel photo.
Thank you.

okay ıt workkksksss so much thanksss
I searched all over the internet but couldn’t find it thank you million timesss.

1 Like