Here's an action that can handle this for you. Untested, of course:
Code:
init python:
class SetVolume(Action):
def __init__(self, mixer, value):
self.mixer = mixer
self.value = value
def __call__(self):
_preferences.set_volume(self.mixer, self.value)
def get_selected(self):
return _preferences.get_volume(self.mixer) == self.value
When calling this, mixer should be one of "music", "sfx", or "voice". The volume should be between 0.0 and 1.0. For example:
Code:
screen music_volume:
frame:
has vbox
label "Music Volume"
textbutton "0" action SetVolume("music", 0.0)
textbutton "1" action SetVolume("music", 0.25)
textbutton "2" action SetVolume("music", 0.5)
textbutton "3" action SetVolume("music", 0.75)
textbutton "4" action SetVolume("music", 1.0)
I'm not sure how great an idea this would be - I think I'd want more control over volume. That's why this isn't a default action. (Feedback is welcome.)
_________________
Another Old-Fashioned Bishoujo Gamer
Supporting creators since 2004; Code > Drama
(When was the last time you backed up your game?)
"It is not the critic who counts; not the man who points out how the strong man stumbles, or where the doer of deeds could have done them better. The credit belongs to the man who is actually in the arena, whose face in marred by dust and sweat and blood; who strives valiantly; who errs, who comes short again and again, because there is no effort without error and shortcoming" - Theodore Roosevelt