Lemma Soft Forums

Supporting creators of visual novels and story-based games since 2003.


Visit our new games list, blog aggregator, IRC, and wiki.
Activation problem? Email [email protected]
It is currently Thu May 23, 2013 3:16 am

All times are UTC - 5 hours [ DST ]


Forum rules


Ask questions about one topic per thread, and use a descriptive subject. "NotImplemented error in script.rpy" is a good subject, "Tom's problems" is not. Remember to include all of traceback.txt or error.txt when reporting a problem, as well as the relevant lines of script. Use the [code] tag to format scripts.



Post new topic Reply to topic  [ 4 posts ] 
Author Message
PostPosted: Sun Jul 24, 2011 5:51 am 
Regular
User avatar

Joined: Sun Sep 06, 2009 6:54 am
Posts: 93
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

_________________
-Gumaster
There is no n.
http://electrofishstudios.wordpress.com/


Top
 Profile Send private message  
 
PostPosted: Sun Jul 24, 2011 6:19 am 
Ren'Py Creator
User avatar

Joined: Mon Feb 02, 2004 10:58 am
Posts: 10776
Location: Kings Park, NY
Completed: Moonlight Walks
Projects: Ren'Py
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


Top
 Profile Send private message  
 
PostPosted: Sun Jul 24, 2011 7:53 am 
Regular
User avatar

Joined: Sun Sep 06, 2009 6:54 am
Posts: 93
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

_________________
-Gumaster
There is no n.
http://electrofishstudios.wordpress.com/


Top
 Profile Send private message  
 
PostPosted: Sun Jul 24, 2011 8:38 pm 
Veteran
User avatar

Joined: Mon Aug 09, 2010 10:02 pm
Posts: 237
Location: California, USA
Projects: Eastern Starlight Romance, Touhou Mecha
Organization: Dai-Sukima Dan
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:
        # 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:
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

_________________
Dai-Sukima Dan blog


Top
 Profile Send private message  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC - 5 hours [ DST ]


Who is online

Users browsing this forum: No registered users


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Protected by Anti-Spam ACP
Powered by phpBB® Forum Software © phpBB Group