Add Text to save game
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.
- Yukari
- Regular
- Posts: 121
- Joined: Sun Feb 06, 2011 6:28 am
- Completed: Aozora Meikyuu, Yozora Rhapsody, Imolicious, Yume Puzzle, Apprehend;Girlfriend
- Projects: Games&Girls, Fuyuzora Rumble
- Organization: Yume Creations
- Tumblr: yumecreationsvn
- Location: Germany
- Contact:
Add Text to save game
Is it possible that the last text in a textbox appear in the savegame? Or that the player can add a comment to the savegame?
- xavimat
- Eileen-Class Veteran
- Posts: 1458
- Joined: Sat Feb 25, 2012 8:45 pm
- Completed: Yeshua, Jesus Life, Cops&Robbers
- Projects: Fear&Love, unknown
- Organization: Pilgrim Creations
- Github: xavi-mat
- itch: pilgrimcreations
- Location: Spain
- Contact:
Re: Add Text to save game
You have the variable save_name ( http://www.renpy.org/doc/html/save_load ... -variables )
With a renpy.input, the user can write the string for the save name.
With a renpy.input, the user can write the string for the save name.
Code: Select all
$ save_name = renpy.input("Type your save name")Comunidad Ren'Py en español: ¡Únete a nuestro Discord!
Rhaier Kingdom A Ren'Py Multiplayer Adventure Visual Novel.
Cops&Robbers A two-player experiment | Fear&Love Why can't we say I love you?
Honest Critique (Avatar made with Chibi Maker by ~gen8)
Rhaier Kingdom A Ren'Py Multiplayer Adventure Visual Novel.
Cops&Robbers A two-player experiment | Fear&Love Why can't we say I love you?
Honest Critique (Avatar made with Chibi Maker by ~gen8)
Re: Add Text to save game
Extension on xavimat's suggestion, try using this in the file save/load button:
Code: Select all
action [SetVariable("save_name",_last_say_what),FileAction(i)]- Yukari
- Regular
- Posts: 121
- Joined: Sun Feb 06, 2011 6:28 am
- Completed: Aozora Meikyuu, Yozora Rhapsody, Imolicious, Yume Puzzle, Apprehend;Girlfriend
- Projects: Games&Girls, Fuyuzora Rumble
- Organization: Yume Creations
- Tumblr: yumecreationsvn
- Location: Germany
- Contact:
Re: Add Text to save game
@xavimat If I use this the player have to enter the text at the beginning of the game. I want the input only when he save the game.
@Elmiwisa Thank you! Is it also possible to show online the first line? The whole textbox is a bit to much for a single save slot
@Elmiwisa Thank you! Is it also possible to show online the first line? The whole textbox is a bit to much for a single save slot
- xavimat
- Eileen-Class Veteran
- Posts: 1458
- Joined: Sat Feb 25, 2012 8:45 pm
- Completed: Yeshua, Jesus Life, Cops&Robbers
- Projects: Fear&Love, unknown
- Organization: Pilgrim Creations
- Github: xavi-mat
- itch: pilgrimcreations
- Location: Spain
- Contact:
Re: Add Text to save game
You could do a label with the input code, and have the "Save" button jump to that label.Yukari wrote:@xavimat If I use this the player have to enter the text at the beginning of the game. I want the input only when he save the game.
I'm not able to implement Elmiwisa solution. It works for the save, but not loads the saved games.
For the save, you can use the first 30 characters of the last say this way: _last_say_what[:30]
Code: Select all
action [SetVariable("save_name",_last_say_what[:30]),FileAction(i)]Comunidad Ren'Py en español: ¡Únete a nuestro Discord!
Rhaier Kingdom A Ren'Py Multiplayer Adventure Visual Novel.
Cops&Robbers A two-player experiment | Fear&Love Why can't we say I love you?
Honest Critique (Avatar made with Chibi Maker by ~gen8)
Rhaier Kingdom A Ren'Py Multiplayer Adventure Visual Novel.
Cops&Robbers A two-player experiment | Fear&Love Why can't we say I love you?
Honest Critique (Avatar made with Chibi Maker by ~gen8)
Re: Add Text to save game
Ah I forgot that the game might be loaded from the main menu, so I did not test that possibility. In this case, I guess a more sophisticated method is needed. Basically, you need to distinguish between the save screen and load screen yourself, rather than relying on FileAction. I also realized another problem with variable substitution.
So here is the fix, which is more sophisticated:
1. Insert this code somewhere:
2. Now for the action in the file_picker screen, use this:
3. Add this to the beginning of the say screen code:
However, I am not able to solve this problem. Seems like there are no ways to know how long the text would be. All factors, such as font choice, style choice, ruby text, characters with different size, length of words, language, reading order, etc. will all come in.
A better strategy here would be to redesign the save/load screen, so you don't have text being inside small slot anymore. For example you could have for example a big box that show the current scene and the current dialogue, which will be displayed when you hover the mouse over the slot.
Another additional strategy would be to make sure all the slot are to the extreme right of the screen. Then you can simply make the text box do not line break, and all the extra stuff will simply run off the right side of the screen.
So here is the fix, which is more sophisticated:
1. Insert this code somewhere:
Code: Select all
init -2 python:
last_say=""
class FileLastSaySave(FileSave):
def __init__(self, name, confirm=True, newest=True, page=None, cycle=False):
global last_say
super(FileLastSaySave,self).__init__(name=name,confirm=confirm,newest=newest,page=page,cycle=cycle)
self.last_say=last_say
def __call__(self):
global save_name
save_name=self.last_say
return super(FileLastSaySave,self).__call__()
Code: Select all
action If(renpy.current_screen().screen_name[0] == "load",FileLoad(i),FileLastSaySave(i))Code: Select all
on "show" action SetVariable("last_say",what)
on "replace" action SetVariable("last_say",what)That would cause a different problem though. If text tag was used, it might cut off in the middle of the text tag, and then the game cannot be loaded ever again and will crash every single time you try to open the save/load menu.xavimat wrote: For the save, you can use the first 30 characters of the last say this way: _last_say_what[:30]Code: Select all
action [SetVariable("save_name",_last_say_what[:30]),FileAction(i)]
However, I am not able to solve this problem. Seems like there are no ways to know how long the text would be. All factors, such as font choice, style choice, ruby text, characters with different size, length of words, language, reading order, etc. will all come in.
A better strategy here would be to redesign the save/load screen, so you don't have text being inside small slot anymore. For example you could have for example a big box that show the current scene and the current dialogue, which will be displayed when you hover the mouse over the slot.
Another additional strategy would be to make sure all the slot are to the extreme right of the screen. Then you can simply make the text box do not line break, and all the extra stuff will simply run off the right side of the screen.
- xavimat
- Eileen-Class Veteran
- Posts: 1458
- Joined: Sat Feb 25, 2012 8:45 pm
- Completed: Yeshua, Jesus Life, Cops&Robbers
- Projects: Fear&Love, unknown
- Organization: Pilgrim Creations
- Github: xavi-mat
- itch: pilgrimcreations
- Location: Spain
- Contact:
Re: Add Text to save game
I was wondering... this thread starts with a question about how to do something, but we haven't asked why you want to do this.
I mean, if you want the user to find easily what save refers to some point of the game (I'm making here an assumption), you can use the save_game variable the way usually is used. When every scene/act/part/chapter/arch/sub-part of your game starts, assign a value to that variable:
But, maybe you want this feature for another reason.
I mean, if you want the user to find easily what save refers to some point of the game (I'm making here an assumption), you can use the save_game variable the way usually is used. When every scene/act/part/chapter/arch/sub-part of your game starts, assign a value to that variable:
Code: Select all
$ save_game = "1 - An unexpected encounter"
"I was walking down the street when ..."
...
$ save_game = "2 - Breaking off"
girl "I hate you!"
...
$ save_game = "3 - Reconciliation"
"I decided to apologize..."Comunidad Ren'Py en español: ¡Únete a nuestro Discord!
Rhaier Kingdom A Ren'Py Multiplayer Adventure Visual Novel.
Cops&Robbers A two-player experiment | Fear&Love Why can't we say I love you?
Honest Critique (Avatar made with Chibi Maker by ~gen8)
Rhaier Kingdom A Ren'Py Multiplayer Adventure Visual Novel.
Cops&Robbers A two-player experiment | Fear&Love Why can't we say I love you?
Honest Critique (Avatar made with Chibi Maker by ~gen8)
- Yukari
- Regular
- Posts: 121
- Joined: Sun Feb 06, 2011 6:28 am
- Completed: Aozora Meikyuu, Yozora Rhapsody, Imolicious, Yume Puzzle, Apprehend;Girlfriend
- Projects: Games&Girls, Fuyuzora Rumble
- Organization: Yume Creations
- Tumblr: yumecreationsvn
- Location: Germany
- Contact:
Re: Add Text to save game
I just was curious since this function is in a lot japanese VNs.
Example:

If is use
and the player has several save slots with this name is harder to get the file.
And for the savegame comment, it's also easier if the player want save on a specific scene and can add a comment like "First date with Mary"
Example:

If is use
Code: Select all
$ save_game = "This is an example"And for the savegame comment, it's also easier if the player want save on a specific scene and can add a comment like "First date with Mary"
Re: Add Text to save game
Hi, I have the same question as Yukari; how to add current dialogue text to Save/Load slot's description? I want it to be like Yukari's screenshot example above, how to do so?
Also, about Elmiwisa's fix above, I can't figure out how/where to add the following code (I'm using imagemap for the save/load screen):
Really appreciate if anyone can help me please; I searched online for very long, but still can't find any relevant guide, OTZ......
Also, about Elmiwisa's fix above, I can't figure out how/where to add the following code (I'm using imagemap for the save/load screen):
Code: Select all
action If(renpy.current_screen().screen_name[0] == "load",FileLoad(i),FileLastSaySave(i))- curry nochi rice
- Miko-Class Veteran
- Posts: 746
- Joined: Sat Mar 27, 2010 3:12 am
- Projects: Delicatessen, Whom to Notice, Start of Something, Love Sorcery
- Organization: Circle Cosine
- IRC Nick: Curry
- Skype: after.curry.rice
- itch: project-rothera
- Contact:
Re: Add Text to save game
Necroing this because when you search for "adding text to save renpy" in google, this is the first to come up. My fix is:
Code: Select all
screen save():
tag menu
use navigation
use file_picker("save")
screen load():
# This ensures that any other menu screen is replaced.
tag menu
use navigation
use file_picker("load")
screen file_picker(currentScreen):
#on your save-slot/button
button:
if currentScreen == "save":
action [SetVariable("save_name",_last_say_what[:30]),FileAction(i)]
else:
action FileAction(i)
Who is online
Users browsing this forum: Google [Bot], Ocelot
