Hi,
I'm trying to make the "save" button in the text box play a certain sound when clicked. I've done some research but can't figure out how to customize GUI buttons individually.
Help as to how to go about this is greatly appreciated. Thanks.
Individual GUI button sounds
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.
-
- Miko-Class Veteran
- Posts: 793
- Joined: Fri Feb 09, 2018 12:05 am
- Location: Canada
- Contact:
Re: Individual GUI button sounds
it should look like this Play("sound", "Sound/Saved Game.wav")
Code: Select all
textbutton _("Save") action [QuickSave("Save complete", newest=True), Play("sound", "Sound/Saved Game.wav")]
Re: Individual GUI button sounds
Hi, thanks for the quick reply. I put the code in the gui.rpy and got this error (and yes, I replaced the audio file):
File "game/gui.rpy", line 426: expected statement.
textbutton _("Save") action [QuickSave("Save complete", newest=True), Play("sound", "Sound/Saved Game.wav")]
^
Ren'Py Version: Ren'Py 7.3.5.606
Sun May 24 23:28:25 2020
[/code]
Did I put it in the wrong spot perhaps? Not sure what to change.
Thanks.
File "game/gui.rpy", line 426: expected statement.
textbutton _("Save") action [QuickSave("Save complete", newest=True), Play("sound", "Sound/Saved Game.wav")]
^
Ren'Py Version: Ren'Py 7.3.5.606
Sun May 24 23:28:25 2020
[/code]
Did I put it in the wrong spot perhaps? Not sure what to change.
Thanks.
- Imperf3kt
- Lemma-Class Veteran
- Posts: 3791
- Joined: Mon Dec 14, 2015 5:05 am
- itch: Imperf3kt
- Location: Your monitor
- Contact:
Re: Individual GUI button sounds
The error says "expected statement", which indicates you've placed it in the wrong spot, yes.
That textbutton would be placed in the screen that uses it, not within gui.rpy--its a button (screen element) ready to use.
That textbutton would be placed in the screen that uses it, not within gui.rpy--its a button (screen element) ready to use.
Warning: May contain trace amounts of gratuitous plot.
pro·gram·mer (noun) An organism capable of converting caffeine into code.
Current project: GGD Mentor
Twitter
pro·gram·mer (noun) An organism capable of converting caffeine into code.
Current project: GGD Mentor
- Remix
- Eileen-Class Veteran
- Posts: 1628
- Joined: Tue May 30, 2017 6:10 am
- Completed: None... yet (as I'm still looking for an artist)
- Projects: An un-named anime based trainer game
- Contact:
Re: Individual GUI button sounds
You might also take note of the activate_sound and hover_sound parameters to buttons...
Those two are actually style settings, so you could add them to the style that a group of buttons use rather than individually per button
Code: Select all
textbutton _("Save"):
action QuickSave("Save complete", newest=True)
activate_sound "audio/clickety_click.ogg"
hover_sound "audio/dull_whisper.ogg"
Frameworks & Scriptlets:
- Speech Bubble dialogue system
- Multiple Notify with ATL and history
- (WIP) Radial Masking - needs updating to use Shader
- 7.4 - Smooth Tinting using ATL and matrixcolor
- Several other repositories there too
Re: Individual GUI button sounds
Thanks, got it working. Didn't realize the code I had to replace was in screens.rpy. Much appreciated.
Who is online
Users browsing this forum: No registered users