Image Button?

Twine Version: 2.6.2
Story Format: Sugarcube

Good morning,

I’m new to Twine and I started a story in Sugarcube format.
I managed to find several things and my story is starting to take shape but I have a big problem…
Regarding this part that I can’t solve, my original code was:

<<button "Go Jogging">>
	<<AddHour>>  /* widget i created who add 1 hour to my time game system */
	<set $Player.Jogging +=1>
	<<script>>state.display(state.active.title, null, "back")<</script>> /* script found on the web. I understand having tested it that it refreshes my page but that's it. I do not understand anything. */
<</button>>

I thought to myself: Why not replace the text with a nice image…
I’ve been looking for several days without finding a solution without javascript because I don’t understand anything.
In desperation and having found nothing else approaching what I’m trying to do, I came to this:

My actual “Main passage” content is:

<a data-passage="Jogging">
	<img src="ressources/activity/links/jogging.jpg">
</a>

and my “Jogging passage” content is:

	<<AddHour>>
	<set $Player.Jogging +=1>
	<<goto "Main">>

I think there must be a much more suitable solution and especially without using the goto function.
In addition, this method breaks the thread of the history of history and backtracking is no longer possible.
I’m going to try to make a little RPG so I’ll have a lot of this kind of training type action to do.
I’m just trying to create a button with an image that does 2 or 3 simple actions/operations without leaving my main passage.

The solution may be very simple… Thank you in advance for your answers.
PS: I hope to make myself understood because English is not my native language and I used a translator

You can :100: change the text for an image in a button/link.

<<button'<img src="ressources/activity/links/jogging.jpg">'>> should do the trick :wink:
(sometimes it’s all a matter of changing the quote " for an apostrophe ’ or a back tick `)

1 Like

I love you Manon. (my daughter also has this name)
It works. Thank you so much

1 Like