textbutton behaviour

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
mdqp
Newbie
Posts: 22
Joined: Mon Dec 24, 2018 2:56 pm
Contact:

textbutton behaviour

#1 Post by mdqp »

Hi everyone! I have a simple screen in my game:

Code: Select all

screen hologlasses:
    zorder 110
    add "splash.png"
    modal True
    
    hbox:
        xalign 0.5 yalign 0.5
        spacing 5
        vbox:
            text "Quest log (not available yet)" #action [ Show('quest_log'), Hide("hologlasses")]

            textbutton "Extranet" action [ Show('extranet_entries'), Hide("hologlasses"), SetVariable("extra_search", "")]
            textbutton "Personal profiles" action [ Show('profiles'), Hide("hologlasses")]
    textbutton "Back" action [ Show('hologlasses_button'), Hide("hologlasses")] xalign 0.5 yalign 0.95
my problem is that for the "Extranet" textbutton, if I have the "SetVariable" part in, the button will refuse to style, appearing like normal text (and being unresponsive to mouse hover). Removing that part makes the button behave normally. What could be the issue here?

philat
Eileen-Class Veteran
Posts: 1910
Joined: Wed Dec 04, 2013 12:33 pm
Contact:

Re: textbutton behaviour

#2 Post by philat »

SetVariable makes a button unresponsive if the variable is already set to whatever you're trying to set it to. In this case, it means extra_search is already "". It would probably be easier to set extra_search to a different default setting rather than making your own screen action that doesn't behave this way.

Post Reply

Who is online

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