yes_action and no_action aren't returning my screen [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
Stapper
Regular
Posts: 96
Joined: Wed Feb 27, 2013 9:54 pm
Contact:

yes_action and no_action aren't returning my screen [Solved]

#1 Post by Stapper »

Whenever I return from a Yes/No Prompt the game doesn't bring up the screen again from which the prompt was called. I think it doesn't have a normal Return() function.
This breaks my game because I cannot continue playing when this happens.

Two examples:
1. I'm on a screen and call a save game screen, I select an occupied slot, I get the overwrite Yes/No Prompt, I select Yes, I'm returned to the label but the screen doesn't appear again.
2. I'm on a screen and open the in-game menu, I press the quit button, I get the confirmation Yes/No Prompt, I select No, I'm returned to the label but the screen doesn't appear again.
Note: In example 2, when I press the Escape button the screen appears again. This doesn't work for example 1.

Is there a way I can either customize the yes_action and no_action or add something to the Yes/No Prompt to fix this problem?
Last edited by Stapper on Sun Jun 01, 2014 2:18 am, edited 1 time in total.

User avatar
chocoberrie
Veteran
Posts: 254
Joined: Wed Jun 19, 2013 10:34 pm
Projects: Marshmallow Days
Contact:

Re: yes_action and no_action aren't returning my screen

#2 Post by chocoberrie »

Can you provide your code?

Here's what I have for my yes/no prompt, and I don't have screen issues...? Sorry I can't do much more than that to help ^^;;

Code: Select all

    ##Yes/no menu imagemap
    imagemap:
        ground 'GUI/yesno/yesno_ground.png'
        idle 'GUI/yesno/yesno_idle.png' 
        hover 'GUI/yesno/yesno_hover.png'
        alpha False
        
        hotspot (278, 337, 97, 53) action yes_action
        hotspot (447, 340, 81, 53) action no_action 
        
    #text _(message):
        #xalign 0.5
        #yalign 0.5

    if message == layout.ARE_YOU_SURE:
        imagemap:
            idle 'GUI/yesno/overwrite_save_yesno-idle.png'
            hover 'GUI/yesno/overwrite_save_yesno-hover.png'
            hotspot (278, 337, 97, 53) action yes_action
            hotspot (447, 340, 81, 53) action no_action
        
        add "GUI/yesno/yesno_are_you_sure.png"
 
    elif message == layout.DELETE_SAVE:
        add "GUI/yesno/yesno_delete_save.png"
        
    elif message == layout.OVERWRITE_SAVE:
        add "GUI/yesno/yesno_overwrite_save.png"
        
    elif message == layout.LOADING:
        add "GUI/yesno/yesno_loading.png"
        
    elif message == layout.QUIT:
        add "GUI/yesno/yesno_quit.png"
        
    elif message == layout.MAIN_MENU:
        add "GUI/yesno/yesno_main_menu.png" 

Asceai
Eileen-Class Veteran
Posts: 1258
Joined: Fri Sep 21, 2007 7:13 am
Projects: a battle engine
Contact:

Re: yes_action and no_action aren't returning my screen

#3 Post by Asceai »

Whenever I return from a Yes/No Prompt the game doesn't bring up the screen again from which the prompt was called. I think it doesn't have a normal Return() function.
This breaks my game because I cannot continue playing when this happens.

Two examples:
1. I'm on a screen and call a save game screen, I select an occupied slot, I get the overwrite Yes/No Prompt, I select Yes, I'm returned to the label but the screen doesn't appear again.
2. I'm on a screen and open the in-game menu, I press the quit button, I get the confirmation Yes/No Prompt, I select No, I'm returned to the label but the screen doesn't appear again.
Note: In example 2, when I press the Escape button the screen appears again. This doesn't work for example 1.

Is there a way I can either customize the yes_action and no_action or add something to the Yes/No Prompt to fix this problem?
I have absolutely no idea what you are talking about.

Code: Select all

screen test:
  vbox:
    textbutton "Return" action Return()
    textbutton "Save" action ShowMenu("save")
    textbutton "Quit" action Quit()
label start:
    call screen test
    "Testing"
    return
I tried doing all the stuff you described and none of them caused the screen to disappear.

The save screen doesn't disappear after saving a game. If you click Quit from the rightclick menu, it doesn't disappear either.

User avatar
Stapper
Regular
Posts: 96
Joined: Wed Feb 27, 2013 9:54 pm
Contact:

Re: yes_action and no_action aren't returning my screen

#4 Post by Stapper »

First of all, thanks for the replies.
I'm using the default Yes/No Prompt screen, I didn't make any changes except styling the textbuttons.

Here is my basic setup (I left all the rest out since it's just text and more buttons)

Code: Select all

label hub_level1:
    call screen hub_level1

    $ result = _return

    if result == "inn":
        call screen hub_level1_inn

screen hub_level1:
    modal True
    imagebutton:
        xpos 560
        ypos 150
        idle LiveComposite((100,100), (0,0), "images/sign_inn.png", (0,0), Text(""))
        hover LiveComposite((100,100), (0,0), sign_inn_hover, (0,0), Text(""))
        hovered [Show("hub_tooltip", tt="Inn")]
        unhovered Hide("hub_tooltip")
        action [Hide("hub_tooltip"), Return("inn")]

screen hub_level1_inn:
    tag menu
    modal True
    textbutton "Spend the night to save your progress" style style.button['custom'] xpos 35 ypos 440 action [Hide('hub_level1_inn'), Show('hub_level1_inn_save')]
And here is the entire save screen:

Code: Select all

screen hub_level1_inn_save:
    tag menu
    modal True
    zorder 8
    
    window:
        background "images/backgrounds/Lvl1_hub_test.png"

    vbox xalign 0.5 yalign 0.4:
        window:
            style_group "mm"
            xminimum 960
            xmaximum 960
            yminimum 540
            ymaximum 540

            add "images/sign_inn.png" xpos 25 ypos 25
            text "Welcome to the Nightgate Inn." font "Meath.ttf" size 36 xpos 200 ypos 60
            
            hbox xalign 0.5 yalign 0.3:
                xminimum 650
                xmaximum 650
                yminimum 500
                ymaximum 500
                $ columns = 2
                $ rows = 5
                
                # Display a grid of file slots.
                grid columns rows:
                    xpos 14
                    ypos 90
                    transpose True
                    xfill True
                    style_group "file_picker"
            
                    # Display ten file slots, numbered 1 - 10.
                    for i in range(1, columns * rows + 1):

                        # Each file slot is a button.
                        button:
                            action FileAction(i)
                            xfill True
                            xminimum 290
                            xmaximum 290
                            yminimum 68
                            ymaximum 68

                            has hbox

                            # Add the screenshot.
                            add FileScreenshot(i) xpos 0 ypos 7
                    
                            $ file_name = FileSlotName(i, columns * rows)
                            $ file_time = FileTime(i, empty=_("Empty Slot."))
                            $ save_name = FileSaveName(i)

                            text "[file_name]. [file_time!t]\n[save_name!t]" xpos 20 ypos 24

                            key "save_delete" action FileDelete(i)

    textbutton "?" style style.button['custom'] xpadding 16 xalign .01 yalign .99 action [Hide('hub_level1_inn_save'), ShowMenu('menu_help')]
    textbutton "Leave the inn" style style.button['custom'] xalign .99 yalign .99 action [Hide('hub_level1_inn_save'), Jump('hub_level1')]
After that when I return from the Yes/No Prompt, I am returned to "label hub_level1" and I don't get the screen anymore.

Asceai
Eileen-Class Veteran
Posts: 1258
Joined: Fri Sep 21, 2007 7:13 am
Projects: a battle engine
Contact:

Re: yes_action and no_action aren't returning my screen

#5 Post by Asceai »

Try removing 'tag menu' from the two inn screens. It shouldn't be necessary here and it's probably causing you issues.

User avatar
Stapper
Regular
Posts: 96
Joined: Wed Feb 27, 2013 9:54 pm
Contact:

Re: yes_action and no_action aren't returning my screen

#6 Post by Stapper »

Yep that is it! Good call man :)

I'm going to remove the tag menu from all my screens, I thought they would help but are nothing but trouble it seems!

Thanks a lot!

storymasterq
Newbie
Posts: 12
Joined: Mon May 19, 2014 10:45 pm
Contact:

Re: yes_action and no_action aren't returning my screen [Sol

#7 Post by storymasterq »

For noobs such as myself, can anyone explain tag menu (and other tags, if there are any) or point at the docs where it is explained?

Thanks
SQ
Proofreading for Free - here - Current project(s): None

Currently working on: My first VN, a futuristic slice-of-life with a hint of romance.

Asceai
Eileen-Class Veteran
Posts: 1258
Joined: Fri Sep 21, 2007 7:13 am
Projects: a battle engine
Contact:

Re: yes_action and no_action aren't returning my screen [Sol

#8 Post by Asceai »

storymasterq wrote:For noobs such as myself, can anyone explain tag menu (and other tags, if there are any) or point at the docs where it is explained?

Thanks
SQ
http://renpy.org/doc/html/screens.html#screen-statement

Basically, it's just used so that if you have a bunch of screens but only want one to be shown at a time, you can tag them all with the same thing to have renpy ensure this.

Post Reply

Who is online

Users browsing this forum: No registered users