[SOLVED] Save/Load slot background change after saving

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
Xiael
Regular
Posts: 31
Joined: Thu Aug 06, 2020 9:13 am
itch: Xiael
Discord: message me first here
Contact:

[SOLVED] Save/Load slot background change after saving

#1 Post by Xiael » Fri Nov 06, 2020 5:13 pm

I don't think this is already asked before, and if it was can anyone redirect me to the post because I cannot find it on my own... Aside that, any kind of help is very much appreciated!

So what I want to do is this:
Image

Changing the background of a slot only after it was clicked and a file save was successfully created.
While looking thru the rpy files, I found that the picture of the screenshot that was also used as a background is the following code which I had commented out:

Code: Select all

#add FileScreenshot(slot) xalign 0.5
And I changed the button background into these instead:

Code: Select all

button:
               background Image("gui/slot_idle_background.png")
               hover_background Image("gui/slot_hover_background.png")
               insensitive_background Image("gui/slot_insensitive_background.png")
I could not figure out how to change the background only if there is already a saved file for it wherein the image background also depends on the progress of the game so far. I have scoured through any mention of the save/load screen in the documentation and still cannot come up with any solutions...
Last edited by Xiael on Sat Nov 07, 2020 9:16 am, edited 1 time in total.
Anime sprite commissions $30 per character: viewtopic.php?f=62&t=60703&p=536689#p536689

User avatar
hell_oh_world
Miko-Class Veteran
Posts: 777
Joined: Fri Jul 12, 2019 5:21 am
Projects: The Button Man
Organization: NILA
Github: hell-oh-world
Location: Philippines
Contact:

Re: Save/Load slot background change after saving

#2 Post by hell_oh_world » Fri Nov 06, 2020 7:01 pm

You can try this.

Code: Select all

button:
  if FileLoadable(slot):
    $ bg, hbg = "#f003", "#f007"

  else:
    $ bg, hbg = "#0000", "#0000"

  background bg
  hover_background hbg
This makes the background reddish if it is not empty, and transparent if it is.

Xiael
Regular
Posts: 31
Joined: Thu Aug 06, 2020 9:13 am
itch: Xiael
Discord: message me first here
Contact:

Re: Save/Load slot background change after saving

#3 Post by Xiael » Sat Nov 07, 2020 9:15 am

Thank you very much!

Code: Select all

if FileLoadable(slot):
is exactly what I am looking for!
Anime sprite commissions $30 per character: viewtopic.php?f=62&t=60703&p=536689#p536689

Post Reply

Who is online

Users browsing this forum: Google [Bot]