Ren'Py Picture in the save and load slot

Deleted member 2492533

Delicious
Donor
Game Developer
Jun 19, 2020
89
317
Hello everyone, I have a problem with the picture in the save and load slot. The screenshot shows that I have to use this picture. If I remove this picture in the GUI, it will be just transparent space. How to make a standard slot? When in place of the slot is a screenshot at the time of saving.
You don't have permission to view the spoiler content. Log in or register now.

P.S. I'm using imagemap for the GUI (Maybe this information will be important for the answer).
 

79flavors

Well-Known Member
Respected User
Jun 14, 2018
1,581
2,219
It really depends on how much you've gutted the original code to create your custom save/load screens.

The base RenPy code includes this (or something like this, depending on the RenPy version)...

Python:
# --- screens.rpy ---

# part of screen file_slots(): ...

                for i in range(gui.file_slot_cols * gui.file_slot_rows):

                    $ slot = i + 1

                    button:
                        action FileAction(slot)

                        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)
Essentially "create a clickable button with a vbox that has a screenshot, some date/time text and the name of the save game slot (if it's used)" within it.

It's that add FileScreenshot(slot) xalign 0.5 that may be what you are looking for. FileScreenshot() is the inherent RenPy function for taking care of that picture for you. It's generally controlled by tweaking configuration variables like gui.slot_button_width,config.thumbnail_width etc. (see your gui.rpy).

It sounds like you might also need to take a look at the standard gui's images for blank save/load slots.
/game/gui/button/slot_idle_background.png and /game/gui/button/slot_hover_background.png.

More info:
 

79flavors

Well-Known Member
Respected User
Jun 14, 2018
1,581
2,219
Honestly. This one is taxing me.

I've avoided classes, screens and styles for the best part of two years now. I was knee deep in classes last week and screens/styles now.

The original load/save code is completely removed and replaced with custom code.
(The game is here : https://f95zone.to/threads/my-amazing-life-v0-1-sweet-mango.56724/)

Plus the code it has been replaced with seems to have been part of a guide/tutorial that is severely dated (it's using hotspots for everything). The menus only work with pixel levels of precision, due to the hotspots acting on individual pixels of text. At this point, it's become a learning exercise for me... one I'd been avoiding.

Give a man a fish and you feed him for a day;
Teach a man to fish and he'll steal your fishing rod.


Anyway... let's keep this on topic... screens and how to fix a problematic save/load screen.
 

79flavors

Well-Known Member
Respected User
Jun 14, 2018
1,581
2,219
Okay, a bit of resolution to this one.

The main thing here is that the add FileScreenshot(slot) xalign 0.5 doesn't really integrate with imagemap: and hospot:. Sat here now, in hindsight... I am wondering if you could simply overlap the two and still rely on the hotspot to take care of the interactions. But to do so might mean other save/load UI functionality being lost too. Regardless, that wasn't the route I took.

I decided to copy/paste the original screen load():, screen save(): and screen file_slots(): code from another unaltered RenPy game. I got so far with that, before I ran into problems because the load and save screen also make use of the common game_menu() and main_menu() screens to act as wrappers around these screens.

All the menus, except the main menu, had been oriented horizontally instead of vertically. They'd also all been gutted, in favor of hotspots:. The Preferences, About, Help, etc screens all used hotspots for everything.

So rather than try to implement one solution on two screens, while leaving an entirely different solution on all the other screens... I went with a scorched earth policy. I copied a vanilla copy of screens.rpy from another project. In effect, I reverted the UI back to it's original format, completely wiping out all those hotspots code. I then worked forward, adapting the existing code to look like the version of the game using hotspots. I butchered a lot of styles along the way. I'm sure with more patience, I could have done it a better way. The final version isn't a 100% match, but it is close enough.

The end result is that screen main_menu is still vertical (using vboxes, but screen game_menu is now horizontal (using hboxes. Everything that was previous done using hotspot: is now using textbutton:. Which allows the default code for save/load screens to work with very little modification... and so save thumbnails, etc... all work again.
 
Last edited: