perform the saving/loading process. That part is mostly done, now we want each save slot to have some specific info, like the player's name and lv,wich should be no problem, but the time and date is giving me some trouble figuring out. You see, scanning through the default scripts I noticed the save screen uses what seems to be a function called FileTime, wich should return the time a file was saved, or so I thought. When I use it in my custom screen, it shows the time but keeps updating it constantly for some reason, so when the time changes in my PC's clock, it reflects immediately in the screen, and of course I don't want that. I tried saving the returned string into a variable but that led to unexpected problems when I load the save file (ex. the hour changes inconsistently).
Am I doing something wrong? Is there a better way to accomplish this?
Code: Select all
#Here are the functions my friend wrote to manage the save process
init python:
def CreateSaveFile(file_slot):
name = "DataFile%i" % file_slot
message = "File %i Saved."% file_slot
renpy.save(name)
renpy.notify(message)
def LoadSaveFile(file_slot):
name = "DataFile%i" % file_slot
message = "File %i Loaded."% file_slot
renpy.load(name)
#Here's our custom screen, not complete just the relevant parts that could be causing the problem
screen save_load_buttons():
frame:
id "DateDisplay"
xysize(300,30)
ypos 660
yanchor 1.0
background "#292929"
text FileTime(1, format=_("{#file_time}%A, %d, %H:%M"), empty=_(" "))
imagebutton:
auto "gui/button/svit_%s.png"
xpos .50
ypos 0
xanchor .5
yanchor 0
action [
If(renpy.get_screen("save"), true=Confirm(prompt="Save File 1?", yes=Function(CreateSaveFile, 1), no=None)),
If(renpy.get_screen("load"), true=Confirm(prompt="Load File 1?", yes=Function(LoadSaveFile, 1), no=None), false=None),
]
I should add that I'm passing 1 as an argument because of the way this screen was designed since the game will only have 3 save files (Don't ask me why, they want it that way so who am I to argue?), and this is the button for Save 1. Since my friend wrote his own variant of the save system, I'd like to stick to it as much as I can, it saves and loads perfectly so I don't know if the issue is because of this, could it be?
EDIT:
I figured it out. Thank you Danny for your effort, persistent does seem to work, I'll have to adapt and write a little more code to ensure compatibility and minimize possible errors, but this problem is solved for now.