Code for better screenshot locations

Image of the modified save/load screen - catbox

This will NOT work on the following games, due to their code being retarded:

  • My Dorm

CLICK HERE TO DOWNLOAD A PRE-MADE FILE
This file is hosted at the above gitlab repo, link included just for ease of access.

The code in the block below is for the screens.rpy file, or another file to overwrite that.
It changes the screen so that:
Saves can be named - toggled
Saves are now scrollable, 3 per row, unlimited rows
Page buttons now track the current page
New page buttons to navigate +/- 10 pages at once

These can all be disabled easily through commenting the appropriate lines out.
Use this by adding it to a text file, saving as "All files" then as a .rpy file

This file is hosted at the above gitlab repo, link included just for ease of access. The below code WILL NOT be updated anymore (2025-05-31), check the gitlab.

default persistent.namedSaves = False
init -1500 python:
    def pageInfo():
        currentPage = int(persistent._file_page)

        if currentPage >= 10:
            digit = currentPage % 10
            tens = currentPage // 10
            return  [tens,digit]
        else:
            digit = currentPage % 10
            return [0,digit]


    class FilePageNextTen(Action, DictEquality):        
        alt = _("Forward 10 pages.")

        def __init__(self, max=None, wrap=False, auto=True, quick=True):

            page = persistent._file_page

            if page == "auto":
                if config.has_quicksave and quick:
                    page = "quick"
                else:
                    page = "1"

            elif page == "quick":
                page = "1"

            else:
                pageVal = pageInfo()
                page = ((pageVal[0] + 1 ) * 10+ pageVal[1])

                if max is not None:
                    if page > max:
                        if wrap:
                            if config.has_autosave and auto:
                                page = "auto"
                            elif config.has_quicksave and quick:
                                page = "quick"
                            else:
                                page = "1"
                        else:
                            page = None

                if page is not None:
                    page = str(page)

            self.page = page

        def __call__(self):
            if not self.get_sensitive():
                return

            persistent._file_page = self.page
            renpy.restart_interaction()

        def get_sensitive(self):
            return self.page is not None

        def predict(self):
            _predict_file_page(self.page)

    class FilePagePreviousTen(Action, DictEquality):
        alt = _("Forward 10 pages.")

        def __init__(self, max=None, wrap=False, auto=True, quick=True):

            page = persistent._file_page

            if page == "auto":
                if config.has_quicksave and quick:
                    page = "quick"
                else:
                    page = "1"

            elif page == "quick":
                page = "1"

            else:
                tmp2 = pageInfo()
                tmpV=(( tmp2[0]- 1 ) * 10 + tmp2[1])
                if (tmpV < 1):          
                    page = 1
                else:
                    page =(( tmp2[0]- 1 ) * 10 + tmp2[1])

                if max is not None:
                    if page > max:
                        if wrap:
                            if config.has_autosave and auto:
                                page = "auto"
                            elif config.has_quicksave and quick:
                                page = "quick"
                            else:
                                page = "1"
                        else:
                            page = None

                if page is not None:
                    page = str(page)

            self.page = page

        def __call__(self):
            if not self.get_sensitive():
                return

            persistent._file_page = self.page
            renpy.restart_interaction()

        def get_sensitive(self):
            return self.page is not None

        def predict(self):
            _predict_file_page(self.page)

screen setNamedSave(slot):
    modal True
    zorder 200
    style_prefix "confirm"
    frame:
        vbox:
            spacing 25
            xsize 650

            if FileLoadable(slot):
                hbox:
                    label _("Overwriting Save Name:") style "confirm_prompt"
                    textbutton _("Clear") action SetVariable("save_name","") xpos 0.9 ypos -0.1 
            else:
                label _("New Save Name:") style "confirm_prompt"

            input:
                value VariableInputValue('save_name')
                length 30
                xalign 0.5

            hbox:
                xfill True
                textbutton _("Yes") action FileAction(slot, confirm=False), Hide("setNamedSave") xalign 0.5
                textbutton _("No") action Hide("setNamedSave") xalign 0.5

screen file_slots(title):
    default page_name_value = FilePageNameInputValue(pattern=_("Page {}"), auto=_("Automatic saves"), quick=_("Quick saves"))

    use game_menu(title):

        fixed:

            ## This ensures the input will get the enter event before any of the
            ## buttons do.
            order_reverse True


            if persistent.namedSaves:
                textbutton _("Named Saves Enabled") text_size 32 action ToggleField(persistent,"namedSaves")
            else:
                textbutton _("Named Saves Disabled") text_size 32 action ToggleField(persistent,"namedSaves")

            ## The page name, which can be edited by clicking on a button.
            button:
                style "page_label"

                key_events True
                xalign 0.5
                action page_name_value.Toggle()

                input:
                    style "page_label_text"
                    value page_name_value

            ## The grid of file slots.
            vpgrid:
                style_prefix "slot"

                xalign 0.5
                yalign 0.5

                spacing gui.slot_spacing
                cols 3
                ysize 0.8
                mousewheel True
                scrollbars "vertical"

                $ existing_saves = sorted(FileUsedSlots(page=FileCurrentPage(), highest_first=False), key=lambda x: FileTime(x, format=_("{#file_time}%Y %m %d, %H:%M:%S")))
                $ last_save_slot = (FileUsedSlots(page=FileCurrentPage(), highest_first=True) or [0])[0]

                $ new_slot = last_save_slot + 1

                if "load" not in title.lower():
                    button:
                        if persistent.namedSaves:
                            action SetVariable("save_name", FileSaveName(new_slot)), Show("setNamedSave", slot=new_slot)
                        else:
                            action SetVariable("save_name", FileSaveName(new_slot)), FileAction(new_slot)

                        has vbox

                        add FileScreenshot(new_slot) xalign 0.5

                        text FileTime(new_slot, format=_("{#file_time}%A, %B %d %Y, %H:%M"), empty=_("empty slot")):
                            style "slot_time_text"

                        text FileSaveName(new_slot):
                            style "slot_name_text"

                        key "save_delete" action FileDelete(new_slot)

                for slot in existing_saves[::-1]:
                    button:
                        if "load" not in title.lower():
                            if persistent.namedSaves:
                                action SetVariable("save_name", FileSaveName(slot)), Show("setNamedSave", slot=slot)
                            else:
                                action SetVariable("save_name", FileSaveName(slot)), FileAction(slot)
                        else:
                            action FileAction(slot)

                        has vbox

                        add FileScreenshot(slot) xalign 0.5

                        text FileTime(slot, format=_("{#file_time}%A, %B %d %Y, %H:%M"), empty=_("empty slot")):
                            style "slot_time_text"

                        text FileSaveName(slot):
                            style "slot_name_text"

                        key "save_delete" action FileDelete(slot)

            ## Buttons to access other pages.
            vbox:
                style_prefix "page"

                xalign 0.5
                yalign 1.0

                hbox:
                    xalign 0.5

                    spacing gui.page_spacing

                    textbutton _("<<<") action FilePagePreviousTen()
                    textbutton _("<") action FilePagePrevious()
                    #UNCOMMENT THE LINE TO ALLOW FOR MOUSEWHEEL PAGE CHANGE
                    # key "save_page_prev" action FilePagePrevious()

                    if config.has_autosave:
                        textbutton _("{#auto_page}A") action FilePage("auto")

                    if config.has_quicksave:
                        textbutton _("{#quick_page}Q") action FilePage("quick")

                    ## range(1, 10) gives the numbers from 1 to 9.
                    if (persistent._file_page in ["auto", "quick"] or int(persistent._file_page) < 10):
                        for page in range(1, 10):
                            textbutton "[page]" action FilePage(page)
                    else:
                        for page in range(int(persistent._file_page)-4, int(persistent._file_page)+4):
                            textbutton "[page]" action FilePage(page)


                    textbutton _(">") action FilePageNext()
                    textbutton _(">>>") action FilePageNextTen()
                    #UNCOMMENT THE LINE TO ALLOW FOR MOUSEWHEEL PAGE CHANGE
                    # key "save_page_next" action FilePageNext()


Edit

Pub: 23 Feb 2025 00:13 UTC

Edit: 31 May 2025 07:34 UTC

Views: 213