Page 1 of 1

Enabled Textbutton Display on Preference Screen

Posted: Mon Feb 17, 2020 9:21 pm
by wyverngem
I have a small script I'm adding that changes a persistent variable. I finally got it to turn on and off with the use of a function. I couldn't use SetVariable because it gave me a split error. So I created a basic function that takes the type and changes the persistent variable. However, the textbutton doesn't show that it's already enabaled on the preference screen one way or the other such as it does with the windowed and full screeen adding the line. What am I missing to change this?

Code: Select all

                vbox:
                    style_prefix "radio"
                    label _("Read-Mode")
                    textbutton _("NVL") action Function(turn_on_nvl, 1)
                    textbutton _("ADV") action Function(turn_on_nvl, 0)

Code: Select all

init python:
    def turn_on_nvl(type):
        if type == 0:
            persistent.nvl = False
        else:
            persistent.nvl = True

Re: Enabled Textbutton Display on Preference Screen

Posted: Thu Feb 20, 2020 9:18 am
by DragoonHP
I think SetField action might suit your need better https://www.renpy.org/doc/html/screen_a ... l#SetField

Re: Enabled Textbutton Display on Preference Screen

Posted: Tue Feb 25, 2020 9:49 am
by wyverngem
DragoonHP wrote: Thu Feb 20, 2020 9:18 am I think SetField action might suit your need better https://www.renpy.org/doc/html/screen_a ... l#SetField
Can you be more specific on what that looks like? I'm not sure what the object would be.

Re: Enabled Textbutton Display on Preference Screen

Posted: Tue Feb 25, 2020 2:09 pm
by Alex
Try

Code: Select all

textbutton _("NVL") action SetField(persistent, nvl, True)

Re: Enabled Textbutton Display on Preference Screen

Posted: Thu Apr 30, 2020 8:33 pm
by wyverngem
Thanks Alex.