Renpy Edit Save File Link
How to Add an "Edit Save File" Link in Ren'Py If you are developing a complex Visual Novel, you might have encountered a situation where you want players (or you, as the developer) to tweak a save file without loading the game. Maybe you want to open the save folder to back up files, or perhaps you want to edit a specific .save file to test a scenario. Ren'Py doesn't have a built-in button labeled "Edit Save File" in the main menu by default, but adding one is surprisingly simple. In this tutorial, we will cover how to add a button to your screen that links directly to the save directory. Prerequisites Before we start, it is important to understand what "editing" a save file entails:
The File Format: Ren'Py save files ( .save ) are actually compressed archives (zlib) containing Python data. You cannot simply open them with Notepad. The Goal: The code below will create a link that opens the save folder on the player's computer. From there, they (or you) can move, delete, or use a save editor tool on the files.
Step 1: Using the FileAction and OpenDirectory Functions The easiest way to interact with the file system in Ren'Py is using the OpenDirectory action. This action tells the operating system to open a specific folder in the default file explorer (Finder on Mac, Explorer on Windows). Here is the basic code snippet you can use anywhere a Ren'Py action is accepted (like a button or hyperlink): action OpenDirectory(renpy.config.savedir)
renpy.config.savedir : This is a built-in variable that stores the absolute path to where Ren'Py keeps the save files for your specific game. renpy edit save file link
Step 2: Adding the Button to the Main Menu To make this accessible, let's add a button to the Main Menu. You will need to edit your screens.rpy file. Look for the screen main_menu() section. Find the vbox or grid that contains the "Start", "Load", and "Preferences" buttons. Add the following textbutton code inside that block: screen main_menu(): # ... existing code ...
vbox: # ... existing style code ...
# Standard Buttons textbutton _("Start") action Start() textbutton _("Load") action ShowMenu("load") textbutton _("Preferences") action ShowMenu("preferences") How to Add an "Edit Save File" Link
# YOUR NEW BUTTON HERE: textbutton _("Edit Saves") action OpenDirectory(renpy.config.savedir)
textbutton _("Quit") action Quit(confirm=False)
# ... existing code ...
Step 3: Advanced Usage (Developer Mode) If you only want this link to appear for you (the developer) and not for players playing the final build, you can wrap the button in a check for config.developer . if config.developer: textbutton _("Open Save Folder") action OpenDirectory(renpy.config.savedir)
This creates a cleaner UI for your release builds while keeping the tool handy during development. What if I want to edit the data inside the save? If your goal is to actually modify the variables (like changing money = 100 to money = 9999 ) inside a save file, simply opening the folder isn't enough. You will need a third-party tool. Once you have