Snippets

SinnyStar [Ren'Py] Selectable save with automatic save description

Created by Sinny Star
init -2 python:
    # action: saves the dialogue as save description
    # http://lemmasoft.renai.us/forums/viewtopic.php?f=8&t=23749
    last_say = ""
    class FileLastSaySave(FileSave):
        def __init__(self, name, confirm=False, newest=True, page=None, cycle=False):
            global last_say
            super(FileLastSaySave,self).__init__(name=name,confirm=confirm,newest=newest,page=page,cycle=cycle)
            self.last_say=last_say
        def __call__(self):
            global save_name
            save_name=self.last_say
            return super(FileLastSaySave,self).__call__()

    # current save variable
    curr_save = 1
    
screen say(who, what):
    on "show" action SetVariable("last_say",what)
    on "replace" action SetVariable("last_say",what)
    # ...
    
screen cu:
    # Current save data
    add FileScreenshot(curr_save) xpos 50 ypos 92
    text FileSaveName(curr_save)
    textbutton "Save" action FileAction(curr_save), If(renpy.current_screen().screen_name[0] == "load",FileLoad(curr_save),FileLastSaySave(curr_save)) 
    textbutton "Delete" action [FileDelete(curr_save)] 

screen file_picker:
    # current save data portion
    use cu

    for number in range(1,7):
        $ filetime = FileTime(number, empty=_(""))
        $ fileslot = "nro %02s" % (FileSlotName(number, 4))
        # action is to set the current save to this one rather than saving
        imagebutton auto "dat001/cdro_%s.png" xpos x ypos y action [SetVariable("curr_save",number)]
        add FileScreenshot(number) 

        # ...

Comments (0)

HTTPS SSH

You can clone a snippet to your computer for local editing. Learn more.