Page 1 of 1

[SOLVED] Displaying image in save slots based on file name?

Posted: Sat Dec 24, 2016 3:34 am
by kekkan
Hi all! So I have a game with multiple routes, and when the player enters the route I change the name like this:

Code: Select all

    $ save_name = "Jun Route"
My question is: how do I display an image on the save/load slot based on the route the player is in? I want to show an image of the route character's face next to the thumbnail.

For reference, this is what my save slot code looks like:

Code: Select all

screen load_save_slot:
    # %s is filename in slot, %B i smonth, % 
    $ file_text = "%2s. %s \n  %s" % (
                        FileSlotName(number, 4),
                        FileTime(number, format='%B %d, %Y \n    (%I:%M%p)', empty=_("Empty Slot")),
                        FileSaveName(number))
    
    add FileScreenshot(number) xpos 0 ypos 37
    text file_text xmaximum 260 ymaximum 300 xpos 15 ypos 200 size 20 color "#000000" outlines [ (0, "#000000") ] font "OsakaMono.ttf"
Thanks!

Re: Displaying image in save/load slots based on file name?

Posted: Sat Dec 24, 2016 5:59 am
by vollschauer
I just c&p some of my code ...that gives you and idea.

Code: Select all

screen save_load_details:
    $ save_chapter = FileSaveName(slot, empty='', page=page)
.....
    # Add the ScreenShot
    add FileScreenshot(slot, page=page) xoffset -123 yoffset -4
    # Add the Chapter/Route images
    if save_chapter:
        add save_chapter xoffset -107 yoffset -18
you need to define some images

Code: Select all

image JunRoute = "blabla/save_chap01.png"
in you script you set then

Code: Select all

$ save_name = "JunRoute"

Re: Displaying image in save/load slots based on file name?

Posted: Sat Dec 24, 2016 1:09 pm
by kekkan
Thanks for replying!! I tried your code out, and it shows different images on the save screen based on what part of the game the player is currently in (i.e. if I just started the game all of the save slots show the Common Route picture, and once I enter the Jun Route all of the pictures change to the Jun Route picture). But what I want is for each save slot to have a picture that shows what route the save is in, and for the empty slots to show no pictures at all.

Edit: I realized this was because I didn't have the "$ save_name = FileSaveName(slot, empty='', page=page)" part of your code ^^''

Re: Displaying image in save/load slots based on file name?

Posted: Sat Dec 24, 2016 1:36 pm
by kekkan
I figured it out! I just edited your code slightly and used this:

Code: Select all

    if FileSaveName(number):
        add FileSaveName(number)
Thank you! :D