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 »

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: 1350
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 »

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 »

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 »

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: 84
Joined: Sun May 08, 2016 8:40 pm
Projects: LoveCraft
itch: potato95
Location: Brazil
Contact:

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

#5 Post by Potato0095 »

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: 286
Joined: Thu Aug 31, 2017 11:47 am
Contact:

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

#6 Post by RicharDann »

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 step is always the next one.

User avatar
namastaii
Eileen-Class Veteran
Posts: 1350
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 »

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: Google [Bot], Ocelot, Semrush [Bot]