0 votes
by (120 points)
So I'm using verson 1.4.2 Surarcane as my story format and while I found this https://www.glorioustrainwrecks.com/node/5061 I haven't gotten it to work at all.

1 Answer

+1 vote
by (44.7k points)

Sugarcane is ridiculously out of date.  It was replaced by SugarCube v1, which was replaced by SugarCube v2, and from what I understand, there's even been some work done towards SugarCube v3.

You should download the latest version of SugarCube and then follow the instructions here to install it in Twine 1.  (Heck, you might even want to upgrade to Twine 2 while you're at it.  There's a Twine 1 to Twine 2 HTML converter as well.)

Once you've done that you'll have access to all of the new stuff for handling audio files.  After that, I have some Twine 2/SugarCube 2 sample code for audio here, as well as some advice on how to deal with some of the security issues involved with audio you may have to deal with in some browsers (such as Chrome).

Hope that helps!  :-)

P.S. Good timing, actually, since SugarCube just updated today to add a few more audio features.

by (2.3k points)

I just upgraded to the newest Sugar Cube.

I try to run that code you linked to.

Alas I get issues with the volume object.

Error canot assign read only property of 'volume' # <Object>'.


by (44.7k points)
edited by

Hmmm... There appears to be a bug with the latest version of SugarCube (currently v2.28.2).  I'll let TheMadExile know so he can get that fixed.

In the mean time you can roll back to SugarCube v2.27.0 for Twine 1 or SugarCube v2.27.0 for Twine 2 from those links and that should fix the audio for you.


by (44.7k points)

OK, it turns out that Chapel's volume slider, which that code uses, was using an undocumented SugarCube API, and that API changed in v2.28.0.  I've updated the sample code to work with the updated API, so you should be able to use it with SugarCube v2.28.2 and future versions now.

Have fun!  :-)