[SOLVED] Save Slot Color Change for a 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
henne
Newbie
Posts: 19
Joined: Tue May 25, 2021 6:10 am
Contact:

[SOLVED] Save Slot Color Change for a Route

#1 Post by henne »

Hello there,

So, I was thinking about changing the color(s)/image of the save slot when someone reaches a certain route in my game.

Normally, I would just use some if/else (will still do that, I guess?) but I realized that I cannot find the image inside my screens.rpy or somewhere else to make use of variables. I use the standard saving screen with some slight modifications to its look but aside from that it's pretty much the original one, so I am a bit confused where to place my stuff in this case?

So it's it kind of like this:

Code: Select all

### Somewhere in the game:

label somewhere_in_the_game:

  $ normalsave = "whatever the new one is called"       

   "text text text"

What do I do after using that:
https://www.renpy.org/doc/html/config.h ... _callbacks

Code: Select all

default normalsave = "whatever it is called"

init python:

    def altcolor_save(d):
        d["normalsave"] = normalsave

    config.save_json_callbacks.append(altcolor_save)
Last edited by henne on Wed Apr 12, 2023 8:48 am, edited 1 time in total.

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

Re: Save Slot Color Change for a Route

#2 Post by Ocelot »

USe FileJson function:
https://www.renpy.org/doc/html/screen_a ... l#FileJson

Modifying standard file_slots screen:

Code: Select all

button:
    action FileAction(slot)

    if FileJson(slot, "normalsave") == "whatever it is called":
        background "#F00"
    else:
        background "#0F0"

    has vbox

    add FileScreenshot(slot) xalign 0.5

    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)
< < insert Rick Cook quote here > >

User avatar
henne
Newbie
Posts: 19
Joined: Tue May 25, 2021 6:10 am
Contact:

Re: Save Slot Color Change for a Route

#3 Post by henne »

I see, thanks a lot :)

For some reason I didn't think that it would just be the "background", so I was unsure what to do with all of that.

Post Reply

Who is online

Users browsing this forum: Bing [Bot]