Unconditional exit to main menu?

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
Koveras
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?

#1 Post by Koveras »

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.
"Yo, Buddy, you still alive?"

User avatar
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?

#2 Post by chensterrain »

I'm not sure if this is what you're looking for, but this would completely end the game and return to the menu:

Code: Select all

$ renpy.full_restart()
hope that helps!

Koveras
Regular
Posts: 165
Joined: Sat Dec 13, 2008 1:15 pm
Projects: The King's Dragon (TBA)
Location: Karlsruhe, Germany
Contact:

Re: Unconditional exit to main menu?

#3 Post by Koveras »

Great, thanks, that's it!
"Yo, Buddy, you still alive?"

Post Reply

Who is online

Users browsing this forum: Google [Bot]