Yes/No Prompt Woes (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
sasquatchii
Miko-Class Veteran
Posts: 552
Joined: Fri Jul 04, 2014 7:48 am
Completed: A Day in the Life of a Slice of Bread
Deviantart: sasquatchix
Soundcloud: sasquatchii
itch: sasquatchii
Location: South Carolina
Contact:

Yes/No Prompt Woes (Solved!)

#1 Post by sasquatchii »

Hi! So today I finally figured out how to customize the "Are you sure you want to quit?" menu in my game. It's pretty simple looking, but it is just a transparent bubble that appears over whatever background image is present.

Here's what it looks like in the main menu.

And in game with place holder bg/sprites.

But in the main menu, this is what appears if you hit the X in the top right of the window, instead of hitting the quit button within renpy.

What I'd like to happen if the player hits the x button in the main menu would be for them to see the same thing that they'd see in the first link. It doesn't do this when the game has started, or on any other screen, only the main menu.

Here is the code I'm using to do this:

Code: Select all

screen yesno_prompt(message, yes_action, no_action):

    #modal True
    
    add "images/gui/yesnobg.png"

    imagemap:
        ground 'images/gui/yesno_ground.png'
        idle 'images/gui/yesno_idle.png' 
        hover 'images/gui/yesno_hover.png'
        
        
        hotspot (795,628,100,48) action yes_action
        hotspot (1064,628,86,48) action no_action

  

    if message == layout.ARE_YOU_SURE:
        add "images/gui/yesno_are_you_sure.png"
        
    elif message == layout.DELETE_SAVE:
        add "images/gui/yesno_delete_save.png"
        
    elif message == layout.OVERWRITE_SAVE:
        add "images/gui/yesno_overwrite_save.png"
        
    elif message == layout.LOADING:
        add "images/gui/yesno_loading.png"
        
    elif message == layout.QUIT:
        add "images/gui/yesno_quit.png"
        
    elif message == layout.MAIN_MENU:
        add "images/gui/yesno_main_menu.png" 
If anyone has any ideas or suggestions to fix this, I would greatly appreciate it! Thank you for reading.
Last edited by sasquatchii on Sun Oct 19, 2014 9:10 pm, edited 1 time in total.
ImageImage

User avatar
yuucie
Regular
Posts: 164
Joined: Sun Jun 22, 2014 4:04 am
Completed: NaNoReNo[2015] Those Without Names
Tumblr: an-na-ko
Location: Toronto, Canada
Contact:

Re: Yes/No Prompt with transparent background causing proble

#2 Post by yuucie »

I had this same problem before too. Here's the solution I was given:

Add the extra line under layout.QUIT (replace the png images with your own). My background.png included the yes-no thing pasted on it, so you may have to add extra lines to add your yesno image.

Code: Select all

    elif message == layout.QUIT:
        add "UI/yesno-ground.png"
        if main_menu:
            add "background.png"

User avatar
sasquatchii
Miko-Class Veteran
Posts: 552
Joined: Fri Jul 04, 2014 7:48 am
Completed: A Day in the Life of a Slice of Bread
Deviantart: sasquatchix
Soundcloud: sasquatchii
itch: sasquatchii
Location: South Carolina
Contact:

Re: Yes/No Prompt with transparent background causing proble

#3 Post by sasquatchii »

Thank you yuucie!! This TOTALLY WORKED!

I love how coding can make me feel like a genuis and a dummy simultaneously! I would have never figured that out if you hadn't posted that. Thanks again!
ImageImage

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: Yes/No Prompt with transparent background causing proble

#4 Post by OokamiKasumi »

yuucie wrote:I had this same problem before too. Here's the solution I was given:

Add the extra line under layout.QUIT (replace the png images with your own). My background.png included the yes-no thing pasted on it, so you may have to add extra lines to add your yesno image.

Code: Select all

    elif message == layout.QUIT:
        add "UI/yesno-ground.png"
        if main_menu:
            add "background.png"
Oh! Thank you!
-- I didn't have this in my backgrounds tutorial because I normally use full-screen jpgs for my backgrounds. With all due respect, I have added it to the tutorial.
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

Post Reply

Who is online

Users browsing this forum: BBN_VN