Solved:Empty save slot check, check/adding to tuple-SaveName

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
OhWee
Newbie
Posts: 10
Joined: Sun Jan 22, 2017 1:22 pm
Contact:

Solved:Empty save slot check, check/adding to tuple-SaveName

#1 Post by OhWee »

So, I have a couple of basic questions.

I'm working with a modified load/ave game screen, and have added some icons to place behind some tuple string entries that have been added to FileSaveName.

First question:

I'd like to only have my screenshot_overlay.png (the graphic that has all of the icons for the numbers I'm displaying in the save slot) only show up in 'occupied' save slots. I have this graphic appearing on top of the FileScreenshot(i) pic in each save slot (so if there are 10 slots, it appears 10 times), but of course it is also appearing on top of the empty save slots. What would be the proper way to code a chedk for 'if save/load slot is occupied, add screenshot_overlay.png, else (nothing happens)?

This question also applies to some text strings that I'm placing on top of the screenshot overlay (the overlay provides pretty background icons for the numbers to be placed on top of), so I plan to use use the 'if load/save slot not empty' check here as well, or just assign all of them to the same 'if' check.

------

Secondly, I have four values which have been added to FileSaveName as a set. I have a fifth value that I'd like to add to the string set, but only for FileSaveName strings which do not have the fifth value.

Here's the init python code I have which is currently checking older saves for data, and it adds placeholder info to the string sets which don't have the separator. I've commented out the attempted code check that didn't work out for me, I was attempting to temporarily assign 'Day ?' to the output variable if the fifth string slot was empty, although I also need to know how to check the strings in order to assign a fifth value if it's not there already:

%@ is the separator that is being used between each of the values in the string, for FileSaveName(number) strings that have more than one value included.

Code: Select all

init python:
    def info_string_save(data):
        if '%@' in data:
            #if len(FileSaveName(number)) > 4:
                # s_description, disp_might, disp_dex, disp_con, disp_day = data.split('%@', 4)
            #else: line below needs indent if comment out is removed.
             sgame_description, disp_might, disp_dex, disp_con = data.split('%@', 3)
             disp_day = 'Day ?'
        else:
            disp_might = '?'
            disp_dex = '?'
            disp_con = '?'
            disp_day = 'Day ?'
            s_description ='None'
        return (s_description, disp_might, disp_dex, disp_con, disp_day)
Suggestions?
Last edited by OhWee on Fri Jul 21, 2017 7:01 am, edited 1 time in total.

OhWee
Newbie
Posts: 10
Joined: Sun Jan 22, 2017 1:22 pm
Contact:

Re: Empty save slot check, check/adding to tuple in FileSave

#2 Post by OhWee »

OK, I figured out how to get a handle on the separators check. I'd have used commas myself, but I'm working with someone else's code here.

I still need to figure out an easy way to check for an empty save slot, so that I can 'lock out' some overlay icons if the slot is empty. Help?

I'm fairly new to RenPy, so if this sounds like a 'noob' question, it is...

OhWee
Newbie
Posts: 10
Joined: Sun Jan 22, 2017 1:22 pm
Contact:

Re: Empty save slot check, check/adding to tuple in FileSave

#3 Post by OhWee »

I figured out a way to do it. Solved.

Post Reply

Who is online

Users browsing this forum: Andredron, Google [Bot]