Naming Save Files?
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.
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.
- lking22
- Regular
- Posts: 50
- Joined: Sun Dec 03, 2017 3:33 am
- Projects: Grey Feather
- itch: freefall-games
- Contact:
Naming Save Files?
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.
- Ocelot
- Lemma-Class Veteran
- Posts: 2399
- Joined: Tue Aug 23, 2016 10:35 am
- Github: MiiNiPaa
- Discord: MiiNiPaa#4384
- Contact:
Re: Naming Save Files?
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 > >
- lking22
- Regular
- Posts: 50
- Joined: Sun Dec 03, 2017 3:33 am
- Projects: Grey Feather
- itch: freefall-games
- Contact:
Re: Naming Save Files?
(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.
- Ocelot
- Lemma-Class Veteran
- Posts: 2399
- Joined: Tue Aug 23, 2016 10:35 am
- Github: MiiNiPaa
- Discord: MiiNiPaa#4384
- Contact:
Re: Naming Save Files?
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:
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:
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.
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
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
< < insert Rick Cook quote here > >
- lking22
- Regular
- Posts: 50
- Joined: Sun Dec 03, 2017 3:33 am
- Projects: Grey Feather
- itch: freefall-games
- Contact:
Re: Naming Save Files?
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)?
- Ocelot
- Lemma-Class Veteran
- Posts: 2399
- Joined: Tue Aug 23, 2016 10:35 am
- Github: MiiNiPaa
- Discord: MiiNiPaa#4384
- Contact:
Re: Naming Save Files?
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..
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 > >
- RVNSN
- Regular
- Posts: 36
- Joined: Mon Apr 08, 2019 3:54 pm
- Projects: Lust & Piracy
- itch: rvnsn
- Contact:
Re: Naming Save Files?
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.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: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.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
Thank you.
Who is online
Users browsing this forum: Ahrefs [Bot]