Change appearance of previously chosen menu options?

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
ClariceS
Newbie
Posts: 3
Joined: Wed Apr 10, 2013 12:44 am
Contact:

Change appearance of previously chosen menu options?

#1 Post by ClariceS »

I can't figure out how to code the choice buttons so that previously selected choices are greyed out. I found this previous post viewtopic.php?f=8&t=12622 but no matter what I do with the given coding answers nothing works.

I notice the solution was posted back in 2011. Is the information in that post still accurate?

User avatar
Dovahkitteh
Veteran
Posts: 229
Joined: Wed Sep 02, 2015 4:51 pm
Completed: YDD, RE, CoB, Req
Projects: Red Embrace: Hollywood, The Black Hand
Organization: Argent Games
Tumblr: argentgames
Skype: Dovahkitteh
itch: argent-games
Contact:

Re: Change appearance of previously chosen menu options?

#2 Post by Dovahkitteh »

Hey there! Here's a sample of the screens code from my last project that served the same function as what you want to do. I had a few extra choice settings (locked/unlocked choices) as well, but this is just the base chosen/not chosen version.

The choice screen itself:

Code: Select all

screen choice(items):
    window: 
        style "menu_window"       
        background None
        xalign 0.5
        yalign 0.5
        
        vbox:
            style "choice_vbox"
            yalign 0.5
            xalign 0.5
            spacing 30
            
            for caption, action, chosen in items:
                
                if action:  

                    if not chosen: 
                        button:
                            action action
                            style "menu_choice_button"
                            focus_mask True
   
                            text caption style "menu_choice"
                    elif chosen == True:
                        button:
                            action action
                            style "menu_choice_chosen_button"
                            focus_mask True
   
                            text caption style "menu_choice_chosen"
                    
                else:
                    text caption style "menu_caption"
The styles below it:

Code: Select all

style choice_vbox is vbox
style menu_choice_button is button
style menu_choice_chosen_button is menu_choice_button:
    idle_background "gui/button/choice_chosen_idle_background.png" #replace with greyed out image or whatever you like
style menu_choice is button_text

style choice_vbox:
    xalign 0.5
    ypos 330
    yanchor 0.5

    spacing 44

style menu_choice_button is default:
    properties gui.button_properties("choice_button")

style menu_choice is default:
    properties gui.button_text_properties("choice_button")
    ypos -7
    xalign 0.5
    xpos 356

style menu_choice_chosen is default:
    properties gui.button_text_properties("choice_button")
    ypos -7
    xalign 0.5
    xpos 356
Let me know if this works/helps at all!
Image

Writer, Programmer, Designer

Programming/Design Commissions

Image Image

ClariceS
Newbie
Posts: 3
Joined: Wed Apr 10, 2013 12:44 am
Contact:

Re: Change appearance of previously chosen menu options?

#3 Post by ClariceS »

Thank you so much for replying! This gets me half way there, but I can't figure out how to change the text as well as the background image.

It's probably obvious, but I've been learning how to use ren'py for all of 48 hours now.

rayminator
Miko-Class Veteran
Posts: 793
Joined: Fri Feb 09, 2018 12:05 am
Location: Canada
Contact:

Re: Change appearance of previously chosen menu options?

#4 Post by rayminator »

for backgrounds for menu

Code: Select all

background "gui/overlay/main_menu.png"
for background for the game itself you put the background in images folder in the script you would put this

Code: Select all

scene imagename

User avatar
Dovahkitteh
Veteran
Posts: 229
Joined: Wed Sep 02, 2015 4:51 pm
Completed: YDD, RE, CoB, Req
Projects: Red Embrace: Hollywood, The Black Hand
Organization: Argent Games
Tumblr: argentgames
Skype: Dovahkitteh
itch: argent-games
Contact:

Re: Change appearance of previously chosen menu options?

#5 Post by Dovahkitteh »

ClariceS wrote: Sat Mar 17, 2018 10:09 pm Thank you so much for replying! This gets me half way there, but I can't figure out how to change the text as well as the background image.

It's probably obvious, but I've been learning how to use ren'py for all of 48 hours now.
Do you mean the text style for the previously chosen choice? That would be in here I think:

Code: Select all

style menu_choice_chosen is default:
    properties gui.button_text_properties("choice_button")
    hover_color "#ddd7d7" #example change
    ypos -7
    xalign 0.5
    xpos 356
Or alternatively you could put it right in here, within the screen itself:

Code: Select all

                    elif chosen == True:
                        button:
                            action action
                            style "menu_choice_chosen_button"
                            focus_mask True
   
                            text caption style "menu_choice_chosen" hover_color "#000" size 40 #example text changes
                    
                else:
                    text caption style "menu_caption"
Lemme know if this works or if you run into more problems!
Image

Writer, Programmer, Designer

Programming/Design Commissions

Image Image

ClariceS
Newbie
Posts: 3
Joined: Wed Apr 10, 2013 12:44 am
Contact:

Re: Change appearance of previously chosen menu options?

#6 Post by ClariceS »

I used your first example and that worked perfectly! Thank you so much, I'd been trying for hours just to do that simple thing, lol.

Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], Belgerum