Save Screen: Custom Images For Slots Based on Route?

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
AvalonMelody
Regular
Posts: 44
Joined: Thu May 29, 2014 2:14 am
Contact:

Save Screen: Custom Images For Slots Based on Route?

#1 Post by AvalonMelody »

Salutations!

I've been doing a bit of searching but I can't find very much about this (Apologies if it's right under my nose though), so I hoped to ask here. ^^

In Ren'Py, when you save the slot picture is normally of a screenshot of the spot you saved at.
I'd like to change it to be a set image depending on which character's route you're on. (Or something else if you're on the common route.) So, instead of a screenshot, it's a set image (perhaps of a character or a pattern even.)


How could I do this? Are there any guides or places you could link me to, or walk me through the process? I'd assume there'd have to be flags or persistent data involved? I think in the Ren'Py wiki some things aren't saved when you save. //laugh

Just in case, I'll give a quick example!
Say you're currently on the common route of the game. When you save in a save slot, the image is not a screenshot of where you saved but a set picture (a very simple one; common route after all.) Later on when you save your file, you're on Character A's route, so when you save your game, instead of the simple picture you get when you're on the common route, it's now a picture of Character A, denoting you're on Character A's route.

Any help would be appreciated. ^^/) Cheers!
Last edited by AvalonMelody on Wed Mar 14, 2018 7:26 pm, edited 1 time in total.

User avatar
Ocelot
Lemma-Class Veteran
Posts: 2400
Joined: Tue Aug 23, 2016 10:35 am
Github: MiiNiPaa
Discord: MiiNiPaa#4384
Contact:

Re: Save Screen: Custom Images For Slots Based on Route?

#2 Post by Ocelot »

There is no obvious way to change screenshot. However, you do not need to use save screenshot at all! YOu can edit file_slots screen and remove part where it adds screenshot to the screen. This solves proble of displaying image you do not want.

Now to displaying image you actually want. You can add arbitrary key: value pairs to the save. Adding image that way would be a hard task, but you actually do not need an image there. You just need an indicator, which rout you are on, so you could use it to decide what image to show.

Some example code:

Code: Select all

# A variable which would be saved.
# Denotes current route
# Starts with 'common', you set it to other values as ou change routes
default current_route = 'common'

init python:
    # A function to add current_route variable to externally visible save data
    def save_route(d):
        d['route'] = current_route

    # Append that function to the list of function executing on save
    config.save_json_callbacks.append(save_route)

label start:
    'If you save here,current_route would be "common".'
    menu:
        'Who do you like the most'
        'Jessica':
            $ current_route = 'jessica'
        'Ann':
            $ current_route = 'ann'
    'If you save now, current_route value will depend on choice you did before.'

# Part of file_slots screen:
button:
    action FileAction(slot)

    has vbox

    # Remove:
    # add FileScreenshot(slot) xalign 0.5

    # New stuff:
    $ cur_route = FileJson(slot, key='route')
    if cur_route == 'common':
        add 'route common' xalign 0.5
    elif cur_route == 'jessica':
        add 'route jessica' xalign 0.5
    elif cur_route == 'ann':
        add 'route ann' xalign 0.5

    text FileTime(slot, format=_("{#file_time}%A, %B %d %Y, %H:%M"), empty=_("empty slot")):
        tyle "slot_time_text"

    text FileSaveName(slot):
        style "slot_name_text"

    key "save_delete" action FileDelete(slot)
< < insert Rick Cook quote here > >

User avatar
AvalonMelody
Regular
Posts: 44
Joined: Thu May 29, 2014 2:14 am
Contact:

Re: Save Screen: Custom Images For Slots Based on Route?

#3 Post by AvalonMelody »

(Sorry for this late message back, been out of town ><)

Ahh, I see. So it's not at all possible? Can't we just replace the save image displayed with a set image file? (Though that sounds easier than actually doing that, hrm...) >.<;;

Thank you for the alternative though! I'll see if there are any other answers too, just in case.

Cheers~

User avatar
Ocelot
Lemma-Class Veteran
Posts: 2400
Joined: Tue Aug 23, 2016 10:35 am
Github: MiiNiPaa
Discord: MiiNiPaa#4384
Contact:

Re: Save Screen: Custom Images For Slots Based on Route?

#4 Post by Ocelot »

THere is a TakeScreenshot action and corresponding Python function which is used to prepare a screenshot (and exposed so we could mayde make a screenshot without UI). I never tried it and do not know how to efficiently use it, but, in theory, you can show image you want, take screenshot and hide it when you enter game menu. It will probably look like one frame flash of different image.
< < insert Rick Cook quote here > >

User avatar
AvalonMelody
Regular
Posts: 44
Joined: Thu May 29, 2014 2:14 am
Contact:

Re: Save Screen: Custom Images For Slots Based on Route?

#5 Post by AvalonMelody »

Hmm I see. :0
Though, I don't need the screenshot feature, just the ability to change the image that is saved in the save slot. ><

Post Reply

Who is online

Users browsing this forum: No registered users