I've browsed the wiki and the forum for a bit but haven't found the answer I was looking for... don't throw heavy things at me if this looks stupid to you. ^^
The story is this: I'm writing a VN where the protagonist dies if the player makes a false decision, and I want to return to the main menu after this happens. So far, I've found two ways to implement the last part:
- According to documentation, a "return" statement exits the current game if the stack is empty.
- When the engine reaches the end of the script file, the main menu is displayed automatically.
However, I find it difficult to keep the contents of the stack in my head (either that, or I screwed up my jump/call nesting: it has never worked properly after a couple of branchings), so I opted for a quick and dirty solution: placing a "label gameover: pass" statement block at the very end of the script file and jumping there after each death scene. However, I'm not too happy about it, so I was wondering whether there's a more elegant solution to this.
Many thanks in advance.
Unconditional exit to main menu?
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.
-
- Regular
- Posts: 165
- Joined: Sat Dec 13, 2008 1:15 pm
- Projects: The King's Dragon (TBA)
- Location: Karlsruhe, Germany
- Contact:
Unconditional exit to main menu?
"Yo, Buddy, you still alive?"
- chensterrain
- Veteran
- Posts: 225
- Joined: Sun Oct 26, 2008 2:01 am
- Completed: Lucky Rabbit Reflex!, Dusk ~A Moonlight Romance~
- Projects: Edge of Elsewhere
- Organization: Super63
- Tumblr: supersixthree
- Deviantart: chensterrain
- Location: London, UK
- Contact:
Re: Unconditional exit to main menu?
I'm not sure if this is what you're looking for, but this would completely end the game and return to the menu:
hope that helps!
Code: Select all
$ renpy.full_restart()
Who is online
Users browsing this forum: No registered users