Overlay Yes/No Prompt when leaving the game

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
Keinart
Regular
Posts: 133
Joined: Sun May 13, 2012 8:28 pm
Completed: One Thousand Lies
Projects: Lotus Reverie
Organization: Keinart Lobre
Tumblr: keinart
itch: keinart
Location: Spain
Contact:

Overlay Yes/No Prompt when leaving the game

#1 Post by Keinart »

I changed the Yes/No Prompt background to a transparent one so the screen gets darker when the message appears. It works fine except when pressing the X in windows mode to exit just as you can see in the picture. Is there anyway to change this?

Image

Basically I want to see how the screen gets darker instead of changing completly, no matter if I'm in the middle of the novel or in any menu.

Thanks in advance.

Crazy Li
Regular
Posts: 113
Joined: Fri Jan 03, 2014 3:35 pm
Contact:

Re: Overlay Yes/No Prompt when leaving the game

#2 Post by Crazy Li »

You're lucky. In Ren'py 6.16, clicking the 'X' there just gives me an error message (regular quitting works fine though). At least you can click it without crashing your game. I suspect something changed in newer versions of Ren'py that made clicking the 'X' call the screen differently than activating "Quit()" because in the version I first got (6.13), it didn't have that error message problem. Clicking the 'X' functioned 100% the same as Quitting in any other fashion. It also did the darker message thing that you wanted perfectly fine for me.

I often find that when the background changes like that, it's an issue with the fact that it's a menu. When Ren'py calls a menu, it calls it as a brand new screen, erasing any other open menus (including the main menu). If you try for a transparent BG, you'll end up getting that checkerboard behind it because there is no background under your new menu. Sometimes even with simple prompts, it can get confused and resort to this behavior. Without re-doing the way the screens function significantly, you pretty much can't see anything behind a menu unless the only thing under it was the game itself. If you go from a menu to another menu, you lose that game behind it effect.

DesertFox
Regular
Posts: 196
Joined: Sun Jul 28, 2013 1:29 pm
Completed: Over The Hills And Far Away
Projects: My Little Dictator
Organization: WarGirl Games
Contact:

Re: Overlay Yes/No Prompt when leaving the game

#3 Post by DesertFox »

If you go to screens.rpy and to your Yes/No prompt section you'll see:

Code: Select all

screen yesno_prompt:

    tag menu
    modal True
The line 'tag menu' means that this screen will replace other screens instead of just overlay them. So just comment with a # or remove it.

Code: Select all

screen yesno_prompt:

    #tag menu
    modal True

User avatar
Keinart
Regular
Posts: 133
Joined: Sun May 13, 2012 8:28 pm
Completed: One Thousand Lies
Projects: Lotus Reverie
Organization: Keinart Lobre
Tumblr: keinart
itch: keinart
Location: Spain
Contact:

Re: Overlay Yes/No Prompt when leaving the game

#4 Post by Keinart »

DesertFox wrote:If you go to screens.rpy and to your Yes/No prompt section you'll see:

Code: Select all

screen yesno_prompt:

    tag menu
    modal True
The line 'tag menu' means that this screen will replace other screens instead of just overlay them. So just comment with a # or remove it.

Code: Select all

screen yesno_prompt:

    #tag menu
    modal True
Thanks for replying.
I tried this but it doesn't seem to work, and I haven't made any changes on the code for the Yes/No Prompt so I don't really think I messed anywhere :? In fact, in any other menu or part of the game, it seems to work fine, it only changes the background completly when I press the X to exit. Pics related:

Image

Image

Crazy Li wrote:You're lucky. In Ren'py 6.16, clicking the 'X' there just gives me an error message (regular quitting works fine though). At least you can click it without crashing your game. I suspect something changed in newer versions of Ren'py that made clicking the 'X' call the screen differently than activating "Quit()" because in the version I first got (6.13), it didn't have that error message problem. Clicking the 'X' functioned 100% the same as Quitting in any other fashion. It also did the darker message thing that you wanted perfectly fine for me.

I often find that when the background changes like that, it's an issue with the fact that it's a menu. When Ren'py calls a menu, it calls it as a brand new screen, erasing any other open menus (including the main menu). If you try for a transparent BG, you'll end up getting that checkerboard behind it because there is no background under your new menu. Sometimes even with simple prompts, it can get confused and resort to this behavior. Without re-doing the way the screens function significantly, you pretty much can't see anything behind a menu unless the only thing under it was the game itself. If you go from a menu to another menu, you lose that game behind it effect.
So, maybe it's something related with the new version? I just updated to it so maybe is related

Crazy Li
Regular
Posts: 113
Joined: Fri Jan 03, 2014 3:35 pm
Contact:

Re: Overlay Yes/No Prompt when leaving the game

#5 Post by Crazy Li »

So only yes/no when you click the X? If you click your "Salir" button, that yes/no prompt works right? If that's the case, I really do suspect the version is the culprit.

User avatar
Keinart
Regular
Posts: 133
Joined: Sun May 13, 2012 8:28 pm
Completed: One Thousand Lies
Projects: Lotus Reverie
Organization: Keinart Lobre
Tumblr: keinart
itch: keinart
Location: Spain
Contact:

Re: Overlay Yes/No Prompt when leaving the game

#6 Post by Keinart »

Crazy Li wrote:So only yes/no when you click the X? If you click your "Salir" button, that yes/no prompt works right? If that's the case, I really do suspect the version is the culprit.
Exactly, if I press "Salir" it works fine. It doesn't really make any sense :?

Crazy Li
Regular
Posts: 113
Joined: Fri Jan 03, 2014 3:35 pm
Contact:

Re: Overlay Yes/No Prompt when leaving the game

#7 Post by Crazy Li »

Yep, that's my problem. Except worse because it won't even show the yes/no prompt, instead just giving me an error message. Something about overlays or something. I just stick to my older version because it works without errors.

User avatar
Pierrou
Regular
Posts: 53
Joined: Fri Dec 05, 2014 8:25 pm
Projects: Togainu no Chi, DMMD, Omerta, ...
Skype: pierrouney
Location: France
Contact:

Re: Overlay Yes/No Prompt when leaving the game

#8 Post by Pierrou »

I have the same problem... It works fine everywhere but not when i click on the "Red X" :/

Exactly the same bug...

Does anyone know why ?

I'm on Mac OS X Yosemite // Ren'Py 6.18.3
Sorry for my english, it's not my native language. :s

User avatar
OokamiKasumi
Eileen-Class Veteran
Posts: 1779
Joined: Thu Oct 14, 2010 3:53 am
Completed: 14 games released -- and Counting.
Organization: DarkErotica Games
Deviantart: OokamiKasumi
Location: NC, USA
Contact:

Re: Overlay Yes/No Prompt when leaving the game

#9 Post by OokamiKasumi »

Have you tried this solution?
http://lemmasoft.renai.us/forums/viewto ... 21#p343438

Though this is normally used with an Imagemap it can be adapted by adding just this to the Top:

Code: Select all

# Yes/No Prompt

screen yesno_prompt(message, yes_action, no_action):
    modal True

    # window:
        # style "gm_root"

    if message == layout.QUIT:
        if main_menu:
             add "background.jpg"
However, this adds a background to ALL the Quit screens, (and only the Quit screens.)
Ookami Kasumi ~ Purveyor of fine Smut.
Most recent Games Completed: For ALL my completed games visit: DarkErotica Games

"No amount of great animation will save a bad story." -- John Lasseter of Pixar

User avatar
Yuuji
Regular
Posts: 96
Joined: Tue Jan 20, 2015 3:08 am
Location: Russia, Perm
Contact:

Re: Overlay Yes/No Prompt when leaving the game

#10 Post by Yuuji »

But what should I do if I want previous background to stay without changes? Yes/no prompt should appear in front of all layers, right?(modal True) Why this screen clears all layers behind it in case of "red x" click?

User avatar
xela
Lemma-Class Veteran
Posts: 2481
Joined: Sun Sep 18, 2011 10:13 am
Contact:

Re: Overlay Yes/No Prompt when leaving the game

#11 Post by xela »

It's like dejavu from 10 days ago...
Like what we're doing? Support us at:
Image

User avatar
shivanshs9
Regular
Posts: 54
Joined: Sun Jul 20, 2014 1:59 pm
Projects: The Destiny(http://thedestiny-cxz.blogspot.com)
Organization: Cyber-X-Zone
Location: India
Contact:

Re: Overlay Yes/No Prompt when leaving the game

#12 Post by shivanshs9 »

Just like what xela suggested...
In the Ren'Py documentation:config.quit_action
First, use the bit of code as DesertFox suggested and then add this in options.rpy under init python...

Code: Select all

init python:
    config.quit_action = Quit()
And, it's done!
"Destiny is a no matter of chance
It is a matter of choice
It is not a thing to be waited for
It is a thing to be achieved..."

-William Jennings Bryan
If you can dream and not make dreams your master;
If you can think and not make thoughts your aim,
If you can meet with Triumph and Disaster;
And treat those two impostors just the same,
Only then can you ever win against yourself...

User avatar
Yuuji
Regular
Posts: 96
Joined: Tue Jan 20, 2015 3:08 am
Location: Russia, Perm
Contact:

Re: Overlay Yes/No Prompt when leaving the game

#13 Post by Yuuji »

Thank you very much!

User avatar
Pierrou
Regular
Posts: 53
Joined: Fri Dec 05, 2014 8:25 pm
Projects: Togainu no Chi, DMMD, Omerta, ...
Skype: pierrouney
Location: France
Contact:

Re: Overlay Yes/No Prompt when leaving the game

#14 Post by Pierrou »

xela wrote:It's like dejavu from 10 days ago...

Haaaa that Xela :mrgreen: I love you <3
Sorry for my english, it's not my native language. :s

Post Reply

Who is online

Users browsing this forum: Princesky