[Solved] Changing text size on save/load slots

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
kostek00
Regular
Posts: 131
Joined: Wed Mar 28, 2018 5:54 pm
Contact:

[Solved] Changing text size on save/load slots

#1 Post by kostek00 »

I used code for save/load screen from this tutorial. (BTW, thanks Camille, it was very helpful.) There is one thing that I need to change but I don't know how. I need to be able to change size of the slot number, date and save name separatly but I don't know how to do this with current code:

Code: Select all

screen file_picker_slot:
    $ file_text = "%s %s\n  %s" % (
                        FileSlotName(number, 14),
                        FileTime(number, format=("%d/%m/%Y"), empty=("")),
                        FileSaveName(number))

    add FileScreenshot(number) pos(8,8)
    text file_text pos(84,7) size 18 color "#ffffff" drop_shadow(1,1)
As you can see I can only set font size for whole text on save slot. I tried to split all of those lines changing name acording to what it does. Unfortunately I always get error in first line that "u' 1'" can't be displayed as text. This is how I tried to do that:

Code: Select all

screen file_picker_slot:
    $ file_number = "%s" % (
                        FileSlotName(number, 14))
    
    $ file_date = "%s" % (
                        FileTime(number, format=("%d/%m/%Y"), empty=("")))
    
    $ file_name = "%s" % (
                        FileSaveName(number))

    add FileScreenshot(number) pos(8,8)
    text file_number pos(84,7) size 18 color "#ffffff" drop_shadow(1,1)
    text file_date pos(154,7) size 14 color "#ffffff" drop_shadow(1,1)
    text file_name pos(84,27) size 16 color "#ffffff" drop_shadow(1,1)

In case it's needed here is whole save/load screen code:

Code: Select all

screen file_picker_slot:
    $ file_text = "%s %s\n  %s" % (
                        FileSlotName(number, 14),
                        FileTime(number, format=("%d/%m/%Y"), empty=("")),
                        FileSaveName(number))

    add FileScreenshot(number) pos(8,8)
    text file_text pos(84,7) size 18 color "#ffffff" drop_shadow(1,1)


screen file_picker:
    add "images/gui/menu_ground.png"

    imagemap:
        auto "images/gui/file_picker_%s.png"

        alpha False

        hotspot(304,25,133,42) action FilePage("auto")
        hotspot(451,25,152,42) action FilePage("quick")
        hotspot(608,28,32,32) action FilePage(1)
        hotspot(642,28,32,32) action FilePage(2)
        hotspot(676,28,32,32) action FilePage(3)
        hotspot(710,28,32,32) action FilePage(4)
        hotspot(744,28,32,32) action FilePage(5)
        hotspot(679,558,72,33) action Return()

        hotspot(20,70,370,60) action FileAction(1):
            use file_picker_slot(number=1)
        hotspot(20,140,370,60) action FileAction(2):
            use file_picker_slot(number=2)
        hotspot(20,210,370,60) action FileAction(3):
            use file_picker_slot(number=3)
        hotspot(20,280,370,60) action FileAction(4):
            use file_picker_slot(number=4)
        hotspot(20,350,370,60) action FileAction(5):
            use file_picker_slot(number=5)
        hotspot(20,420,370,60) action FileAction(6):
            use file_picker_slot(number=6)
        hotspot(20,490,370,60) action FileAction(7):
            use file_picker_slot(number=7)
        hotspot(410,70,370,60) action FileAction(8):
            use file_picker_slot(number=8)
        hotspot(410,140,370,60) action FileAction(9):
            use file_picker_slot(number=9)
        hotspot(410,210,370,60) action FileAction(10):
            use file_picker_slot(number=10)
        hotspot(410,280,370,60) action FileAction(11):
            use file_picker_slot(number=11)
        hotspot(410,350,370,60) action FileAction(12):
            use file_picker_slot(number=12)
        hotspot(410,420,370,60) action FileAction(13):
            use file_picker_slot(number=13)
        hotspot(410,490,370,60) action FileAction(14):
            use file_picker_slot(number=14)


screen save:
    tag menu
    use file_picker
    add "images/gui/file_picker_overlay_save.png"


screen load:
    tag menu
    use file_picker
    add "images/gui/file_picker_overlay_load.png"
Last edited by kostek00 on Sat May 26, 2018 8:19 am, edited 1 time in total.

kivik
Miko-Class Veteran
Posts: 786
Joined: Fri Jun 24, 2016 5:58 pm
Contact:

Re: Changing text size on save/load slots

#2 Post by kivik »

Try this:

Code: Select all

    text "%s" % file_number pos(84,7) size 18 color "#ffffff" drop_shadow(1,1)
I think the error is saying that text expects a string but received an int, so you just need to convert it into a string first.

User avatar
kostek00
Regular
Posts: 131
Joined: Wed Mar 28, 2018 5:54 pm
Contact:

Re: Changing text size on save/load slots

#3 Post by kostek00 »

It works, thanks.

Post Reply

Who is online

Users browsing this forum: Semrush [Bot]