The Add an Image, Movie, Sound Effect, or Music page of the Twine 2 Guide explains how to use a HTML audio element to play a sound file, that element can be placed within the associated hook of your example.
eg. replace the PLAY MP3 HERE in your example with an audio element like the one in the Guide's example.
You don't state if you want to play a locally stored sound file or one stored on a web-site, this can effect the URL you need to assign to the audio element's src property.
Comments
Wow, nevermind. I didn't know a simple print would work with audio...Edit: in fact it works, but only when the passage/page is loaded. I need it after check the var. Maybe jQuery?
eg. replace the PLAY MP3 HERE in your example with an audio element like the one in the Guide's example.
You don't state if you want to play a locally stored sound file or one stored on a web-site, this can effect the URL you need to assign to the audio element's src property.
What I wrote before:
It works, but only when the passage is loaded. I need to recheck it if the var changes, so when I try:
...inside a live macro, nothing happens.