Page 1 of 1

textbutton behaviour

Posted: Thu Oct 10, 2019 3:49 am
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?

Re: textbutton behaviour

Posted: Thu Oct 10, 2019 4:49 am
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.