[Solved] How do I make a pc game autosave and reload where the person stopped?

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
Nanahs
Veteran
Posts: 310
Joined: Wed Aug 22, 2018 5:50 pm
Contact:

[Solved] How do I make a pc game autosave and reload where the person stopped?

#1 Post by Nanahs »

On Android the game "reloades".
But Is there something similar for a pc game?

Like, the person was playing "label park" when they quit the game. The game autosaves that.
And when the person clicks on "start", the game automaticaly goes back to "label park" where they stopped.

I was reading the documentation but couldn't figure it out/make it work at all.

Does anyone knows?

Thanks.
Last edited by Nanahs on Sun Jan 06, 2019 4:24 pm, edited 1 time in total.

User avatar
Karl_C
Veteran
Posts: 232
Joined: Sun Mar 31, 2013 6:18 am
Contact:

Re: How do I make a pc game autosave and reload where the person stopped?

#2 Post by Karl_C »

Possibly this will help you?
define config.auto_load = None
If not None, the name of a save file to automatically load when Ren'Py starts up. This is intended for developer use, rather than for end users. Setting this to "1" will automatically load the game in save slot 1.
Ren'Py Documentation: Configuration Variables: config:auto_load

I never tried to use this config variable btw.

User avatar
Karl_C
Veteran
Posts: 232
Joined: Sun Mar 31, 2013 6:18 am
Contact:

Re: How do I make a pc game autosave and reload where the person stopped?

#3 Post by Karl_C »

Code: Select all

init python:
    config.has_autosave = True
    config.autosave_slots = 1
    config.autosave_on_choice = True
    config.autosave_on_quit = True
    
define config.auto_load = renpy.newest_slot(regexp="auto") # autoload newest save slot beginning with 'auto'

# The game starts here.

label start:

    "We're now in label start"
    
    call two
    call three
    call four
    
    return
    
label two:    
    
    "We're now in label two"
    
    return
    
label three:    
    
    "We're now in label three"
    
    return
    
label four:    
    
    "We're now in label four"
    
    return
That is one possible solution. Try to exit the game at any position and then start it again. Rollback and the standard load/save still works too.

User avatar
Nanahs
Veteran
Posts: 310
Joined: Wed Aug 22, 2018 5:50 pm
Contact:

Re: How do I make a pc game autosave and reload where the person stopped?

#4 Post by Nanahs »

Karl_C wrote: Sun Jan 06, 2019 10:41 am

Code: Select all

init python:
    config.has_autosave = True
    config.autosave_slots = 1
    config.autosave_on_choice = True
    config.autosave_on_quit = True
    
define config.auto_load = renpy.newest_slot(regexp="auto") # autoload newest save slot beginning with 'auto'

# The game starts here.

label start:

    "We're now in label start"
    
    call two
    call three
    call four
    
    return
    
label two:    
    
    "We're now in label two"
    
    return
    
label three:    
    
    "We're now in label three"
    
    return
    
label four:    
    
    "We're now in label four"
    
    return
That is one possible solution. Try to exit the game at any position and then start it again. Rollback and the standard load/save still works too.
Oh, thank you SO much! I'll try that :)

Post Reply

Who is online

Users browsing this forum: Google [Bot]