[Solved] Playing sound when clicking choice menu

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
borisoda
Regular
Posts: 102
Joined: Thu Feb 09, 2012 10:33 am
Contact:

[Solved] Playing sound when clicking choice menu

#1 Post by borisoda » Sun Nov 10, 2013 8:16 pm

Hello!

I am pretty much using the default renpy options and

I want a sound play after clicking a choice during the visual novel.

I don't want any other UI sound than this. (Don't want sound when you click other buttons like in config menu, title menu textbox shortcuts etc)

Does anyone know how to do this?

P.S. It would be nice if there's also a way to play a sound when you hover over the choice menu as well..

Thank you very much for your time. Your help is appreciated!
Attachments
screenshot0002.jpg
Last edited by borisoda on Mon Nov 11, 2013 9:14 am, edited 1 time in total.

User avatar
SundownKid
Lemma-Class Veteran
Posts: 2299
Joined: Mon Feb 06, 2012 9:50 pm
Completed: Icebound, Selenon Rising Ep. 1-2
Projects: Selenon Rising Ep. 3-4
Organization: Fastermind Games
Deviantart: sundownkid
Location: NYC
Contact:

Re: Playing sound when clicking choice menu

#2 Post by SundownKid » Mon Nov 11, 2013 1:57 am

I know exactly what you're talking about. You want to navigate to screens.rpy and find the "Choice" screen. You want to replace where it says "button:" with this:

Code: Select all

button:
    action [action, Play("sound", "se/open.ogg")]
    hovered Play("sound", "se/select.ogg")
    style "menu_choice_button"                        
Obviously you can switch the "se/select.ogg" to whatever sound you want. The "open" would be pressing the button and "select" would be hovering.

User avatar
borisoda
Regular
Posts: 102
Joined: Thu Feb 09, 2012 10:33 am
Contact:

Re: Playing sound when clicking choice menu

#3 Post by borisoda » Mon Nov 11, 2013 9:13 am

Perfect! :D

Thank you so much! I'm very happy to be able to use this function!

User avatar
mellowidol
Newbie
Posts: 2
Joined: Mon Apr 23, 2018 8:28 pm
Tumblr: cafebeat
Contact:

Re: [Solved] Playing sound when clicking choice menu

#4 Post by mellowidol » Mon Apr 23, 2018 8:32 pm

I found this very useful. However, I also want to have an effect when I hover over/scroll through choices. I've tried to find it elsewhere, but it seems to be outdated. That or I just can't find where to edit it.

For reference, I found an "outdated" tutorial here: viewtopic.php?t=23938

They gave:

Code: Select all

button:
    action [action, Play("sound", "se/open.ogg")]
    hovered Play("sound", "se/select.ogg")
    style "menu_choice_button"
as the solution, but I can't seem to find where "button" is in the screen.rpy file.

Any help would be appreciated, and let me know if I posted incorrectly as this is my first post (and I'm new to this forum.)

Post Reply

Who is online

Users browsing this forum: GreenVegetations