It looks like you're new here. If you want to get involved, click one of these buttons!
:MenuOptions
<<ensureOptionsExist>>\
<<optiontoggle "pause" "Pause">>
Pause the music?
<<onchange>>
<<pausesound $music>>
<</optiontoggle>>
<<optiontoggle "mute" "Mute">>
Mute all sound?
<<onchange>>
<<stopsound $music>>
<<set $sound = "muted">>
<</optiontoggle>>
:Widget
<<widget "ensureOptionsExist">><<if Object.keys(options) eq 0>><<setOptionsToDefault>><</if>><</widget>>
<<widget "setOptionsToDefault">>
<<set options.pause = false>>
<<playsound $music>>
<<set options.mute = false>>
<<set $sound = "audible">>
<<saveoptions>>
<</widget>>
Comments
<<onchange>>
sections, when what you actually want to be doing is toggling the audio states. For example: [EDIT] Fixed a few misspellings.options
asoption
in the example I gave. Change that and it should work.Note, however, that the example doesn't cover interactions between pause and mute. Frankly, I don't see why you need both. You'd probably be better off simply using a single "Enable audio/sound" option.
As to changing the widget. I'd probably suggest not putting non-option setting in
<<setOptionsToDefault>>
, since it only gets called when the options don't exist. You'd be better off putting the other settings inStoryInit
.I'll attach an example of what I mean.