I noticed some odd behavior when saving, and was able to figure out a solution. That being said, I figured I'd put the fix in here to help anyone else who noticed and wished to fix it within their own project. There are two behaviors I noticed:
- If you have saveName off, when you save it will overwrite the previous name with the default (or blank), some might want to save a file, then turn off name save and then when you save it retains the name.,
- If you save multiple slots (say for route purposes) when the dialog pops up for the second slot you are saving, the input will SHOW that you are saving the second name, but unless you make a change to the input (triggering the changed event) when you click save it will save the slot based on the FIRST slot's name (since that was when the changed event trigger).,
It was a little annoying to me, so I fixed it in my AVN, but thought I'd share it for those who want to add it into their AVN. Both of these issues can be fixed by changing two pieces of code. in the init python portion, add SetSaveName function to the init python within the save_load screen:
init python:
import string
def SetSaveName(slot):
Namer(FileSaveName(slot))
def Namer(name):
store.save_name = name
Then, with the save slot button, change the action to the following:
if persistent.saveName:
action [
Function(SetSaveName, slot),
If(renpy.get_screen("save"), true=Show("savegameName", accept=FileSave(slot)), false=FileLoad(slot))
]
else:
action [
Function(SetSaveName, slot),
FileAction(slot)
]
Basically, what this does is EXPLICITLY sets the store.save_name variable (which is used to save the slot name on save) before calling the FileSave action. With this small change, now if you "turn off" save name, when you save it will retain the slot's name AND if you are saving multiple slots it will ensure that you retain that slot's name and not accidentally save it based on a previously saved slot.