Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Twine 2.0.8, SugarCube 1.0.26: Cannot Add Audio!

Hey there guys, so I have tried countless things, tried default macros and nothing is working for me... I just want to be able to play music(loops) and sound effects(nonloops), but for some reason NOTHING is working.. This is the setup I have(all in the StoryInit Passage):

<<cacheaudio track_id source_list>>
<<cacheaudio "BGMDanger" "media/audio/danger.mp3">>
<<audio track_id action_list>>
<<audio "BGMDanger" play>>

So basically the regular macros, I always get an error saying:

Error [StoryInit]: <<audio>>:no track by ID: track_id

I want people to be able to download my game and play it offline or online, so I have the game file and a folder called:
media, then audio, then I have my music in there, called: danger.mp3

Any thoughts on how I can get my audio to work?? <3

Comments

  • edited August 2015
    Yiou shouldn't be writing
    <<cacheaudio track_id source_list>>
    
    <<audio track_id action_list>>
    

    In your storyinit passage. That's just an example of the format. You're getting further errors because you also don't have quotation marks around it, so you're confusing everything that comes next, since you're opening the macro but never closing it.

    Just delete those lines.

    Also, don't put <<audio play>> macros in StoryInit. If you want something to be playing at the start, put it in the Start passage.
  • Okay, I deleted the 2 example formats, and put the other 2 in my first passage, but still no audio D;
  • Also when I put "media/audio/danger.mp3" it locates it from the folder my game is playing from right? (So other people will be able to play properly too) If not how can i fix this, so everyone can play with audio? (Sorry for the bother)
  • Yes it locates from the game folder.

    Might be an issue with Twine 2 blocking the file. Try downloading Twine 1.4, make a small test story and see if it works.
  • Which kind of Twine 2 are you using: the app (NW.js-based) version or the browser-based version?

    If you're using the app version, then you have to Publish your story and test that, as the app itself doesn't support audio, so the Test and Play modes cannot play audio.
  • Which kind of Twine 2 are you using: the app (NW.js-based) version or the browser-based version?

    If you're using the app version, then you have to Publish your story and test that, as the app itself doesn't support audio, so the Test and Play modes cannot play audio.

    OMG I love you thank you man!! Just one more question though.. when I am uploading my file to a website or something, it says I must upload an index.html file, do I have to name my game file index? or is there something missing, cause in my folder I just have the game file (name of game) and a media folder, holding all my music, so do I just rename the file index.html? Thanks <3
  • If the website requires your file to be named index.html then yes, you just need to rename the story HTML file you created using Twine 2's Publish to File option.
Sign In or Register to comment.