How to name custom save/load slots[SOLVED]

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
Pinlin
Regular
Posts: 98
Joined: Fri Feb 08, 2013 9:33 am
Projects: Dark nights
Tumblr: darknightsblog
Deviantart: Pinlin
Contact:

How to name custom save/load slots[SOLVED]

#1 Post by Pinlin » Wed Jul 13, 2016 3:06 am

Hello, I wondered if it is possible to name your save/load slots with multiple variables?
For example:
[1] Slot number
[2] Date/time
[3] Character route
[4] Chapter number
[5] Day number

It should look like this:
Image
What I currently got is:
Image
Right now I've only used 1 variable and the text goes outside the box. The code, \n, that is used for breaking to next line doesn't work if I place it like this in the script. Renpy ignores them:

Code: Select all

$ save_name = "Jack Route \n Chapter 1 \n Day 22"
or place it here, because errors will occur.

Code: Select all

screen load_save_slot:
    $ file_text = "%2s. %s\n  %s" % (
                        FileSlotName(number, 6),
                        FileTime(number, empty=_("Empty Slot.")),
                        "\n",
                        FileSaveName(number)) 
Anyway, that was one way I tried to approach it. I have read these threads:
viewtopic.php?f=8&t=37166&hilit=custom+save+slot
https://www.renpy.org/doc/html/save_loa ... -variables

but I still don't understand how to use multiple variables for naming save/load slots.
I'd understand better with samples, thank you in advance.
Last edited by Pinlin on Sat Nov 26, 2016 6:32 am, edited 1 time in total.
Deviantart | Tumblr

Current project:

Image

User avatar
chocoberrie
Veteran
Posts: 254
Joined: Wed Jun 19, 2013 10:34 pm
Projects: Marshmallow Days
Contact:

Re: How to name custom save/load slots

#2 Post by chocoberrie » Wed Jul 13, 2016 12:21 pm

This is an excellent question! I am trying to find a solution for it; I'd like to know as well! (currently reading through this)

Hopefully someone around here knows what to do :D

User avatar
chocoberrie
Veteran
Posts: 254
Joined: Wed Jun 19, 2013 10:34 pm
Projects: Marshmallow Days
Contact:

Re: How to name custom save/load slots

#3 Post by chocoberrie » Wed Jul 13, 2016 1:19 pm

I found this thread that shows the use of /n to make the slot text show up in multiple lines:

Code: Select all

$ file_text = "{size=+4}{i}%s{/i}{/size}\n%s: %s" % (
                        FileSaveName(number),
                        FileSlotName(number, 4),
                        FileTime(number, format='%B %d, %Y \n    (%I:%M%p)', empty=_("Empty Slot."))
                        )
From this, it looks like /n is supposed to go before the bit of code that you want to have on the next line.
ristorante save screen.png
  • %s is the file name that shows up in the slot
  • %B is the month
  • %d is the day
  • %Y is the year
  • (%I:%M%p) shows the time in hours:minutes am/pm in parentheses on a new line because /n comes before it
Based on all of that, maybe try this?

Code: Select all

screen load_save_slot:
    $ file_text = "%2s. %s\n  %s" % (
                        FileSlotName(number, 6),
                        FileTime(number, empty=_("Empty Slot.")),
                        FileSaveName(number))
This will show:

4. Jun 16, 14:45
Jack Route
Chapter 1

I'm not quite sure how you could add Day 12 on a new line... The above code only has three strings in quotation marks, not four.

(I referenced this thread for more info about the strings involved in file_text)

User avatar
Pinlin
Regular
Posts: 98
Joined: Fri Feb 08, 2013 9:33 am
Projects: Dark nights
Tumblr: darknightsblog
Deviantart: Pinlin
Contact:

Re: How to name custom save/load slots

#4 Post by Pinlin » Tue Nov 22, 2016 10:24 am

@chocoberrie

Sorry for the late reply. Thank you a lot for the help, I solved it. It was just like you said. To add another line, I solved with adding \n within the quotes.
Somehow it works now:

Code: Select all

$ save_name =  "   Jack Route\n     Chapter 1\n     Day 12"
It shows:
4. Jun 14, 8:03
  • Jack Route
    Chapter 1
    Day 12
I added spaces to make the lines align. There must be more ways, but I go for this simple solution.
Deviantart | Tumblr

Current project:

Image

Post Reply

Who is online

Users browsing this forum: Google [Bot]