[Solved] Graying out a choice in the choice menu?

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
ketskari
Veteran
Posts: 290
Joined: Tue Dec 21, 2010 6:22 pm
Completed: Asher, Sunrise, Tell a Demon
Projects: Asher Remake, TEoA
Organization: Sun Labyrinth
Tumblr: sunlabyrinth
Deviantart: sunlabyrinth
itch: sunlabyrinth
Contact:

[Solved] Graying out a choice in the choice menu?

#1 Post by ketskari » Wed Mar 29, 2017 1:26 pm

Is there a way to gray out a menu choice option like the insensitive setting for a button in a screen?
Last edited by ketskari on Wed Mar 29, 2017 9:27 pm, edited 1 time in total.

User avatar
Ocelot
Eileen-Class Veteran
Posts: 1883
Joined: Tue Aug 23, 2016 10:35 am
Github: MiiNiPaa
Discord: MiiNiPaa#4384
Contact:

Re: Graying out a choice in the choice menu?

#2 Post by Ocelot » Wed Mar 29, 2017 1:52 pm

Yes. You would need to modify choice screen to do that, though. One example:

Code: Select all

screen choice(items):
    style_prefix "choice"

    vbox:
        for i in items:
            if i.caption.startswith('!!'):
                textbutton i.caption.strip('!') action None
            else:
                textbutton i.caption action i.action

# Usage:

menu:
    'normal text':
        pass
    '!!disabled text':
        pass
< < insert Rick Cook quote here > >

User avatar
ketskari
Veteran
Posts: 290
Joined: Tue Dec 21, 2010 6:22 pm
Completed: Asher, Sunrise, Tell a Demon
Projects: Asher Remake, TEoA
Organization: Sun Labyrinth
Tumblr: sunlabyrinth
Deviantart: sunlabyrinth
itch: sunlabyrinth
Contact:

Re: Graying out a choice in the choice menu?

#3 Post by ketskari » Wed Mar 29, 2017 2:07 pm

Interesting idea--I'll play around with it. Thank you!

EDIT: That's more convenient than I thought. For others interested in something like this, I implemented it like so:

Code: Select all

        vbox:
            style_prefix "choice"
            for i in items:
                if i.caption.startswith('@'):
                    if route3 == True:
                        textbutton i.caption.strip('@') action i.action
                    else:
                        textbutton i.caption.strip('@') action None at faded_btn
                else:
                    textbutton i.caption action i.action

transform faded_btn:
    alpha .6

Post Reply

Who is online

Users browsing this forum: Google [Bot]