There was a thread almost a year ago about this, but I'm curious as to how this is done with screen language.
I can set *most* values by listing the relevant actions (such as Preferences("skip", "seen")), but I'm stuck with music and sound volumes, as there doesn't seem to be a way to set them to maximum (or a certain value) outside of using bars
"Reset to default" preferences?
Forum rules
This is the right place for Ren'Py help. Please ask one question per thread, use a descriptive subject like 'NotFound error in option.rpy' , and include all the relevant information - especially any relevant code and traceback messages. Use the code tag to format scripts.
This is the right place for Ren'Py help. Please ask one question per thread, use a descriptive subject like 'NotFound error in option.rpy' , and include all the relevant information - especially any relevant code and traceback messages. Use the code tag to format scripts.
- PyTom
- Ren'Py Creator
- Posts: 16093
- Joined: Mon Feb 02, 2004 10:58 am
- Completed: Moonlight Walks
- Projects: Ren'Py
- IRC Nick: renpytom
- Github: renpytom
- itch: renpytom
- Location: Kings Park, NY
- Contact:
Re: "Reset to default" preferences?
Here's an action that can handle this for you. Untested, of course:
When calling this, mixer should be one of "music", "sfx", or "voice". The volume should be between 0.0 and 1.0. For example:
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.)
Code: Select all
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
Code: Select all
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)
Supporting creators since 2004
(When was the last time you backed up your game?)
"Do good work." - Virgil Ivan "Gus" Grissom(When was the last time you backed up your game?)
Software > Drama • https://www.patreon.com/renpytom
Re: "Reset to default" preferences?
Works (at least, to the extent that I tested it)
I'm not using it as a replacement for the volume bar (I'd prefer more control too), simply as a way to set music and sound volumes to max using the 'reset to default' button
I'm not using it as a replacement for the volume bar (I'd prefer more control too), simply as a way to set music and sound volumes to max using the 'reset to default' button
- SleepKirby
- Veteran
- Posts: 255
- Joined: Mon Aug 09, 2010 10:02 pm
- Projects: Eastern Starlight Romance, Touhou Mecha
- Organization: Dai-Sukima Dan
- Location: California, USA
- Contact:
Re: "Reset to default" preferences?
I have a Reset to Defaults button that sets all the preferences to default. Not sure if it's what you want, but just throwing in an idea. It looks something like this:
Code: Select all
# This is in my preferences screen code.
# When you click this hotspot, the function ResetToDefaults is called. You could achieve the same thing with a button
hotspot (569, 477, 188, 106) clicked ResetToDefaults
Code: Select all
init python:
def ResetToDefaults():
_preferences.transitions = 2 # All transitions on
_preferences.text_cps = config.default_text_cps
_preferences.afm_time = config.default_afm_time
_preferences.afm_enable = config.default_afm_enable
_preferences.skip_unseen = False
_preferences.skip_after_choices = False
_preferences.set_volume('sfx', 1.0)
_preferences.set_volume('music', 1.0)
persistent.annotations_enable = False # This is an option specific to my game
renpy.restart_interaction() # Update the screen to reflect the preference changes
Who is online
Users browsing this forum: No registered users