Custom load slot screenshot [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
beastcarving
Regular
Posts: 139
Joined: Mon May 13, 2019 5:03 pm
Completed: Pulse Cage https://beastcarving.itch.io/pulse-cage-the-full-series
Projects: Your Brother's Religion
Organization: BeastCarving Studio
IRC Nick: BeastCarving
Tumblr: beastcarving
Deviantart: beastcarving
Github: beastcarving
itch: beastcarving
Contact:

Custom load slot screenshot [SOLVED]

#1 Post by beastcarving »

Right now when I load a saved game it shows a screenshot from where I left off in the game.
I want to know how to change the screenshot into an image of my choice, the same way I'm able to change the save name by doing this in the script:

Code: Select all

$ save_name = "Chapter 3 Murder Unveiled"
I want to make function like this because I want to show images of my own that are more direct when reaching a certain part in the story, rather than a little screenshot.
Last edited by beastcarving on Thu Jan 23, 2020 6:02 am, edited 1 time in total.
Image Pulse Cage (full game)Image Your Brother's Religion (Demo)
PLAY HERE: https://beastcarving.itch.io/
Love my work: https://www.patreon.com/beastcarving

User avatar
gas
Miko-Class Veteran
Posts: 842
Joined: Mon Jan 26, 2009 7:21 pm
Contact:

Re: Custom load slot screenshot [help]

#2 Post by gas »

You can use a JSON function to determine a slot icon to show based on game values.
Let's pretend you have a value called 'lover', that register the character you're dating. There are 3 of them, with a value from 0 to 2 to identify them. If you're dating no one, you have your face instead.
Add the JSON function or modify the one you've coded already.

Code: Select all

init python:
    def myjson(jsondata):
        jsondata["thelover"]=lover
    config.save_json_callbacks.append(myjson)
Add a list of the icons.

Code: Select all

default sloticons=["eileenslot.png","charlizeicon.png", "lindsayicon.png","yourface.png"]
Later, in the screen you can retrieve this value to show the proper icon or null if the slot is not FileLoadable()). You should change the null width and height to the one of the icons you're using.

Code: Select all

                    button:
                        action FileAction(slot)

                        has vbox

                        if FileLoadable(slot):
                            # define the content
                            $ icon_numb=FileJson(slot,"thelover")
                            $ img=sloticons[icon_numb]
                            add "img"
                        else:
                            null height 200 width 200 
                        text FileTime(slot, format=_("{#file_time}%A, %B %d %Y, %H:%M"), empty=_("empty slot")):
                            style "slot_time_text"

                        text FileSaveName(slot):
                            style "slot_name_text"

                        key "save_delete" action FileDelete(slot)
 
If you want to debate on a reply I gave to your posts, please QUOTE ME or i'll not be notified about. << now red so probably you'll see it.

10 ? "RENPY"
20 GOTO 10

RUN

User avatar
beastcarving
Regular
Posts: 139
Joined: Mon May 13, 2019 5:03 pm
Completed: Pulse Cage https://beastcarving.itch.io/pulse-cage-the-full-series
Projects: Your Brother's Religion
Organization: BeastCarving Studio
IRC Nick: BeastCarving
Tumblr: beastcarving
Deviantart: beastcarving
Github: beastcarving
itch: beastcarving
Contact:

Re: Custom load slot screenshot [help]

#3 Post by beastcarving »

I keep running into an issue where it says, "global name 'lover' not defined" while customize the code a bit.
I've only changed this a little:

Code: Select all

screen load_save_slot: 
        if FileLoad:
            # define the content
            $ icon_numb=FileJson(number,"thelover")
            $ img=sloticons[icon_numb]
            add "img"
        else:
            null height 200 width 200
and this:

Code: Select all

default sloticons=["cover1.png","cover2.png", "cover3.png","cover4.png"]
Image Pulse Cage (full game)Image Your Brother's Religion (Demo)
PLAY HERE: https://beastcarving.itch.io/
Love my work: https://www.patreon.com/beastcarving

User avatar
wyverngem
Miko-Class Veteran
Posts: 615
Joined: Mon Oct 03, 2011 7:27 pm
Completed: Simple as Snow, Lady Luck's Due,
Projects: Aether Skies, Of the Waterfall
Tumblr: casting-dreams
itch: castingdreams
Location: USA
Contact:

Re: Custom load slot screenshot [help]

#4 Post by wyverngem »

I believe it's a simple fix. You just need to define thelover in your script by either using default or define at the beginning. Within the list remember each slot starts at position 0 and adds up.

User avatar
beastcarving
Regular
Posts: 139
Joined: Mon May 13, 2019 5:03 pm
Completed: Pulse Cage https://beastcarving.itch.io/pulse-cage-the-full-series
Projects: Your Brother's Religion
Organization: BeastCarving Studio
IRC Nick: BeastCarving
Tumblr: beastcarving
Deviantart: beastcarving
Github: beastcarving
itch: beastcarving
Contact:

Re: Custom load slot screenshot [help]

#5 Post by beastcarving »

Thanks. But now a new error screen emerged this one says, "TypeError: list indices must be integers, not NoneType "
Image Pulse Cage (full game)Image Your Brother's Religion (Demo)
PLAY HERE: https://beastcarving.itch.io/
Love my work: https://www.patreon.com/beastcarving

User avatar
wyverngem
Miko-Class Veteran
Posts: 615
Joined: Mon Oct 03, 2011 7:27 pm
Completed: Simple as Snow, Lady Luck's Due,
Projects: Aether Skies, Of the Waterfall
Tumblr: casting-dreams
itch: castingdreams
Location: USA
Contact:

Re: Custom load slot screenshot [help]

#6 Post by wyverngem »

You have to set it to a number and not None. It needs to be at least assigned to 0 as the default.

User avatar
beastcarving
Regular
Posts: 139
Joined: Mon May 13, 2019 5:03 pm
Completed: Pulse Cage https://beastcarving.itch.io/pulse-cage-the-full-series
Projects: Your Brother's Religion
Organization: BeastCarving Studio
IRC Nick: BeastCarving
Tumblr: beastcarving
Deviantart: beastcarving
Github: beastcarving
itch: beastcarving
Contact:

Re: Custom load slot screenshot [help]

#7 Post by beastcarving »

I'm still getting the error. Here's what I have so far. I might be missing something though.

Code: Select all

init python:
    def myjson(jsondata):
        jsondata["thelover"]=lover
    config.save_json_callbacks.append(myjson)

define sloticons=["cover1.png","cover2.png","cover3.png","cover4.png"]
default sloticons=1

and this in the screen:

Code: Select all

screen load_save_slot:
    button:
        action FileAction(number)
        # has vbox

    if FileLoadable(number):
        # define the content
        $ icon_numb=FileJson(number,"thelover")
        $ img=sloticons[icon_numb]
        add "img"
    else:
        null height 200 width 200
Image Pulse Cage (full game)Image Your Brother's Religion (Demo)
PLAY HERE: https://beastcarving.itch.io/
Love my work: https://www.patreon.com/beastcarving


User avatar
beastcarving
Regular
Posts: 139
Joined: Mon May 13, 2019 5:03 pm
Completed: Pulse Cage https://beastcarving.itch.io/pulse-cage-the-full-series
Projects: Your Brother's Religion
Organization: BeastCarving Studio
IRC Nick: BeastCarving
Tumblr: beastcarving
Deviantart: beastcarving
Github: beastcarving
itch: beastcarving
Contact:

Re: Custom load slot screenshot [help]

#9 Post by beastcarving »

Thank you so much! I looked to see if anyone else asked this before and found nothing. It's just what I was looking for. :)
Image Pulse Cage (full game)Image Your Brother's Religion (Demo)
PLAY HERE: https://beastcarving.itch.io/
Love my work: https://www.patreon.com/beastcarving

Post Reply

Who is online

Users browsing this forum: Google [Bot], Kocker