alternate_sound for buttons?

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
User avatar
Kia
Eileen-Class Veteran
Posts: 1037
Joined: Fri Aug 01, 2014 7:49 am
Deviantart: KiaAzad
Discord: Kia#6810
Contact:

alternate_sound for buttons?

#1 Post by Kia »

I've noticed that there's no alternate_sound in the button styles and I wanted to make sure it doesn't exist before suggesting it.
Also I wonder if we have a set of dragged_sound, clicked_sound, activated_sound for drags or do we have to use the python functions instead?

User avatar
Ocelot
Lemma-Class Veteran
Posts: 2376
Joined: Tue Aug 23, 2016 10:35 am
Github: MiiNiPaa
Discord: MiiNiPaa#4384
Contact:

Re: alternate_sound for buttons?

#2 Post by Ocelot »

No, currently both left and right click reuses same sound.
https://github.com/renpy/renpy/blob/770 ... or.py#L906
< < insert Rick Cook quote here > >

User avatar
Kia
Eileen-Class Veteran
Posts: 1037
Joined: Fri Aug 01, 2014 7:49 am
Deviantart: KiaAzad
Discord: Kia#6810
Contact:

Re: alternate_sound for buttons?

#3 Post by Kia »

looks like all we need is passing the event to the function and playing the right sound accordingly.

Code: Select all

        def handle_click(action, event):
            if event == "click":
                renpy.exports.play(self.style.activate_sound)
            elif event == "alternate":
                renpy.exports.play(self.style.alternate_sound)
            elif event == "inactive":
                renpy.exports.play(self.style.inactive_sound)
just have to figure out how to add those keywords to the styles

Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot]