[SOLVED!] Action Return() not working on one screen, but works everywhere else?

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: 515
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:

[SOLVED!] Action Return() not working on one screen, but works everywhere else?

#1 Post by sasquatchii » Sat Jul 14, 2018 10:43 am

Hi, I'm currently working on coding the Yes/No prompt screen into my game - here's what it currently looks like:

Image

The "x" button at the top right uses the action return() function, and will return players back to the game if they click on it.

However, this doesn't work in-game if the player tries to quit and then clicks the "x" button at the top right of the menu. It works on all other menus, just not in-game. If I'm in game, I can even hover over it and the button itself will change to the "hover", and clicking on it does forwards along the rest of text/story progression in the game while the menu still stays up. I'm scratching my head trying to figure out why!

Here is the code I'm using:

Code: Select all

screen yesno_prompt:
    on "show" action With(dissolve)
    
    #modal True
    
    add "images/gui/yesno_background.png"
    
    imagemap:
        ground 'images/gui/yesno_ground.png'
        idle 'images/gui/yesno_idle.png' 
        hover 'images/gui/yesno_hover.png'
        alpha True
        # This is so that everything transparent is invisible to the cursor.
        
        
        hotspot (421, 306, 85, 45) action yes_action 
        hotspot (557, 306, 65, 45) action no_action 
        hotspot (886, 176, 35, 35) action Return()
  

    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_load_save.png"
        
        
    elif message == layout.QUIT:
        add "images/gui/yesno_quit.png"
        
        
    elif message == layout.MAIN_MENU:
        add "images/gui/yesno_main_menu.png"
        

init python:
    config.quit_action = Quit()
Any ideas or help is greatly appreciated!
Last edited by sasquatchii on Sat Jul 14, 2018 10:21 pm, edited 1 time in total.
ImageImageImage

User avatar
trooper6
Lemma-Class Veteran
Posts: 3326
Joined: Sat Jul 09, 2011 10:33 pm
Projects: A Close Shave
Location: Medford, MA
Contact:

Re: Action Return() not working on one screen, but works everywhere else?

#2 Post by trooper6 » Sat Jul 14, 2018 10:59 am

Rather than Return, have your x-button just do the no_action just as the no button does.
A Close Shave:
*Last Thing Done (Jul 21): Worked out 2 Characters, 1 Sprite. Re-did my character callbacks. Created all new GUI elements for the new GUI. Fixed the check/radio/slider problem. Rebuilt the game to work with the new gui system. Finished coding emotions and camera for 1/10 labels.
*Currently Doing: Coding of emotions and camera for the labels--On 2/10
*First Next thing to do: Code in all CG and special animation stuff
*Next Next thing to do: Set up film animation
*Other Thing to Do: Do SFX and Score (maybe think about eye blinks?)
Check out My Clock Cookbook Recipe: http://lemmasoft.renai.us/forums/viewto ... 51&t=21978

User avatar
sasquatchii
Miko-Class Veteran
Posts: 515
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: Action Return() not working on one screen, but works everywhere else?

#3 Post by sasquatchii » Sat Jul 14, 2018 10:21 pm

trooper6 wrote:
Sat Jul 14, 2018 10:59 am
Rather than Return, have your x-button just do the no_action just as the no button does.
This worked!! THANK YOU SO MUCH!

I feel kinda dumb for not coming up with this solution (in hindsight it seems so obvious) - but I really appreciate your help :D
ImageImageImage

User avatar
trooper6
Lemma-Class Veteran
Posts: 3326
Joined: Sat Jul 09, 2011 10:33 pm
Projects: A Close Shave
Location: Medford, MA
Contact:

Re: [SOLVED!] Action Return() not working on one screen, but works everywhere else?

#4 Post by trooper6 » Sun Jul 15, 2018 12:23 am

My pleasure!
A Close Shave:
*Last Thing Done (Jul 21): Worked out 2 Characters, 1 Sprite. Re-did my character callbacks. Created all new GUI elements for the new GUI. Fixed the check/radio/slider problem. Rebuilt the game to work with the new gui system. Finished coding emotions and camera for 1/10 labels.
*Currently Doing: Coding of emotions and camera for the labels--On 2/10
*First Next thing to do: Code in all CG and special animation stuff
*Next Next thing to do: Set up film animation
*Other Thing to Do: Do SFX and Score (maybe think about eye blinks?)
Check out My Clock Cookbook Recipe: http://lemmasoft.renai.us/forums/viewto ... 51&t=21978

Post Reply

Who is online

Users browsing this forum: JackDoe