Enabled Textbutton Display on Preference Screen

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
User avatar
wyverngem
Miko-Class Veteran
Posts: 610
Joined: Mon Oct 03, 2011 7:27 pm
Completed: Simple as Snow, Lady Luck's Due,
Projects: Aether Skies, Of the Waterfall
Tumblr: casting-dreams
itch: castingdreams
Location: USA
Contact:

Enabled Textbutton Display on Preference Screen

#1 Post by wyverngem » Mon Feb 17, 2020 9:21 pm

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

User avatar
DragoonHP
Miko-Class Veteran
Posts: 744
Joined: Tue Jun 22, 2010 12:54 am
Completed: Christmas
IRC Nick: DragoonHP
Location: Zion Island, Solario
Contact:

Re: Enabled Textbutton Display on Preference Screen

#2 Post by DragoonHP » 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

User avatar
wyverngem
Miko-Class Veteran
Posts: 610
Joined: Mon Oct 03, 2011 7:27 pm
Completed: Simple as Snow, Lady Luck's Due,
Projects: Aether Skies, Of the Waterfall
Tumblr: casting-dreams
itch: castingdreams
Location: USA
Contact:

Re: Enabled Textbutton Display on Preference Screen

#3 Post by wyverngem » Tue Feb 25, 2020 9:49 am

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.

User avatar
Alex
Lemma-Class Veteran
Posts: 2437
Joined: Fri Dec 11, 2009 5:25 pm
Contact:

Re: Enabled Textbutton Display on Preference Screen

#4 Post by Alex » Tue Feb 25, 2020 2:09 pm

Try

Code: Select all

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

Post Reply

Who is online

Users browsing this forum: Google [Bot], MaydohMaydoh, noeinan