[Solved] One SaveGame system - how to load and run savegame
Posted: Sun May 24, 2020 5:08 pm
I try to have a main menu as simple as possible :
A New Game button when no save game is detected, a Run Game when one is of course available and a Quit button.
Given that there is only one savegame in scope, I do not want to have to deal with the usual loader.
So my navigation menu looks like thius:
Here is the function's definition:
And here is how I know the game exists
What I found puzzling is that upon launching the program, the code breaks while loading the game, even before the menu appears.
So it seems there is an evaluation done to see if the menu item will be disabled. Am I right ?
If so... is there a way to tell renpy to enable the menu and not do a pre-evaluation ?
And.. is it a viable way to get the feature done ?
Thanks in advance for all the help
A New Game button when no save game is detected, a Run Game when one is of course available and a Quit button.
Given that there is only one savegame in scope, I do not want to have to deal with the usual loader.
So my navigation menu looks like thius:
Code: Select all
screen navigation():
vbox:
style_prefix "navigation"
xpos gui.navigation_xpos
yalign 0.5
spacing gui.navigation_spacing
#if main_menu:
if not savegame_present:
textbutton _("New Game") action Start()
else:
textbutton _("Auto Load") action Function(AutoLoding())
if renpy.variant("pc"):
## The quit button is banned on iOS and unnecessary on Android and
## Web.
textbutton _("Quit") action Quit(confirm=not main_menu)
Code: Select all
def AutoLoding():
return renpy.load( "1-1" )
Code: Select all
label main_menu:
$ savegame_present = renpy.can_load("1-1", True)
call screen main_menu
return
So it seems there is an evaluation done to see if the menu item will be disabled. Am I right ?
If so... is there a way to tell renpy to enable the menu and not do a pre-evaluation ?
And.. is it a viable way to get the feature done ?
Thanks in advance for all the help