Custom volume menu and saving master volume outside the sidebar in Harlowe Audio Library

Twine Version: 2.8.1.0

Hello, I’ve been playing around with the harlowe audio library and apologies if this is a silly question but I have been trying to make my own volume settings because I do not want to use the sidebar provided but the issue is that if I do something like this:

Volume: {(link-repeat:"Mute")[
                (masteraudio: 'volume', 0)
]  
(link-repeat:"MAX")[
                (masteraudio: 'volume', 1)
]}

It will not save the user preference as it does on the sidebar.

Any help would be appreciated. Apologies if this has been discussed before and I was not as thorough in my search as I thought.

1 Like

sorry for the thread resurrect but I still cannot figure it out, it’s harlowe 3.3.8

In order to save the volume setting, you must assign it to a story variable.

I do not have the audio library installed so this is just an educated guess:

(if: $changedVolume is true)[
     (masteraudio: 'volume', $volume)
]
Volume: {(link-repeat:"Mute")[
     (set: $changedVolume to true)
     (set: $volume to 0)
     (masteraudio: 'volume', 0)
]  
(link-repeat:"MAX")[
     (set: $changedVolume to true)
     (set: $volume to 1)
     (masteraudio: 'volume', 1)
]}

The two story variables $changedVolume and $volume should persist when the story is saved/loaded. The (if:) macro will only set the volume if the user changed it manually.

Hopefully this leads you in the right direction.

this would work great if it were possible to have the variable be saved independently of the game save, without the location in the story itself being saved. I think I have a hunch how to do that but I appreciate any input.