Most reliable way to make theme music work in Sugarcube?

Twine Version: Sugarcube
Story Format: 2.3.14

I have theme music for my game. I’ve followed the advice to start the music on the game’s second passage, but I find that even then it only plays when I open the game file directly from where it’s saved on my computer - not when I test the game in Twine, or upload it to itch.io (or IFComp). Any suggestions?

I’ve used in my StoryInit:


<<cacheaudio "thememusic" "music/PQthememusic.mp3">>

And in the story passage:


<<audio thememusic play loop>>

Thanks in advance!

When I’ve done this, the music doesn’t play when you test the story in Twine. You have to publish to an HTML file to get the music to play.

But it should play when you upload it to itch.io. I’m assuming you’re uploading a full Zip file, which has the music in the right subfolder? Just as a test, have you tried putting the mp3 in the same folder as the HTML, rather than in a subfolder?

Ah, I wasn’t uploading a zip file, just the game file. That explains it.

Now I’ve uploaded a zip file containing all my game files (I think), but the game doesn’t run at all on itch.io now :frowning:

This is my zip file:

I’ve never created a zip file before so I’m probably doing something wrong… any ideas?

I think it will try to run index.html, but it looks as though that’s an empty file (size 0Mb).

Is The Princess of Vestria.html your main game file? What happens if you rename that to index.html, then recreate the Zip file and upload it? My guess is that that’s the problem.

1 Like

Thanks, yes that has sorted it :pray:

1 Like

Oh great!

So The Princess of Vestria has theme music now?

(I would have probably written you some theme music but it sounds as if you have some!)

It always did, it just wasn’t playing because I didn’t include it in the file upload :laughing: I got a music student at the local university to make it as a project for her course. Was impressed by the job she did.

Thanks, that’s a very kind offer though. I’m open to collaborations in the future!

2 Likes