Character specific menu screen doesn't load right image (SOLVED)

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
Geckos
Veteran
Posts: 471
Joined: Fri Aug 17, 2012 8:33 am
Completed: Brilliant Shadows, Perceptions of the Dead, The Phantom Icecream Truck
Projects: Embers of Magic, Pale Spectrum, Perceptions of the Dead
Organization: Ithaqua Labs
Tumblr: geckosart
Deviantart: sitaart
Contact:

Character specific menu screen doesn't load right image (SOLVED)

#1 Post by Geckos » Sat Sep 02, 2017 11:49 pm

I have my code set up to display a character unique code each time a menu: choice occurs, reflecting who's point of view the story is currently following.

This is the code for the menu box.

Code: Select all

screen choice:
    
    add "ui/choice_[screen_choice].png" xalign 0.5 yalign 0.5 at zoom_fade_in
    add "ui/changes.png" xalign 0.5 yalign 0.5 at choice_slide
    #text "Changes" font "yeti.ttf" size 50 color "4a110d" drop_shadow (3,3) at choice_slide_text
 
    window at zoom_fade_in_text:
        style "menu_window"        
        xalign 0.2
        yalign 0.2
       
        vbox:
            style "menu"
            spacing 27
           
            for caption, action, chosen in items:
               
                if action:  
                   
                    button:
                        action action
                        style "menu_choice_button"                        
 
                        text caption style "menu_choice"
                   
                else:
                    text caption style "menu_caption"
 
init -2 python:
    config.narrator_menu = True
   
    style.menu_window.set_parent(style.default)
    style.menu_choice.set_parent(style.button_text)
    style.menu_choice.clear()
    style.menu_choice_button.set_parent(style.button)
    style.menu_choice_button.xminimum = int(config.screen_width * 0.33)
    style.menu_choice_button.xmaximum = int(config.screen_width * 0.33)
   
    style.menu_choice.outlines = [(0, "#000000", 0, 0),]
    style.menu_choice.font = "bulldozer.ttf"
    style.menu_choice.size = 45
    style.menu_choice.color = "#4a110d"
    style.menu_choice.hover_color = "#ffffff"
    style.menu_choice.selected_color = "#ffffff"
    style.menu_choice_button.background = None
   
I then have various tags I call such as

Code: Select all

$ screen_choice = "ash"
$ screen_choice = "bel"
$ screen_choice = "aelf"
Regardless of where I put these call tags, I cannot get the menu/choice box to show the right face. It always displays the tag before last. If I roll-back and make the choice display again, it has the correct face.

This problem doesn't occur for sprite outfits, even though I use the same code for that.
I've tried declaring this.

Code: Select all

image changesthings = "ui/choice_[screen_choice].png"
And displaying that before the choices to force the image to change (and either instantly hiding it or showing it at 0 alpha) but still no luck.

I've also tried

Code: Select all

renpy.restart_interaction()
But that does not seem to work either.

Any help would be greatly appreciate! Thank you.

Attached is an image example.
The code to call Aelf's image is

Code: Select all

$ screen_choice = "aelf"
$renpy.restart_interaction()
$ screen_choice = "aelf"
(tried both before and after because stumped.)
Attachments
pale_spec_ui_problem.jpg
Last edited by Geckos on Sun Sep 03, 2017 3:03 am, edited 1 time in total.
Image ImageImage

User avatar
Geckos
Veteran
Posts: 471
Joined: Fri Aug 17, 2012 8:33 am
Completed: Brilliant Shadows, Perceptions of the Dead, The Phantom Icecream Truck
Projects: Embers of Magic, Pale Spectrum, Perceptions of the Dead
Organization: Ithaqua Labs
Tumblr: geckosart
Deviantart: sitaart
Contact:

Re: Character specific menu screen doesn't load right image

#2 Post by Geckos » Sun Sep 03, 2017 3:02 am

Got some code from a friend that works!

Replaced the screen code with:

Code: Select all

screen choice:
        if (screen_choice== "none"):
            add "ui/choice_none.png" xalign 0.5 yalign 0.5 at zoom_fade_in
        elif (screen_choice== "bel"):
            add "ui/choice_bel.png" xalign 0.5 yalign 0.5 at zoom_fade_in
        elif (screen_choice== "hek"):
            add "ui/choice_hek.png" xalign 0.5 yalign 0.5 at zoom_fade_in
        elif (screen_choice== "ash"):
            add "ui/choice_ash.png" xalign 0.5 yalign 0.5 at zoom_fade_in
        elif (screen_choice== "aku"):
            add "ui/choice_aku.png" xalign 0.5 yalign 0.5 at zoom_fade_in
        elif (screen_choice== "terra"):
            add "ui/choice_terra.png" xalign 0.5 yalign 0.5 at zoom_fade_in                        
        elif (screen_choice== "aelf"):
            add "ui/choice_aelf.png" xalign 0.5 yalign 0.5 at zoom_fade_in
                       
        add "ui/changes.png" xalign 0.5 yalign 0.5 at choice_slide
        #text "Changes" font "yeti.ttf" size 50 color "4a110d" drop_shadow (3,3) at choice_slide_text
     
        window at zoom_fade_in_text:
            style "menu_window"        
            xalign 0.2
            yalign 0.2
           
            vbox:
                style "menu"
                spacing 27
               
                for caption, action, chosen in items:
                   
                    if action:  
                       
                        button:
                            action action
                            style "menu_choice_button"                        
     
                            text caption style "menu_choice"
                       
                    else:
                        text caption style "menu_caption"
                    
Image ImageImage

Post Reply

Who is online

Users browsing this forum: Bing [Bot]