Choice menu hover sounds

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
thirstyoctopus
Regular
Posts: 72
Joined: Mon Aug 27, 2018 12:04 pm
Projects: Romance Visual Novel story
Organization: Thirsty Octopus
Contact:

Choice menu hover sounds

#1 Post by thirstyoctopus » Wed Mar 06, 2019 8:44 pm

Hey everyone

I know that this has been asked before, but the solutions given do not work since I think they were for an older version of Ren'py. Basically, I just want to be able to play a sound when someone hovers over the choice menu buttons.

I'm looking in the screens.rpy file at this section specifically:

Code: Select all

screen choice(items):

    style_prefix "choice"

    vbox:
        
        for i in items:
            textbutton i.caption action i.action


## When this is true, menu captions will be spoken by the narrator. When false,
## menu captions will be displayed as empty buttons.
define config.narrator_menu = True


style choice_vbox is vbox
style choice_button is button
style choice_button_text is button_text

style choice_vbox:
    xalign 0.5
    ypos 270
    yanchor 0.5

    spacing gui.choice_spacing

style choice_button is default:
    properties gui.button_properties("choice_button")

style choice_button_text is default:
    properties gui.button_text_properties("choice_button")
and I'm somewhat aware that the command to use may be 'hovered' followed by the sound file I need to play, but I don't know where to put this, as everywhere I try it just tells me that 'hovered is not recognised'. Is there a way to be able to do this?

User avatar
Imperf3kt
Lemma-Class Veteran
Posts: 3636
Joined: Mon Dec 14, 2015 5:05 am
Location: Your monitor
Contact:

Re: Choice menu hover sounds

#2 Post by Imperf3kt » Wed Mar 06, 2019 11:16 pm

Try replacing the style with this

Code: Select all

style choice_button is default:
    properties gui.button_properties("choice_button")
    hover_sound "your file" 
Warning: May contain trace amounts of gratuitous plot.
pro·gram·mer (noun) An organism capable of converting caffeine into code.

Current project: GGD Mentor
Free Android GUI - Updated occasionally
Twitter
Imperf3kt Blackjack - a WIP blackjack game for Android made using Ren'Py

Post Reply

Who is online

Users browsing this forum: Bing [Bot], Google [Bot]