[Solved] Preview of latest save
Posted: Mon May 02, 2022 2:59 pm
On the main menu I want to show an image that represents a preview of the chapter where the game was last saved (but not a screenshot like in the save slots). I’m not sure how to do this.
I started something, but it doesn’t seem like a proper solution.
I save the current label in a json whenever the game is saved
I take the name of the newest slot and use it to get the label name from the json
Depending on what the label is, I decide what chapter the game was saved at last
But I'd have to check for every label in a chapter in order to do this and it doesn't seem like a good solution. Unless there's a way to automatically add all those labels in a list for each chapter.
I started something, but it doesn’t seem like a proper solution.
I save the current label in a json whenever the game is saved
Code: Select all
def label_callback(name, abnormal):
if name.startswith("_"): return
store.current_label = name
config.label_callback = label_callback
def save_chapter_name(d):
d["chapter"] = current_label
config.save_json_callbacks.append(save_chapter_name)I take the name of the newest slot and use it to get the label name from the json
Code: Select all
def newest_slot_tuple():
newest = renpy.newest_slot()
if newest is not None:
page, name = newest.split("-")
return (page, name)
def last_chapter_saved():
newest_page, newest_name = newest_slot_tuple()
return FileJson(newest_name, "chapter")Code: Select all
def continue_image_button():
if last_chapter_saved() == "chapter1" or last_chapter_saved() == "ch1_story":
...