Yes/No prompt background

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
ThumperMiggles
Newbie
Posts: 19
Joined: Wed Oct 07, 2009 10:05 pm
Location: USA
Contact:

Yes/No prompt background

#1 Post by ThumperMiggles »

Hi there--I'm having some trouble adjusting the yes/no prompt when I quit out of certain screens.

> Quitting out of the main menu gives me a "transparent" background--I could set this to an actual image or color to fix the problem but the background on the main menu pans upward and I don't want this image to jump.
(Quitting from main menu: http://puu.sh/hm3LV/633449201e.png )
> Quitting out of the loading screen when clicked from the main menu reproduces the same problem.

> Quitting from the text of the game itself works fine!
(Game text: http://puu.sh/hm3OR/c6d82019e6.png and quitting from game: http://puu.sh/hm3R4/3ef2496da1.png )

> But when quitting from the save/load or preference screens, instead of displaying the yes/no as an overlay (on top of the current menu), it displays the current background in-game.
(Preferences screen: http://puu.sh/hlzYq/c3331ee1eb.png Save screen: http://puu.sh/hlzXA/fe580fa7fc.png Quitting out of either of these: http://puu.sh/hm3R4/3ef2496da1.png )

I'd like to have the yes/no displayed as an overlay on top of my save/load and preference screens instead of changing the background back to the game background. Any ideas?

The code for my yes/no prompt is below:

Code: Select all

screen yesno_prompt(message, yes_action, no_action):
    modal True
    imagemap:
        alpha 0.0
        ground 'yesno.png'
        idle 'yesno_idle.png' 
        hover 'yesno_selected.png'
        hotspot (475,300, 60, 35) action yes_action
        hotspot (575, 300, 55, 35) action no_action
    
    if message == layout.ARE_YOU_SURE:
        add "yesno_areyousure.png"
 
    elif message == layout.DELETE_SAVE:
        add "yesno_deletesave.png"
        
    elif message == layout.OVERWRITE_SAVE:
        add "yesno_overwritesave.png"
        
    elif message == layout.LOADING:
        add "yesno_loading.png"
        
    elif message == layout.QUIT:
        add "yesno_quit.png"
        
    elif message == layout.MAIN_MENU:
        add "yesno_mainmenu.png"

User avatar
Marionette
Regular
Posts: 128
Joined: Thu Apr 21, 2011 12:04 pm
Completed: https://marionette.itch.io/
Projects: Get Meowt of Here
Deviantart: rexx9224
itch: marionette
Location: Ireland
Discord: Marionette#2995
Contact:

Re: Yes/No prompt background

#2 Post by Marionette »

We were having a similar issue in our nanoreno game, and to get around it i just hijacked the quit screen and added a copy of the main menu bg for it, since its the only real one that will pop up like this before any bgs have been set.

Code: Select all

    if message == layout.QUIT:
        add "img/ui/splashground.png"
However this has the side effect of always showing the main menu bg when the player tries to quit (but since they are quitting its probably not as big a deal as having a blank bg). There might be a better way around this, but this was what we went with in the end.

We had some other transparent menus that gave us similar trouble, but since we could call those directly we just called them via a intermediate screen which added the bg if called from the main menu like so:

Code: Select all

screen main_menu():
    tag menu
    imagemap:
        auto "img/ui/splash%s.png"        
        hotspot (586, 321, 148, 22) action ShowMenu("mmpreferences")

screen mmpreferences():
    tag menu
    add "img/ui/splashground.png" 
    use preferences

As for your quit screen not appearing as an overlay it should appear that way as long as you dont use the same tags in both menus, as using the same tag will cause one screen to replace the other.

If you used my previous suggestion to solve the quit from main menu thing, then you'll never be able to overlay the quit message as it would have its own bg now, but the other messages, eg for overwriting saves etc, should all show fine overlaid.
My code for the yesno prompt isn't that far from what you have there and it works for me for those messages.
http://i.imgur.com/lMwUGQI.png
http://i.imgur.com/P1pAKV6.png


Hopefully this helps. :3


Edit: Just noticed you said you didn't want your animated menu to jump - Don't think this will be much help with your main menu quit problems after all. Sorry. :(

ThumperMiggles
Newbie
Posts: 19
Joined: Wed Oct 07, 2009 10:05 pm
Location: USA
Contact:

Re: Yes/No prompt background

#3 Post by ThumperMiggles »

Hey there—thanks for the reply (it's super appreciated!).

I don't really mind the main menu background so much as I mind the yes/no screen failing to overlay—it doesn't have a tag menu in it, so I'm curious as to whether or not it's closing the game menu/saveload menu when I try to quit out of the game? (That seems like it'd be the case, since when the yes/no prompt shows up, it's over the current game background). The modal is also set to true—is there something I'm missing?

ThumperMiggles
Newbie
Posts: 19
Joined: Wed Oct 07, 2009 10:05 pm
Location: USA
Contact:

Re: Yes/No prompt background

#4 Post by ThumperMiggles »

Bumping this up!

User avatar
SinnyROM
Regular
Posts: 166
Joined: Mon Jul 08, 2013 12:25 am
Projects: Blue Birth
Organization: Cosmic Static Games
Contact:

Re: Yes/No prompt background

#5 Post by SinnyROM »

I remember having this issue as well, but I no longer see the checkerboard transparent background, even while editing a brand new project.
What version of Renpy are you using? I updated to the latest version yesterday (6.99.3.404) and my gut tells me this is the reason.

ThumperMiggles
Newbie
Posts: 19
Joined: Wed Oct 07, 2009 10:05 pm
Location: USA
Contact:

Re: Yes/No prompt background

#6 Post by ThumperMiggles »

I'm on 6.99.1.329. I've heard that quitting from the main menu can be an issue with background, but nothing about the overlay problem I've been having--what was your problem like? (Did you fix it?)

User avatar
SinnyROM
Regular
Posts: 166
Joined: Mon Jul 08, 2013 12:25 am
Projects: Blue Birth
Organization: Cosmic Static Games
Contact:

Re: Yes/No prompt background

#7 Post by SinnyROM »

EDIT: I found it, thanks to this and this. To force the X button to use the same Quit function as the menu's Quit button:

Code: Select all

init python:
    config.quit_action = Quit()
So if you're able to get your Yes/No prompt working, then all methods of quitting the game should overlay on top properly. If I have some time later today, I'll see if I can work out the solution using an imagemap instead.

-

My Yes/No prompt contains modal True too so you've got that covered. Each time I click Quit, the Yes/No prompt is on top of the current screen and works as expected. I didn't use an imagemap for mine though so I'm not sure if that affects this issue.

But, I actually found out that clicking the X button to quit brings up the transparent background again. From the game it works fine, only the main menu is affected by this.

I wonder if we're missing anything?

Code: Select all

screen main_menu(**kwargs):

    tag menu
    
    # Uses a screen that changes main menu background depending on endings
    use mmenu_bg 

    # The main menu buttons.
    window:
        #...
            textbutton _("Quit") action Quit(confirm=True) xalign 0.5

Code: Select all

screen navigation():

    # The background of the game menu.
    if not main_menu:
        use gmenu_bg
    else:
        use mmenu_bg
                
    # The various buttons.
    window:
        # ...
            textbutton _("Quit") action Quit(confirm=True) xalign 0.5

Code: Select all

screen preferences(**kwargs):

    tag menu

    use navigation        
    use header("system")
        
    window:
        # ...

Code: Select all

screen yesno_prompt(message, yes_action, no_action, **kwargs):

    modal True
                        
    use dimmer("black") # dims everything behind the yes/no prompt
    
    window:
        # ...
Attachments
Quit from main menu (X button in window)
Quit from main menu (X button in window)
Quit from main menu (Quit button)
Quit from main menu (Quit button)
Quit from System (both game and main menu, with using Quit button and X button)
Quit from System (both game and main menu, with using Quit button and X button)

ThumperMiggles
Newbie
Posts: 19
Joined: Wed Oct 07, 2009 10:05 pm
Location: USA
Contact:

Re: Yes/No prompt background

#8 Post by ThumperMiggles »

Adding
config.quit_action = Quit()

to the options.py fixed everything--thanks so much!

Surprisingly, even when I hit x on the main menu, it still shows up with my panning animated background: probably because the background of the main menu isn't set with the mm_root, but an add image.

User avatar
nyaatrap
Crawling Chaos
Posts: 1824
Joined: Mon Feb 13, 2012 5:37 am
Location: Kimashi Tower, Japan
Contact:

Re: Yes/No prompt background

#9 Post by nyaatrap »

One note. To work the Quit action on the developer menu, set zorder of the yesno_screen over 1001. Otherwise, it won't work with the developer menu.

Post Reply

Who is online

Users browsing this forum: Google [Bot], Semrush [Bot]