Page 1 of 1

[Updated] Continue button

Posted: Sun Oct 08, 2023 5:28 pm
by Neyunse
Well, after publishing this post (viewtopic.php?t=63397) I made some adjustments to the code, so here is an updated version.

Code: Select all

init python:
  class Continue(Action):
        """
        :doc: menu_action
        
        Causes the last save to be loaded.
        The purpose of this is to load the player's last save 
        from the main menu.
        
        `regexp`
            If present, will be used in `renpy.newest_slot`. 
        """

        def __init__(self, regexp=r"(?!_reload).+", confirm=False):
            self.regexp = regexp
       

        def __call__(self):
            recent_save = renpy.newest_slot(self.regexp)

            if recent_save:
                renpy.load(recent_save)

        def get_sensitive(self): 
            if _in_replay:
                return False
            return renpy.newest_slot(self.regexp) is not None
            
 screen navigation():
 	textbutton "Continue" action Continue()
on the other hand, this is something I submitted in a PR in the official Ren'Py repository (https://github.com/renpy/renpy/pull/4921), and this code has a slight change.