Disabled buttons still enabled

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
Jod
Regular
Posts: 51
Joined: Sat Nov 24, 2012 10:16 am
Projects: F.I.N.
Organization: JodCorp
Location: The Netherlands
Contact:

Disabled buttons still enabled

#1 Post by Jod »

Hey there, I'm having some trouble with showing disabled buttons. I want a choice to be disabled or enabled depending on a boolean. When it's enabled, everything is fine. When it's disabled, I want to show it, but not be clickable (greyed out, as it were)

Through some earlier questions I have found this:

I have found the following snippet that allows me to show a choice as disabled:

Code: Select all

screen choice(items):
    style_prefix "choice"

    vbox:
        for i in items:
            $ disabled = i.kwargs.get("disabled", False)
            textbutton i.caption action i.action sensitive not disabled

This is my code:

Code: Select all

label test_choice:
    menu:
        "SET confidence to 3":
            $ confidence = 3
        "SET confidence to 1":
            $ confidence = 1

    $ little_confident = False
    if confidence > 2:
        $ little_confident = True

    menu:
        "Option 1: I understand, Luca.":
            "Placeholder."
        "Option 2: You don't have to be a douche about it. Here's your money!" if little_confident:
            "Placeholder"
        "Option 3: Screw you, Luca! You get out of my bar right now or I'll fucking shoot you! (confidence > 5)" (disabled=True):
             "Placeholder"

    return

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

Re: Disabled buttons still enabled

#2 Post by philat »

Wouldn't it be simpler to use config.menu_include_disabled ? https://www.renpy.org/dev-doc/html/conf ... isabledYou

Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], Belgerum