Having issues with hovering over an imagebutton, please help!

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
MelonFudger
Newbie
Posts: 3
Joined: Sat Feb 29, 2020 4:14 pm
Contact:

Having issues with hovering over an imagebutton, please help!

#1 Post by MelonFudger » Sat Feb 29, 2020 4:19 pm

I wonder if anyone could help me...I am using imagebuttons on a few items on my screen. On hover, I managed to use jump to a label and show the required text in the dialogue box, but once I unhover the dialogue sticks there and won't revert back to the original(EXAMPLE: before I hover on the button the dialogue box says "hi", once I hover on the button, it switches to "Bye" /which is great so far/ but when I unhover it stays "Bye"...how could I switch it back to "Hi") ?

Please help me out, been stuck on this for waaaay too long...I have tried a few different methods, none has helped me so far..

User avatar
namastaii
Eileen-Class Veteran
Posts: 1348
Joined: Mon Feb 02, 2015 8:35 pm
Projects: Template Maker for Ren'Py, What Life
Github: lunalucid
Skype: Discord: lunalucid#1991
Soundcloud: LunaLucidMusic
itch: lunalucid
Location: USA
Contact:

Re: Having issues with hovering over an imagebutton, please help!

#2 Post by namastaii » Sun Mar 01, 2020 1:20 am

You can include an unhovered action as well just like the hover.

MelonFudger
Newbie
Posts: 3
Joined: Sat Feb 29, 2020 4:14 pm
Contact:

Re: Having issues with hovering over an imagebutton, please help!

#3 Post by MelonFudger » Mon Mar 02, 2020 5:56 am

I tried but that breaks my game. It doesn't necessarily errors but freezes the game window and won't do the unhover action at all.

MelonFudger
Newbie
Posts: 3
Joined: Sat Feb 29, 2020 4:14 pm
Contact:

Re: Having issues with hovering over an imagebutton, please help!

#4 Post by MelonFudger » Mon Mar 02, 2020 6:00 am

Here is my screen code so far:

Code: Select all

screen corridorScene():

    imagebutton:
        idle "door_idle"
        hover "door_hover"
        xalign 0.5
        yalign 1.0
        focus_mask True
        action Jump("tryDoor")
        hovered Call("doorHover")
And here is the label being called on hover:

Code: Select all

label doorHover:
    "I think there's a door behind those cobwebs."
    return

User avatar
Potato0095
Regular
Posts: 57
Joined: Sun May 08, 2016 8:40 pm
Projects: Lovecraft
Location: Brazil
Contact:

Re: Having issues with hovering over an imagebutton, please help!

#5 Post by Potato0095 » Mon Mar 02, 2020 8:47 am

Hm... Shouldn't the idle state overlap the hover state? I would try to workaround calling another label (that being the idle state) before the return on "doorHover". I don't know exactly what you're trying to achieve, and I don't think I could solve even if I knew, I don't have the skills on imagebutton for that.
Last edited by Potato0095 on Mon Mar 02, 2020 9:16 am, edited 1 time in total.
"There are two types of lies: Lies that hurt, and lies that don't."

User avatar
RicharDann
Veteran
Posts: 255
Joined: Thu Aug 31, 2017 11:47 am
Contact:

Re: Having issues with hovering over an imagebutton, please help!

#6 Post by RicharDann » Mon Mar 02, 2020 9:10 am

I'm not sure what are you trying to achieve here, but if all you need is to show a small message when a button is hovered in a screen, and have it go away when unhovered, you might want to try using tooltips.
The most important words a man can say are, “I will do better”.
The most important step is always the next one.

User avatar
namastaii
Eileen-Class Veteran
Posts: 1348
Joined: Mon Feb 02, 2015 8:35 pm
Projects: Template Maker for Ren'Py, What Life
Github: lunalucid
Skype: Discord: lunalucid#1991
Soundcloud: LunaLucidMusic
itch: lunalucid
Location: USA
Contact:

Re: Having issues with hovering over an imagebutton, please help!

#7 Post by namastaii » Thu Mar 05, 2020 12:08 am

If you're just trying to show some text for a brief moment hovering something, you should use tooltips like RicharDann suggested or some other way through screens, booleans etc.

Post Reply

Who is online

Users browsing this forum: pfranzen