I have it set so that the current save name will be the default value for the input prompt.
When I save the game and then check the variable viewer, the save_name variable has been changed to the correct value.
However, when I save the game, then exit and load back into the game, the save_name variable is back to what it was before I saved.
Here's what I have:
An alternative input screen. This one is modal.
Code: Select all
screen modal_input:
modal True
window style "input_window":
has vbox
text prompt style "input_prompt"
input id "input" style "input_text" default default
Code: Select all
action If(renpy.current_screen().screen_name[0] == "load",FileLoad(i),get_save_name(i))
Code: Select all
init -2 python:
class get_save_name(FileSave):
def __init__(self, name, confirm=True, newest=True, page=None, cycle=False):
super(get_save_name,self).__init__(name=name,confirm=confirm,newest=newest,page=page,cycle=cycle)
def __call__(self):
renpy.call_in_new_context("get_save_name")
return super(get_save_name,self).__call__()
label get_save_name:
show screen save
$ save_name = renpy.call_screen("modal_input", prompt="Enter save name", default=save_name, length=20)
return
Is there a way to get renpy to remember the value of save_name after I set it or am I just going to have to deal without a default value?
edit:
I've discovered something new.
If I save the game, progress a little in the game, and then save again, then the save_name gets saved properly.
So Renpy doesn't realize that the variable changed until you continue into the game. If you save and then quit immediately, then the save_name variable won't be saved. Is there any way to fix this?
