Adding sound to textbox?

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
Costinux
Newbie
Posts: 2
Joined: Mon Dec 21, 2015 8:19 pm
Tumblr: Costinux
Deviantart: Costinux
Github: Costinux
Skype: Costinux
Soundcloud: Costinux
Contact:

Adding sound to textbox?

#1 Post by Costinux »

How can I add sound to every textbox when it's clicked?
I've searched information for this but I didn't found anything at all.

User avatar
Starshine
Veteran
Posts: 247
Joined: Mon Jan 30, 2012 7:50 am
Completed: http://berry-melon.blogspot.co.uk/2016/ ... -2016.html
Projects: Pancake Surprise (2016)
Tumblr: http://bettybooplover.tumblr.com
Deviantart: berry-melon
Soundcloud: sweepea-1
Contact:

Re: Adding sound to textbox?

#2 Post by Starshine »

Costinux wrote:How can I add sound to every textbox when it's clicked?
I've searched information for this but I didn't found anything at all.


I've seen someone do that before. Is it for the Save/Load/Config & Menu? Like if you hover over them they make a sound?

I'm not too sure but, I think Uncle Mugen once did that in one of his templates, which he allowed people to mess with, and or edit w/e. Although I can't seem to find a link to it anymore but I have the codes? If you want to add sound it might have something to do with the screen navigation. Anyway i'll bump your post, and hopefully someone will be able to help you a little more.


Code: (You can use as help, i'd suggest not pasting them into your game, more or less use them to help you with you problem)


I think you have to erm... add the sound to the buttons/image buttons.

## http://www.renpy.org/doc/html/screen_sp ... navigation
screen navigation:
imagebutton auto "gui/game_menu_save_%s.png" xpos 810 ypos 99 focus_mask True action ShowMenu('save') hovered [ Play ("test_one", "sfx/click.ogg"), Show("gui_tooltip", my_picture="gui/tooltip_geme_menu_save.png", my_tt_xpos=46, my_tt_ypos=518) ] unhovered [Hide("gui_tooltip")] at nav_eff
imagebutton auto "gui/game_menu_load_%s.png" xpos 810 ypos 164 focus_mask True action ShowMenu('load') hovered [ Play ("test_two", "sfx/click.ogg"), Show("gui_tooltip", my_picture="gui/tooltip_geme_menu_load.png", my_tt_xpos=46, my_tt_ypos=518) ] unhovered [Hide("gui_tooltip")] at nav_eff
imagebutton auto "gui/game_menu_config_%s.png" xpos 810 ypos 227 focus_mask True action ShowMenu('preferences') hovered [ Play ("test_three", "sfx/click.ogg"), Show("gui_tooltip", my_picture="gui/tooltip_geme_menu_config.png", my_tt_xpos=46, my_tt_ypos=518) ] unhovered [Hide("gui_tooltip")] at nav_eff
imagebutton auto "gui/game_menu_main_%s.png" xpos 810 ypos 291 focus_mask True action MainMenu() hovered [ Play ("test_one", "sfx/click.ogg"), Show("gui_tooltip", my_picture="gui/tooltip_geme_menu_main.png", my_tt_xpos=46, my_tt_ypos=518) ] unhovered [Hide("gui_tooltip")] at nav_eff
imagebutton auto "gui/game_menu_return_%s.png" xpos 810 ypos 355 focus_mask True action Return() hovered [ Play ("test_two", "sfx/click.ogg"), Show("gui_tooltip", my_picture="gui/tooltip_geme_menu_return.png", my_tt_xpos=46, my_tt_ypos=518) ] unhovered [Hide("gui_tooltip")] at nav_eff
imagebutton auto "gui/game_menu_quit_%s.png" xpos 810 ypos 419 focus_mask True action Quit() hovered [ Play ("test_three", "sfx/click.ogg"), Show("gui_tooltip", my_picture="gui/tooltip_geme_menu_quit.png", my_tt_xpos=46, my_tt_ypos=518) ] unhovered [Hide("gui_tooltip")] at nav_eff



## Screen that allows the user to change the preferences.
## http://www.renpy.org/doc/html/screen_sp ... prefereces
screen preferences:
tag menu # This ensures that any other menu screen is replaced.
add "gui/config_ground.jpg" # We add the image that is shown in the background of the preferences screen.
use navigation # We include the navigation screen (game menu)
# Display windowed/full screen:
imagebutton auto "gui/config_display_window_%s.png" xpos 300 ypos 186 focus_mask True action Preference('display', 'window') at config_eff hovered [ Play ("test_one", "sfx/click.ogg"), Show("gui_tooltip", my_picture="gui/tooltip_config_windowed.png", my_tt_xpos=46, my_tt_ypos=518) ] unhovered [Hide("gui_tooltip")]
imagebutton auto "gui/config_display_fullscreen_%s.png" xpos 388 ypos 186 focus_mask True action Preference('display', 'fullscreen') at config_eff hovered [ Play ("test_two", "sfx/click.ogg"), Show("gui_tooltip", my_picture="gui/tooltip_config_fullscreen.png", my_tt_xpos=46, my_tt_ypos=518) ] unhovered [Hide("gui_tooltip")]
# Transitions on/off:
imagebutton auto "gui/config_transitions_none_%s.png" xpos 502 ypos 186 focus_mask True action Preference('transitions', 'none') at config_eff hovered [ Play ("test_four", "sfx/click.ogg"), Show("gui_tooltip", my_picture="gui/tooltip_config_enable_transition.png", my_tt_xpos=46, my_tt_ypos=518) ] unhovered [Hide("gui_tooltip")]
imagebutton auto "gui/config_transitions_all_%s.png" xpos 591 ypos 186 focus_mask True action Preference('transitions', 'all') at config_eff hovered [ Play ("test_four", "sfx/click.ogg"), Show("gui_tooltip", my_picture="gui/tooltip_config_enable_transition.png", my_tt_xpos=46, my_tt_ypos=518) ] unhovered [Hide("gui_tooltip")]
# Stop/continue skipping after choices
imagebutton auto "gui/config_afterchoices_stop_%s.png" xpos 300 ypos 345 focus_mask True action Preference('after choices', 'stop') at config_eff hovered [ Play ("test_one", "sfx/click.ogg"), Show("gui_tooltip", my_picture="gui/tooltip_config_stop_skip.png", my_tt_xpos=46, my_tt_ypos=518) ] unhovered [Hide("gui_tooltip")]
imagebutton auto "gui/config_afterchoices_skip_%s.png" xpos 388 ypos 345 focus_mask True action Preference('after choices', 'skip') at config_eff hovered [ Play ("test_two", "sfx/click.ogg"), Show("gui_tooltip", my_picture="gui/tooltip_config_go_skip.png", my_tt_xpos=46, my_tt_ypos=518) ] unhovered [Hide("gui_tooltip")]
# Skip all/seen text
imagebutton auto "gui/config_skip_seen_%s.png" xpos 501 ypos 345 focus_mask True action Preference('skip', 'seen') at config_eff hovered [ Play ("test_one", "sfx/click.ogg"), Show("gui_tooltip", my_picture="gui/tooltip_config_stop_skip.png", my_tt_xpos=46, my_tt_ypos=518) ] unhovered [Hide("gui_tooltip")]
imagebutton auto "gui/config_skip_all_%s.png" xpos 591 ypos 345 focus_mask True action Preference('skip', 'all') at config_eff hovered [ Play ("test_two", "sfx/click.ogg"), Show("gui_tooltip", my_picture="gui/tooltip_config_go_skip.png", my_tt_xpos=46, my_tt_ypos=518) ] unhovered [Hide("gui_tooltip")]
# Button to begin skipping. Only active/visible if the game is started. Image config_begin_skipping_insensitive.png is used when the button is not active.
imagebutton auto "gui/config_begin_skipping_%s.png" xpos 420 ypos 117 focus_mask True action Preference('begin skipping') hovered [ Play ("test_one", "sfx/click.ogg"), Show("gui_tooltip", my_picture="gui/tooltip_config_skipping.png", my_tt_xpos=46, my_tt_ypos=518) ] unhovered [Hide("gui_tooltip")]

## ■██▓▒░ SAVE / LOAD FILE PICKER ░▒▓███████████████████████■
## Since saving and loading are so similar, we combine them into a single screen, file_picker. We then use the file_picker screen from simple load and save screens.
screen file_picker:
use navigation # We include the navigation/game menu screen
# Buttons for selecting the save/load page:
imagebutton auto "gui/filepage1_%s.png" xpos 46 ypos 104 focus_mask True action FilePage(1) hover_sound "sfx/click.ogg"
imagebutton auto "gui/filepage2_%s.png" xpos 46 ypos 228 focus_mask True action FilePage(2) hover_sound "sfx/click.ogg"
imagebutton auto "gui/filepage3_%s.png" xpos 46 ypos 353 focus_mask True action FilePage(3) hover_sound "sfx/click.ogg"
$ y=104 # ypos for the first save slot
for i in range(0, 3): # This repeats the block below 3 times (counts from 0 to 2), for the 3 save slots. We could also copy/paste the block below 3 times, but we are too lazy to do that.
imagebutton auto "gui/fileslot_%s.png" xpos 195 ypos y focus_mask True action FileAction(i)
use load_save_slot(number=i, x=195, y=y) # This calls the load_save_slot screen defined above. We pass variable i as the slot number and x, y coordinates.
$ y+=124 # We increase the y variable so every next save slot is moved 124px lower.

## ■██▓▒░ YES/NO PROMPT ░▒▓█████████████████████████████████■
## Screen that asks the user a yes or no question. You'll need to edit this to change the position and style of the text.
## http://www.renpy.org/doc/html/screen_sp ... sno-prompt

screen yesno_prompt:
on "show" action Play("sound", "sfx/alert.wav")
modal True # A modal screen prevents the user from interacting with displayables below it, except for the default keymap.

add "gui/yesno_ground.png"
imagebutton auto "gui/yesno_yes_%s.png" xpos 267 ypos 369 action yes_action hover_sound "sfx/click.ogg"
imagebutton auto "gui/yesno_no_%s.png" xpos 526 ypos 369 action no_action hover_sound "sfx/click.ogg"


If you meant text bleeps, here: http://www.renpy.org/wiki/renpy/doc/coo ... ext_Bleeps
(But I don't think you did, i'm a little confused but I assume you are asking for the hovering menu sound, anyway hopefully someone with more knowledge will come along, i'm trying to help but failing miserably)
http://berry-melon.blogspot.com
I'm not resting until I find
What would make your eyes
Glisten like mine
With loves divine!

Boo-Boo I couldn't aspire....to anything...
Higher...than to fill that one desire to make it
My own....Bop-Bop-a-Dop-Boop-Oop-a-Doop honey?

Post Reply

Who is online

Users browsing this forum: Google [Bot]