[solved] How and where to add a function for a bar?

Discuss how to use the Ren'Py engine to create visual novels and story-based games. New releases are announced in this section.
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.
Post Reply
Message
Author
Jo'ogn
Veteran
Posts: 398
Joined: Sat Jul 12, 2008 1:31 pm
Projects: Kassiopeia [iVN]
Location: Deutschland
Contact:

[solved] How and where to add a function for a bar?

#1 Post by Jo'ogn »

PyTom wrote: http://lemmasoft.renai.us/forums/viewtopic.php?p=330237
I think the preferred way is something like:

Code: Select all

bar value VariableValue("foo", 100)
"You think"? o_0; This topic didn't really help me figuring it out. I want to add another audio volume slider under preferences. Adding the slider in screen.rpy was easy. Now I got kinda lost in the "old ways" versus "new ways" of the whole screen language thingy. Plus the whole OOP approach is still kinda bizarrely abstact to me...

My question is: Where and how do I add a function or method that change the volume of that audio channel according to the bar slider? Instead of Preference("sound volume") I place there my own function?


EDIT: The Answer is the function is indeed put right into the screen definition with bar value <function>.

In my case I wanted to add a 4th mixer. It took me a while to dig up from the old and new documention, that renpy.music.register_channel( ) not only registers named channels, but also allows to create a new mixer at the same time.

Code: Select all

screen volume_controls:
    frame:
        has vbox

        label _("Ambience Volume")
        bar value MixerValue("ambience")
Last edited by Jo'ogn on Fri Aug 01, 2014 1:57 pm, edited 2 times in total.
Audio Plays: [original] The White Feathers Directive - [Star Wars] Through Flame and Shadow
Ren'Py: Kassiopeia [very interactive VN] work in progress - looking for proof reader english

mjshi
Regular
Posts: 179
Joined: Wed Mar 13, 2013 9:55 pm
Completed: MazeSite01, Ponderings of Time
Contact:

Re: How and where to add a function for a bar?

#2 Post by mjshi »

http://lemmasoft.renai.us/forums/viewtopic.php?p=127273

That bar tutorial was for variable values and displaying information, not for modifying the preferences screen xD

Aleema's tutorial above is better for you if you wanted to make sliders for the preference screen.

Jo'ogn
Veteran
Posts: 398
Joined: Sat Jul 12, 2008 1:31 pm
Projects: Kassiopeia [iVN]
Location: Deutschland
Contact:

Re: [solved] How and where to add a function for a bar?

#3 Post by Jo'ogn »

Thank you, I just figured it out how to get what I want. I updated my opening post accordingly.
Audio Plays: [original] The White Feathers Directive - [Star Wars] Through Flame and Shadow
Ren'Py: Kassiopeia [very interactive VN] work in progress - looking for proof reader english

Post Reply

Who is online

Users browsing this forum: Bing [Bot], Google [Bot], Kocker, ZianRiyone