Hover animation and sound doesn't activate when using timer function

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
sittingox
Newbie
Posts: 15
Joined: Wed Nov 15, 2023 7:33 pm
Contact:

Hover animation and sound doesn't activate when using timer function

#1 Post by sittingox »

Hi everyone, thanks for taking the time to help me out :D

So I have an issue where I'm calling a screen that has a timer and a imagebutton.

The timer works, but there's an issue with the imagebutton where the hover animation and sound effect don't work. But the button still works when I click it.



Pretty sure there's nothing wrong with the code as I'm not getting any error messages. And I made sure that the images and sound effects are inside my game folder too.
Is there a limit in the engine to how much things I can have going on at once while calling a screen?
Attachments
Screenshot 2023-11-20 183941.png
Screenshot 2023-11-20 183941.png (42.34 KiB) Viewed 5294 times

User avatar
m_from_space
Eileen-Class Veteran
Posts: 1198
Joined: Sun Feb 21, 2021 3:36 am
Contact:

Re: Hover animation and sound doesn't activate when using timer function

#2 Post by m_from_space »

sittingox wrote: Mon Nov 20, 2023 10:41 pmThe timer works, but there's an issue with the imagebutton where the hover animation and sound effect don't work. But the button still works when I click it.
I remember cases here in this forum where people wondered why their sound effects or music don't work. Turned out the files were corrupted. Have you tried playing them with any normal music player like VLC?

I'm not sure which channel Renpy uses for those effects (I hope "audio", so everything can be parallel), but are you by any chance playing ongoing music/sound on the "sound" channel while you try this (instead of the "music" channel for example)?

If that's all working and okay, could you try writing:

Code: Select all

hover_sound audio.select_effect_2
activate_sound audio.back_effect
You also said your hover "animation" doesn't work. Do you mean the image doesn't change when you hover the imagebutton?

Also which version of Renpy are you using? Please update to the latest "nightly fix" (not nightly) via the update button!
Is there a limit in the engine to how much things I can have going on at once while calling a screen?
Is there a specific reason you're asking this? Are there thousands of things inside your screens at the same time or anything?

sittingox
Newbie
Posts: 15
Joined: Wed Nov 15, 2023 7:33 pm
Contact:

Re: Hover animation and sound doesn't activate when using timer function

#3 Post by sittingox »

I checked the audio files using a music player, but they are fine.

I don't have any ongoing music or sound playing either.

I tried using the code you gave me, but I got the same result.

The nightly update didn't seem to help either...

Here's an image of the entire screen code:
Attachments
Screenshot 2023-11-21 101740.png
(98.97 KiB) Not downloaded yet

User avatar
m_from_space
Eileen-Class Veteran
Posts: 1198
Joined: Sun Feb 21, 2021 3:36 am
Contact:

Re: Hover animation and sound doesn't activate when using timer function

#4 Post by m_from_space »

sittingox wrote: Tue Nov 21, 2023 2:18 pm Here's an image of the entire screen code:
Looking at this code, my assumption is that your non-working imagebutton is blocked by something you draw later inside the screen, most likely the frame. Or maybe another screen that's in front of it. Because in that case you cannot actually hover it, meaning no event fires. Is that possible? Could you move it after the frame?

On the other hand you wrote that you are able to click it, so I don't really know.

User avatar
m_from_space
Eileen-Class Veteran
Posts: 1198
Joined: Sun Feb 21, 2021 3:36 am
Contact:

Re: Hover animation and sound doesn't activate when using timer function

#5 Post by m_from_space »

I just realized that you have timers active that are called repeatedly every 0.01 seconds. That most probably is a bad idea and maybe leads to Renpy not being able to process the hover events. But that's just an assumption right now. You should try counting in seconds, not milliseconds.

sittingox
Newbie
Posts: 15
Joined: Wed Nov 15, 2023 7:33 pm
Contact:

Re: Hover animation and sound doesn't activate when using timer function

#6 Post by sittingox »

Yeah, that's probably it. I just tried taking out the timer and the imagebutton works as it should.

edit: That fixed it! Thanks for helping me out :D

Post Reply

Who is online

Users browsing this forum: Google [Bot]