And I want it to look like this (done by just adding new lines, but it messes up if the date only takes up one line):
I know I need to save it with JSON somehow, but I cannot for the life of me figure out how to implement JSON into Renpy. The documentation doesn't really have much about it and I can't find any examples similar to what I'm trying to do. I just want it to be a separate block of text (like the playtime) that I can position wherever.
Or honestly, if there's a way to make it be on the 5th line regardless of how many total lines the save name is, that also works lol. I don't think the date will ever be more than 2 lines, but it definitely will sometimes only be one.
Here's my save screen code, if that helps at all:
Code: Select all
screen diary_screen():
frame:
xpos 300
ypos 100
background None
has vbox
hbox:
ypos -5
style_prefix "fileslot"
imagebutton:
idle "gui/button/left.png"
ypos 12
action FilePagePrevious(max=3)
if config.has_quicksave:
textbutton _("{#quick_page}Q") action FilePage("quick")
for i in range(1, 4):
textbutton str(i) action FilePage(i)
imagebutton:
idle "gui/button/right.png"
ypos 12
action FilePageNext(max=3)
if loadorsave == "load":
grid 1 2:
transpose True
xfill True
spacing 25
for i in range(1, 3):
textbutton (FileSaveName(i)):
style_prefix "myslots"
action [SetVariable("save_name", "%s"%calendar.string3()), FileLoad(i)]
xfill True
else:
grid 1 2:
transpose True
xfill True
spacing 25
for i in range(1, 3):
button:
text (FileSaveName(i)) ypos 40
style_prefix "myslots"
action [SetVariable("save_name", "%s"%calendar.string3()), FileSave(i)]
xfill True
$ playtime = FileJson(i, "playtime", empty=0, missing=0)
$ minutes, seconds = divmod(int(playtime), 60)
$ hours, minutes = divmod(minutes, 60)
text "[hours:02d]:[minutes:02d]:[seconds:02d]" ypos 146 xpos 250
$ tod_save = FileJson(i, key="tod")
text "[tod_save]" ypos 146 xpos 40
textbutton "Save":
text_style "fileslot_button_text" xpos 600 ypos -80 action SetVariable("loadorsave", "save")
textbutton "Load":
text_style "fileslot_button_text" xpos 600 ypos -90 action SetVariable("loadorsave", "load")
Code: Select all
def string3(self):
return "%s, %s %d\n\n\n%s"%(self.weekday(), self.month_names[self.month], self.day, tod.capitalize())