Hello peoples!
I am using SugarCube 2.21.0, displaying images like so:
[img[image-url]]
Is there something that can make a sound play when the image is clicked?
Thank you in advance!
Patrick
Assuming you have the sound all setup up properly using <<cacheaudio>> et al, just use a <<link>> macro.
<<link [img[image-url]]>> <<audio 'track-name' play>> <</link>>
Use the <<link>> macro and just put the audio macro you need in there. Like this:
<<link [img[yourimage.jpg][PassageName]]>> <<audio "your_audio" play>> <</link>>
Don't forget to add the audio via <<cacheaudio trackId sourceList>> in StoryInit.
<<cacheaudio trackId sourceList>> in StoryInit.
Sorry I meant <<linkreplace>> - <<clickreplace>> is the sugarcube V1 version.Here is an example:
<<linkreplace "Title">><<dosomething>>Text<</linkreplace>>
Where <<dosomething>> can be replaced by any macro and "Text" by any text. "Title" will be the title of the link.
Correct. If you want the image to disappear or be replaced by another, then this is the correct solution. If you want it to remain, and be able to be clicked multiple times, use Chapel's answer.