Hello, I have a mini game that runs through a creator defined displayable, and it is working well.
However I have run into a problem.
The player can pause the minigame and exit it by pressing ESC while on the minigame screen.
However, if the player clicks the X(close) button at the top of the window, the game does not pause and it is overlayed with the Are you sure you want to quit screen.
This all works correctly except I want to send my minigame a message to pause immediately so that the user can make their choice without the game screen still moving in the background.
Event triggered on clicking the X(close) button?
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.
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.
- ChroniclerOfLegends
- Regular
- Posts: 53
- Joined: Thu Feb 16, 2017 5:57 pm
- Projects: Scifi Non-Linear Visual Novel/Arcade/Adventure game. (No name yet)
- Contact:
- xavimat
- Eileen-Class Veteran
- Posts: 1461
- Joined: Sat Feb 25, 2012 8:45 pm
- Completed: Yeshua, Jesus Life, Cops&Robbers
- Projects: Fear&Love
- Organization: Pilgrim Creations
- Github: xavi-mat
- itch: pilgrimcreations
- Location: Spain
- Discord: xavimat
- Contact:
Re: Event triggered on clicking the X(close) button?
I've tried using the special label "quit", but it's called after the confirm screen.
The only solution I can think of is an action in the Confirm Screen to stop the minigame, for example, SetVariable() or Function().
The only solution I can think of is an action in the Confirm Screen to stop the minigame, for example, SetVariable() or Function().
Code: Select all
screen confirm(message, yes_action, no_action):
on "show" action Function("stopmyminigame") ## <<-- Add this line
on "show" action SetVariable("minigamestopped", True) ## <<-- Or this one
# ... The rest of the screen...
Comunidad Ren'Py en español: ¡Únete a nuestro Discord!
Rhaier Kingdom A Ren'Py Multiplayer Adventure Visual Novel.
Cops&Robbers A two-player experiment | Fear&Love Why can't we say I love you?
Honest Critique (Avatar made with Chibi Maker by ~gen8)
Rhaier Kingdom A Ren'Py Multiplayer Adventure Visual Novel.
Cops&Robbers A two-player experiment | Fear&Love Why can't we say I love you?
Honest Critique (Avatar made with Chibi Maker by ~gen8)
- ChroniclerOfLegends
- Regular
- Posts: 53
- Joined: Thu Feb 16, 2017 5:57 pm
- Projects: Scifi Non-Linear Visual Novel/Arcade/Adventure game. (No name yet)
- Contact:
Re: Event triggered on clicking the X(close) button?
Thank you, that got me in the right direction.
I added this line to my confirm screen and it works great:
My minigame is defined as a creator defined displayable, and it is paused my toggling the self.paused variable.
I added this line to my confirm screen and it works great:
Code: Select all
on "show" action SetField(game, 'paused', True)
- ChroniclerOfLegends
- Regular
- Posts: 53
- Joined: Thu Feb 16, 2017 5:57 pm
- Projects: Scifi Non-Linear Visual Novel/Arcade/Adventure game. (No name yet)
- Contact:
Re: Event triggered on clicking the X(close) button?
Uh oh... I ran into a different problem. Now an error is thrown when I try and click X when the minigame is not running because an instance of game does not exist.
If this was straight python I would fix this by:
I am not quite sure how I would do try/except in screen language...
Is there a way to use an if statement to check if variable game exists first?
EDIT:
Got it, enclosed on 'show' inside of an if (game != None):
If this was straight python I would fix this by:
Code: Select all
try:
on "show"....
except:
pass
Is there a way to use an if statement to check if variable game exists first?
EDIT:
Got it, enclosed on 'show' inside of an if (game != None):
Who is online
Users browsing this forum: Google [Bot]