[SOLVED] deactivate load button while no save file exists

Discuss how to use the Ren'Py engine to create visual novels and story-based games. New releases are announced in this section.
Forum rules
This is the right place for Ren'Py help. Please ask one question per thread, use a descriptive subject like 'NotFound error in option.rpy' , and include all the relevant information - especially any relevant code and traceback messages. Use the code tag to format scripts.
Post Reply
Message
Author
User avatar
Qlara
Regular
Posts: 80
Joined: Fri Nov 28, 2014 10:22 am
Completed: Carmilla
Skype: kantonija
itch: visualgothic
Location: Berlin
Contact:

[SOLVED] deactivate load button while no save file exists

#1 Post by Qlara »

How do I check whether the player actually has a loadable file so I can deactivate the load button (like I did with the notes button)?
I only managed to make the button disappear until the player has actually visited the save screen, but that's obviously a poor result.

Code: Select all

textbutton _("Load") action ShowMenu("load")
textbutton _("Notes") action If(persistent.unlock_notes, Show("notes"))
Last edited by Qlara on Sun Apr 15, 2018 4:44 pm, edited 2 times in total.

DragoonHP
Miko-Class Veteran
Posts: 758
Joined: Tue Jun 22, 2010 12:54 am
Completed: Christmas
IRC Nick: DragoonHP
Location: Zion Island, Solario
Contact:

Re: deactivate load button while no save file exists

#2 Post by DragoonHP »

Code: Select all

textbutton _("Load") sensitive renpy.newest_slot()  action ShowMenu("load")
Should work. A note though, the button will be unlocked even if there is an auto save

User avatar
Qlara
Regular
Posts: 80
Joined: Fri Nov 28, 2014 10:22 am
Completed: Carmilla
Skype: kantonija
itch: visualgothic
Location: Berlin
Contact:

Re: deactivate load button while no save file exists

#3 Post by Qlara »

By googling your "newest_slot" suggestion I found another solution that doesn't even seem sensitive to autosaves.

Code: Select all

        default lastsave = renpy.newest_slot(r"\d+")
        if lastsave != None:
            textbutton _("Load") action ShowMenu("load")

Post Reply

Who is online

Users browsing this forum: peach_light