I was just wondering if it were possible to add a sound effect to the right click button- like how when you click the return button and add a sfx to it I want the right-click to make the same sound so all the menus are coherent.
I'm not very experienced with coding so I was going through the documentation trying to make up something and this is what I came up with. (Obviously doesn't work but I guess it's a good visual of what I'm trying to do.)
(I did these sections of code separately from each other, not at the same time)
screen keymap_screen():
key ['mouseup_3'] action [activate_sound] "sfx/menuout.ogg"
init python:
config.keymap['game_menu'].append('mouseup_3'):
activate_sound "sfx/menuout.ogg"
Ideally when you right-click in game and it takes you to the save menu it would make a different sound effect then if you right-clicked too dismiss a menu- But I don't know if this is even possible in general. If it is but too advanced I'll give up on it though. If anyone has any insight I'd really appreciate it!
[SOLVED ]Assign SFX to right-click?
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.
-
- Newbie
- Posts: 2
- Joined: Mon Jun 03, 2019 8:17 pm
- Contact:
[SOLVED ]Assign SFX to right-click?
Last edited by picklejuice on Sun Feb 25, 2024 8:19 pm, edited 1 time in total.
- m_from_space
- Eileen-Class Veteran
- Posts: 1011
- Joined: Sun Feb 21, 2021 3:36 am
- Contact:
Re: Assign SFX to right-click?
So you have to add the click-event to the game_menu screen as part of <screens.rpy>. Make sure to use the "mousedown_3" event, not "mouseup_3".picklejuice wrote: ↑Sun Feb 25, 2024 5:13 am I was just wondering if it were possible to add a sound effect to the right click button- like how when you click the return button and add a sfx to it I want the right-click to make the same sound so all the menus are coherent.
That's a different story. When in a game and doing a right-click, you either can catch that event with your own screen or just use a special screen event using "on".Ideally when you right-click in game and it takes you to the save menu it would make a different sound effect then if you right-clicked too dismiss a menu- But I don't know if this is even possible in general.
Here is what covers both of your ideas:
Code: Select all
screen game_menu(title, scroll=None, yinitial=0.0):
# play a sound when doing a right-click inside the game menu
key "mousedown_3" action Play("audio", "sfx/menuout.ogg")
# play a different sound when we enter the game menu from within a game
if not main_menu:
on "show" action Play("audio", "sfx/othersound.ogg")
# rest of the screen
I misread your second wish, you wanted a different sound when dismissing the menu while in the game, not when showing the menu. So here is the code:
Code: Select all
screen game_menu(title, scroll=None, yinitial=0.0):
if main_menu:
# play a sound when doing a right-click inside the game menu, when inside the main menu
key "mousedown_3" action Play("audio", "sfx/menuout.ogg")
else:
# play a different sound when doing a right-click inside the game menu, when inside a game
key "mousedown_3" action Play("audio", "sfx/othersound.ogg")
# rest of the screen
-
- Newbie
- Posts: 2
- Joined: Mon Jun 03, 2019 8:17 pm
- Contact:
Re: Assign SFX to right-click?
Omg it worked!! Thank you so much!! I was really losing my mind over this lol!!
Who is online
Users browsing this forum: Bing [Bot], giorgi1111