Continue latest save from main menu (grayed out)

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
wyverngem
Miko-Class Veteran
Posts: 615
Joined: Mon Oct 03, 2011 7:27 pm
Completed: Simple as Snow, Lady Luck's Due,
Projects: Aether Skies, Of the Waterfall
Tumblr: casting-dreams
itch: castingdreams
Location: USA
Contact:

Continue latest save from main menu (grayed out)

#1 Post by wyverngem » Thu Oct 01, 2015 11:30 am

I'm trying to write a continue latest save from the main menu. However when I go to test it in game I read the first line and click to the second. Then I save the game in slot 1 page 1 and return to the main menu. The button appears and it's grayed out and I actually can't click on it.

Code: Select all

        $lastsave=renpy.newest_slot(r"\d+")
        if lastsave!=None:
            textbutton _("Continue") action FileLoad(lastsave)
Does the variable that stores the information need to be on a different page or something? I've tried researching and I couldn't find any help on the subject. I'm currently in Renpy 6.99.5.602

User avatar
PyTom
Ren'Py Creator
Posts: 15893
Joined: Mon Feb 02, 2004 10:58 am
Completed: Moonlight Walks
Projects: Ren'Py
IRC Nick: renpytom
Github: renpytom
itch: renpytom
Location: Kings Park, NY
Contact:

Re: Continue latest save from main menu (grayed out)

#2 Post by PyTom » Thu Oct 01, 2015 11:34 pm

The problem is that renpy.newest_slot returns the slotname and the pagename. You probably want to do something like:

Code: Select all

$lastsave=renpy.newest_slot(r"\d+")
if lastsave is not None:
    $ name, page = lastsave.split("-")
    textbutton _("Continue") action FileLoad(name, page)
Supporting creators since 2004
(When was the last time you backed up your game?)
"Do good work." - Virgil Ivan "Gus" Grissom
"Silly and fun things are important." - Elon Musk
Software > Drama • https://www.patreon.com/renpytom

User avatar
wyverngem
Miko-Class Veteran
Posts: 615
Joined: Mon Oct 03, 2011 7:27 pm
Completed: Simple as Snow, Lady Luck's Due,
Projects: Aether Skies, Of the Waterfall
Tumblr: casting-dreams
itch: castingdreams
Location: USA
Contact:

Re: Continue latest save from main menu (grayed out)

#3 Post by wyverngem » Fri Oct 02, 2015 4:55 pm

Thank you Pytom, deleted persistence and it worked out fine.

Post Reply

Who is online

Users browsing this forum: No registered users