Naming Save Files?

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
lking22
Regular
Posts: 50
Joined: Sun Dec 03, 2017 3:33 am
Projects: Grey Feather
itch: freefall-games
Contact:

Naming Save Files?

#1 Post by lking22 »

How can I have it so that when a player saves, they are able to name their save file, and the name of the save will appear underneath it? What I want to happen is for the player to select a save and for an input box to show up prompting them to name the save (something like the 'are you sure you want to quit' box). It's a feature that my playtesters have asked for, so I'd like to try to get it implemented as soon as possible so they can use it.
Releases:
Image

Current projects:
In the Ashes of Dawn
Split Psyche
Savestate Gambit

User avatar
Ocelot
Lemma-Class Veteran
Posts: 2384
Joined: Tue Aug 23, 2016 10:35 am
Github: MiiNiPaa
Discord: MiiNiPaa#4384
Contact:

Re: Naming Save Files?

#2 Post by Ocelot »

What exactly do you have problem with? Taking input from user? Storing arbitrary string in save data? Reading that string without loading save first?
< < insert Rick Cook quote here > >

User avatar
lking22
Regular
Posts: 50
Joined: Sun Dec 03, 2017 3:33 am
Projects: Grey Feather
itch: freefall-games
Contact:

Re: Naming Save Files?

#3 Post by lking22 »

Ocelot wrote: Thu Jan 18, 2018 11:36 am What exactly do you have problem with? Taking input from user? Storing arbitrary string in save data? Reading that string without loading save first?
(Just woke up so I might be making no sense here and being pretty negative but) Pretty much all of it, tbh. I am... a very bad, self-taught coder. I don't know how to get the prompt to appear when the user saves, how to store the name with the save, how to display it, everything.
Releases:
Image

Current projects:
In the Ashes of Dawn
Split Psyche
Savestate Gambit

User avatar
Ocelot
Lemma-Class Veteran
Posts: 2384
Joined: Tue Aug 23, 2016 10:35 am
Github: MiiNiPaa
Discord: MiiNiPaa#4384
Contact:

Re: Naming Save Files?

#4 Post by Ocelot »

Last two are easy: there is a save_name variable, which is stored inside save as extra data by default. Default save/load screen uses that extra data to display save name using FileSaveName function. You can test this by creating a new project, replaceing content of script.rpy with following code and trying to save/load in different places:

Code: Select all

label start:
    $ save_name = "Prologue"
    'This is the prologue'
    'If you save now, the save name would read "Prologue"'
    'Moving on...'
label forest:
    $ save_name = "Forest"
    'This is the forest'
    'Games, saved here are named accordingly'
label end:
    $ save_name = "Ending"
    'The end'
    return
For naming saves it is not that hard too, create an Input in save screen, which will edit save_name variable. You will need to edit screen file_slots in screens.try:

Code: Select all

screen file_slots(title):
    default page_name_value = FilePageNameInputValue(pattern=_("Page {}"), auto=_("Automatic saves"), quick=_("Quick saves"))
    use game_menu(title):
        fixed:
            input:
                value VariableInputValue('save_name')
            ## This ensures the input will get the enter event before any of the
Second- andd third-to-last lines are what I have added. Now there is a another input in save screen (and in load screen too, but it is fixable), which allows you to edit name of the save.
< < insert Rick Cook quote here > >

User avatar
lking22
Regular
Posts: 50
Joined: Sun Dec 03, 2017 3:33 am
Projects: Grey Feather
itch: freefall-games
Contact:

Re: Naming Save Files?

#5 Post by lking22 »

Thanks, that's a few of the problems solved. One last question, though: How do I get the input to show up only when the player selects a save (preferably in a similar box to the 'are you sure you want to quit' message)?
Releases:
Image

Current projects:
In the Ashes of Dawn
Split Psyche
Savestate Gambit

User avatar
Ocelot
Lemma-Class Veteran
Posts: 2384
Joined: Tue Aug 23, 2016 10:35 am
Github: MiiNiPaa
Discord: MiiNiPaa#4384
Contact:

Re: Naming Save Files?

#6 Post by Ocelot »

You will need to use another action for your save screen instead of FileAction. THat would also mean separating save and load screens entirely.

You can either make a Python function, which would use renpy.input and renpy.save to ask for name and save game and use a Function action in your screen. Or you can make another screen with input and FileSave action, shown via ShowMenu action..
< < insert Rick Cook quote here > >

User avatar
RVNSN
Regular
Posts: 36
Joined: Mon Apr 08, 2019 3:54 pm
Projects: Lust & Piracy
itch: rvnsn
Contact:

Re: Naming Save Files?

#7 Post by RVNSN »

Ocelot wrote: Sat Jan 20, 2018 6:20 am

For naming saves it is not that hard too, create an Input in save screen, which will edit save_name variable. You will need to edit screen file_slots in screens.try:

Code: Select all

screen file_slots(title):
    default page_name_value = FilePageNameInputValue(pattern=_("Page {}"), auto=_("Automatic saves"), quick=_("Quick saves"))
    use game_menu(title):
        fixed:
            input:
                value VariableInputValue('save_name')
            ## This ensures the input will get the enter event before any of the
Second- andd third-to-last lines are what I have added. Now there is a another input in save screen (and in load screen too, but it is fixable), which allows you to edit name of the save.
I just tried this and it did not work for me. Anyone care to post their complete save screen code? I'm trying to allow the players to name saves and still have it show the save date if possible.

Thank you.

Post Reply

Who is online

Users browsing this forum: Google [Bot], Kocker, Semrush [Bot], VESTED