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.
How can I return to main menu after clicking Main Menu option and after that have scrip auto reload the game? My game doesn't fully restarts once you go back to main menu which bugs game out.
So my idea would be to run this 2 functions one after another but the problem is that they cancel each other and can't be ran like that. Also I don't see a function in documentation that would force you back to main menu and then do Shift+R.
Seen requests for this in past but nothing helps. Any of you guys have idea how to implement this?
Also I want to call this function anywhere from the game and see it actually working like that, for example if you beat the game you still go back to main menu but game needs to be reloaded.
Nero wrote: ↑Wed Mar 06, 2024 6:16 pm
How can I return to main menu after clicking Main Menu option and after that have scrip auto reload the game?
You click Main Menu option, and the control goes to those special labels (e.g. "before_main_menu").
There you can check if it's a "clean" start of Ren'Py, or coming back from the game "dirty".
In which case you can run whatever scripts you want.
However I would advise to correct your game script so that it would work without dirty hacks.
Maybe check how to use define, default, init etc. properly?