Ren'Py Codes for deleting saves and making it look like they are deleted

Mister_M

Engaged Member
Apr 2, 2018
2,387
4,582
First of all I want to say that this doesn't mean I am going to use this in the game, but I would like to know what code should be written for the choice or variable (reaching specific stat) to result with the game deleting saves. I know doing this is not very nice to the player - to say the least - but knowing this would be extremely helpful.

Also, I know that it is possible to make it look like the saves are deleted, while they're really not. Now this is smth that I think I could potentially use in the game I'm co-creating. Again, I have no idea atm how to write the necessary code.

Unfortunately my coding abilities are not great and I'm currently learning how to make a game in Ren'Py. We can write, we make music and we do all the drawings, but we never did any coding before.

Thank you all, who are willing to help.
 

anne O'nymous

I'm not grumpy, I'm just coded that way.
Modder
Donor
Respected User
Jun 10, 2017
10,355
15,268
[...] but knowing this would be extremely helpful.
No, knowing how to delete a file is absolutely not helpful, and even less "extremely helpful". And I don't talk about save file deletion, but really about file deletion whatever the file, because the two are exactly the same.


Also, I know that it is possible to make it look like the saves are deleted, while they're really not. Now this is smth that I think I could potentially use in the game I'm co-creating.
And the other members of the team know that you want to sabotage the game ? Because it's what will happen.

Players will notice that their saves aren't available anymore, and they'll believe that the game deleted them. Therefore they'll complain that "this game" is messing with their computer, saying that it's the proof that either the guys doing it are incompetent morons, or that they are voluntarily deleting files, and who know what other files, ending by saying that the game should be tagged as being a virus because of this.

Then, someone will look at the game code, see that the save files aren't deleted, just hidden. He'll say it, but near to no one will listen, because near to nobody read the threads. And the few that will listen will not stop complaining, because what the fuck, who's stupid enough to do this ?

Then, someone will make a quick fix, and the save files will be seen again, making all your effort totally vain and useless. But of course this will not change people opinion regarding the game. You did a stupid move, and a game rarely raise back after such thing.
 

Mister_M

Engaged Member
Apr 2, 2018
2,387
4,582
And the other members of the team know that you want to sabotage the game ? Because it's what will happen.
Well, it's the other member's idea for the super hidden ending not very far in the game.

Thank you for your answer.
 

anne O'nymous

I'm not grumpy, I'm just coded that way.
Modder
Donor
Respected User
Jun 10, 2017
10,355
15,268
Well, it's the other member's idea for the super hidden ending not very far in the game.
Wow, the ultimate game over... Because an early ending is a game over, even if it's an happy end.

And with the save being hidden, no other choices than to restart the game... I wonder how many players will not restart, just forgetting about this game that, apparently but appearance matters here, force you to restart each time you made a wrong choice.
Add to this the high number of compulsive players who want to see everything, and therefore will find this "super hidden" content, and it really looks like you found the receipt for failure.
 

Mister_M

Engaged Member
Apr 2, 2018
2,387
4,582
Wow, the ultimate game over... Because an early ending is a game over, even if it's an happy end.

And with the save being hidden, no other choices than to restart the game... I wonder how many players will not restart, just forgetting about this game that, apparently but appearance matters here, force you to restart each time you made a wrong choice.
Add to this the high number of compulsive players who want to see everything, and therefore will find this "super hidden" content, and it really looks like you found the receipt for failure.
Yeah, I'm not sure about it myself, but she wrote this specific ending on one of the routes (kinda like a meta punishment for being a very bad person with rather clear hints what's gonna happen and a msg afterwards), and I must say it makes sense to me given what's in the game. In any case, I promised I'll look into it, will try not to use it in a game tho. And thanks again for taking your time to response, I appreciate it.
 

79flavors

Well-Known Member
Respected User
Jun 14, 2018
1,581
2,219
Firstly, it's a dick move.
You know that. She knows that. We all know that. Don't do it.

However, I'm also a believer in people being able to make bad choices. Partly because the alternative is people telling everyone else what a good choice is (There are a lot of people out there who wouldn't want us to play any of the games on this site). But mainly because while I fundamentally disagree with what you might do with the information, I also support your right to do it. You also get to live with the consequences of making that choice.

So...


Deleting a save file.

Not as easy as you might first think.
RenPy stores your save in two locations (at least on Windows), so just relying on deleting the actual file isn't enough.

You're going to take a look at the RenPy functions that take care of saves like : .
Then perhaps and .

There's also auto-saves to worry about.


Pretending to delete a save file.

(still a dick move)

Probably the easiest way is to alter the save/load screens (known as screen file_slots(title):) to mess with how the contents of each save file is shown.

screens.rpy:
Python:
screen file_slots(title):

# lots of screen code... until...

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

                    $ slot = i + 1

                    if persistent.hide_saves == True:     # <-- Added
                        $ slot = 0                        # <-- Added

# more screen code...

The two extra lines of code override the save game slot number. So when it's showing a page of possible save games, it won't be able to find a matching save (so the slot will look empty).
(Unless the player saves... in which case, they'll get the same save file shown multiple times instead of their "real" saves).

Elsewhere in your game, you would have :

Python:
# near the top of script.rpy:

default persistent.hide_saves = False

# --- somewhere else in your code...

    if i_am_being_a_dick:
        $ persistent.hide_saves = True
    else:
        $ persistent.hide_saves = False

The persistent part is to ensure that even if someone quits the game and restarts, the save/load slots wouldn't show up in any sort of useful way.

I hope it goes without saying that you shouldn't do any of this.
And if you do, you should at least set persistent.hide_saves back to False at some point.
 
Last edited:
  • Red Heart
Reactions: Mister_M

anne O'nymous

I'm not grumpy, I'm just coded that way.
Modder
Donor
Respected User
Jun 10, 2017
10,355
15,268
The exist for a reason.
No... well, yes they exist for a reason, but it's not related to what you wrote.

I tend to forgot what I learned in the 00's, when I was maintaining a NNTP node, mostly for the French speaking part of Usenet. The whole NNTP protocol is totally transparent and anyone can do anything (including usurping one's identity, deleting any post he want, and so on). All this being based on a simple precept: If you are smart enough to know how to do it, you're also smart enough to know that you shouldn't do it.

In the present case OP didn't knew how to do it, but it don't change much in the end. Like I said, since it's Ren'Py, soon enough someone would undo the evil that have been done, so the consequences are relatively limited.
Exactly like they were on Usenet at that time. Most admins had a set of tools ready to counter the consequences when someone was just half smart. I should remember this more often.


And this kids, end tonight episode of your favorite series, "Uncle Anne is yet again stuck in the good old time that was really better, believe him, he lived it".
 
  • Like
Reactions: 79flavors