[SOLVED]Textbutton won't hover on SetVariable action

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
awonderL
Newbie
Posts: 6
Joined: Sun Nov 28, 2021 1:29 am
Contact:

[SOLVED]Textbutton won't hover on SetVariable action

#1 Post by awonderL »

I'm having a weird issue that I can't quite figure out.

In my code, I have a textbutton that's supposed to hover when I mouse over it, except it doesn't.

I'm pretty sure I've determined the cause: I have an action (one of a few) on said textbutton, SetVariable("player_choice", 0).

Now if player_choice is already at 0, the button won't hover. If I change the player_choice value before testing the button with the SetVariable info staying the same, it hovers like expected. I should also point out that regardless of whether or not the textbutton hovers, it still works. Clicking it produces the desired effects of my actions in all scenarios; it just doesn't hover if I set up the situation as previously mentioned.

Is this intended or is there a reason why this is happening that I'm unaware of? I'm not very familiar with python.
Last edited by awonderL on Tue Nov 30, 2021 12:54 am, edited 1 time in total.

User avatar
PyTom
Ren'Py Creator
Posts: 16096
Joined: Mon Feb 02, 2004 10:58 am
Completed: Moonlight Walks
Projects: Ren'Py
IRC Nick: renpytom
Github: renpytom
itch: renpytom
Location: Kings Park, NY
Contact:

Re: Textbutton won't hover on SetVariable action

#2 Post by PyTom »

If player_choice is 0, then the variable will be in the selected_hover style prefix. Chances are, the selected style prefix is being styled in a way that overrides the hover style prefix, and hence hence the button isn't changing.

If you hover the button, and then click on the name of the style next to the text, you can see where this is set.
Supporting creators since 2004
(When was the last time you backed up your game?)
"Do good work." - Virgil Ivan "Gus" Grissom
Software > Drama • https://www.patreon.com/renpytom

awonderL
Newbie
Posts: 6
Joined: Sun Nov 28, 2021 1:29 am
Contact:

Re: Textbutton won't hover on SetVariable action

#3 Post by awonderL »

Thanks for your help, PyTom!

Your info directed me to use the SelectedIf distinction on one my actions to prevent the styling.

Post Reply

Who is online

Users browsing this forum: DewyNebula