How do I use $ renpy.unlink_save

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
AHAKuo
Regular
Posts: 41
Joined: Tue Feb 06, 2018 11:10 am
Projects: SoUnd Is ToxIc
Organization: AHAKuo
Tumblr: ahakuo
Deviantart: ahakuo
Contact:

How do I use $ renpy.unlink_save

#1 Post by AHAKuo »

I wanted to use this code so that a save gets deleted when a certain scene appears, but how do I use this code if I want to delete let's say... slot 1 of the saves in page 1?

Thanks ^^
Working on:

Image

kivik
Miko-Class Veteran
Posts: 786
Joined: Fri Jun 24, 2016 5:58 pm
Contact:

Re: How do I use $ renpy.unlink_save

#2 Post by kivik »

Is this another one of those four wall breaking game that every body's trying to do which are actually anti-player?

User avatar
AHAKuo
Regular
Posts: 41
Joined: Tue Feb 06, 2018 11:10 am
Projects: SoUnd Is ToxIc
Organization: AHAKuo
Tumblr: ahakuo
Deviantart: ahakuo
Contact:

Re: How do I use $ renpy.unlink_save

#3 Post by AHAKuo »

kivik wrote: Mon May 28, 2018 4:14 pm Is this another one of those four wall breaking game that every body's trying to do which are actually anti-player?
Yep, it is. I was going to look for an alternative but I'd rather figure this one out. It's really important for when the game enters the second playthrough, saves have to be gone, otherwise, it might ruin the game itself.
Working on:

Image

User avatar
Milkymalk
Miko-Class Veteran
Posts: 754
Joined: Wed Nov 23, 2011 5:30 pm
Completed: Don't Look (AGS game)
Projects: KANPEKI! ★Perfect Play★
Organization: Crappy White Wings
Location: Germany
Contact:

Re: How do I use $ renpy.unlink_save

#4 Post by Milkymalk »

kivik wrote: Mon May 28, 2018 4:14 pm Is this another one of those four wall breaking game that every body's trying to do which are actually anti-player?
Don't be so harsh. A lot of people who played DDLC were so impressed by it that they found their way here, it's only natural that many of them want to do something similar.

While I can't help with the problem, a word of advice: What DDLC did is fun once in a while, but it grows old quickly. That said, if what you are doing is actually an original idea, go for it. Just always think, "How would I feel if that happened to me as a player?"
Crappy White Wings (currently quite inactive)
Working on: KANPEKI!
(On Hold: New Eden, Imperial Sea, Pure Light)

User avatar
Enchant00
Regular
Posts: 136
Joined: Tue Jan 12, 2016 1:17 am
Contact:

Re: How do I use $ renpy.unlink_save

#5 Post by Enchant00 »

Paste this code above your start:

Code: Select all

init python:
    slots = renpy.list_slots()

    def delete_slot(number):
        slots = renpy.list_slots()
        saveGames = renpy.list_saved_games()
        slots_file_name = {}
        for count, i in enumerate(slots):
            slots_file_name[count] = [i, str(saveGames[count][0])]
        renpy.unlink_save(slots_file_name[number - 1][1])

label start:
How to use
1. Before you delete a save, first creat some text with the one below

Code: Select all

    "[slots]"
- When you run your game this will print something like this ['1-2', '1-3', '1-4'.....] The first digit would be your Page while the second digit is your Slot number. So a '1-2' would mean: page 1, slot 2

2. When you want to delete a save, you would use the function I made

Code: Select all

    "[slots]"
    
    $ delete_slot(number)
- Number is basically the number of the slot in the order :lol: So in our example above with the ['1-2', '1-3', '1-4'.....] '1-2' is number 1, '1-3' is number 2, '1-4' is number 3 so on and so forth.
- So if I want to delete slot number 1 then I would do this

Code: Select all

    $ delete_slot(1)
By the way, Step 1 is not really necessary as it just allows you to know what are the slots numbers. So when you finalize your game, you can just omit step 1 altogether and head straight to step 2.

User avatar
AHAKuo
Regular
Posts: 41
Joined: Tue Feb 06, 2018 11:10 am
Projects: SoUnd Is ToxIc
Organization: AHAKuo
Tumblr: ahakuo
Deviantart: ahakuo
Contact:

Re: How do I use $ renpy.unlink_save

#6 Post by AHAKuo »

Milkymalk wrote: Mon May 28, 2018 5:41 pm
kivik wrote: Mon May 28, 2018 4:14 pm Is this another one of those four wall breaking game that every body's trying to do which are actually anti-player?
Don't be so harsh. A lot of people who played DDLC were so impressed by it that they found their way here, it's only natural that many of them want to do something similar.

While I can't help with the problem, a word of advice: What DDLC did is fun once in a while, but it grows old quickly. That said, if what you are doing is actually an original idea, go for it. Just always think, "How would I feel if that happened to me as a player?"
I will take your words to heart ^^ Thank you <3
Working on:

Image

User avatar
AHAKuo
Regular
Posts: 41
Joined: Tue Feb 06, 2018 11:10 am
Projects: SoUnd Is ToxIc
Organization: AHAKuo
Tumblr: ahakuo
Deviantart: ahakuo
Contact:

Re: How do I use $ renpy.unlink_save

#7 Post by AHAKuo »

Enchant00 wrote: Mon May 28, 2018 5:51 pm Paste this code above your start:

Code: Select all

init python:
    slots = renpy.list_slots()

    def delete_slot(number):
        slots = renpy.list_slots()
        saveGames = renpy.list_saved_games()
        slots_file_name = {}
        for count, i in enumerate(slots):
            slots_file_name[count] = [i, str(saveGames[count][0])]
        renpy.unlink_save(slots_file_name[number - 1][1])

label start:
How to use
1. Before you delete a save, first creat some text with the one below

Code: Select all

    "[slots]"
- When you run your game this will print something like this ['1-2', '1-3', '1-4'.....] The first digit would be your Page while the second digit is your Slot number. So a '1-2' would mean: page 1, slot 2

2. When you want to delete a save, you would use the function I made

Code: Select all

    "[slots]"
    
    $ delete_slot(number)
- Number is basically the number of the slot in the order :lol: So in our example above with the ['1-2', '1-3', '1-4'.....] '1-2' is number 1, '1-3' is number 2, '1-4' is number 3 so on and so forth.
- So if I want to delete slot number 1 then I would do this

Code: Select all

    $ delete_slot(1)
By the way, Step 1 is not really necessary as it just allows you to know what are the slots numbers. So when you finalize your game, you can just omit step 1 altogether and head straight to step 2.

This is very useful, Enchant! Thank you so much for the help. I can't thank you enough ^^ <3 This will help so much in the long run :D
Working on:

Image

User avatar
AHAKuo
Regular
Posts: 41
Joined: Tue Feb 06, 2018 11:10 am
Projects: SoUnd Is ToxIc
Organization: AHAKuo
Tumblr: ahakuo
Deviantart: ahakuo
Contact:

Re: How do I use $ renpy.unlink_save

#8 Post by AHAKuo »

Milkymalk wrote: Mon May 28, 2018 5:41 pm
kivik wrote: Mon May 28, 2018 4:14 pm Is this another one of those four wall breaking game that every body's trying to do which are actually anti-player?
Don't be so harsh. A lot of people who played DDLC were so impressed by it that they found their way here, it's only natural that many of them want to do something similar.

While I can't help with the problem, a word of advice: What DDLC did is fun once in a while, but it grows old quickly. That said, if what you are doing is actually an original idea, go for it. Just always think, "How would I feel if that happened to me as a player?"
The idea of the game is actually involving bits of horror, puzzles, and is a story revolving around the sound design concepts. I don't know how it will be taken by users but I find it fun ^^
Working on:

Image

User avatar
Enchant00
Regular
Posts: 136
Joined: Tue Jan 12, 2016 1:17 am
Contact:

Re: How do I use $ renpy.unlink_save

#9 Post by Enchant00 »

Well the code isn't perfect though since it would assume that you know all the slots the player would save at. This wouldn't be a problem if the player has like maybe 1 page of saves but if they have like 10+ saves, 3+pages then that might be a problem.

If you want to delete all player saves, then change the delete slot to as follow:

Code: Select all

init python:
    slots = renpy.list_slots()

    def delete_slot(number = 0, all = False):
        slots = renpy.list_slots()
        saveGames = renpy.list_saved_games()
        slots_file_name = {}
        for count, i in enumerate(slots):
            slots_file_name[count] = [i, str(saveGames[count][0])]
        if number != 0:
            renpy.unlink_save(slots_file_name[number - 1][1])
        elif all:
            for i in slots_file_name:
                renpy.unlink_save(slots_file_name[i][1])

label start:


So if you want to delete a few slots it's the same as before and if you want to delete all player saves, use the code below

Code: Select all

$ delete_slot(0, True)  #set the number to 0, then follow it with a True.
Last edited by Enchant00 on Tue May 29, 2018 12:53 pm, edited 1 time in total.

kivik
Miko-Class Veteran
Posts: 786
Joined: Fri Jun 24, 2016 5:58 pm
Contact:

Re: How do I use $ renpy.unlink_save

#10 Post by kivik »

Milkymalk wrote: Mon May 28, 2018 5:41 pm
kivik wrote: Mon May 28, 2018 4:14 pm Is this another one of those four wall breaking game that every body's trying to do which are actually anti-player?
Don't be so harsh. A lot of people who played DDLC were so impressed by it that they found their way here, it's only natural that many of them want to do something similar.

While I can't help with the problem, a word of advice: What DDLC did is fun once in a while, but it grows old quickly. That said, if what you are doing is actually an original idea, go for it. Just always think, "How would I feel if that happened to me as a player?"
I agree I could be softer with my comment, sorry if it comes across as harsh!

That said, this is probably the most destructive and anti-player idea I've seen yet, and I'm rather concerned about novelty over gameplay - one of the things that's easy to forget is why we make games and who we're making the games for, which should in most cases be for the players.
The idea of the game is actually involving bits of horror, puzzles, and is a story revolving around the sound design concepts. I don't know how it will be taken by users but I find it fun ^^
I'd strongly recommend you test your idea with players first. I understand if you poll them it'll defeat the concept since it has to be a surprise - but you should test it in a way that players won't lose a huge amount of progress - so you can hopefully get a vibe of whether it'll be well received in the final game or not.

Breaking the fourth wall is all well and good, but to actually destroy saves that players physically made - something that players are invested in enough to manually create saves for - is very anti-player and disrespects their time invested in YOUR game. Unless you have critical successes previously and people are anxious to player your game, the reality is probably - they'll play another game as soon as this happens.

If you'd asked if you can back up the saves beforehand, that's different. I recall there's been a professional game that deletes your save(s), but that came from active warning AND required player to actively ignore the warnings before it happened.

If you don't intend on backing up players' games first, please at least "trick" them into relying on an autosave, but create points that would subtly prompt players to make their own saves (critical choices that they may want to try alternative paths to), and delete the autosave instead of the manual saves.

User avatar
AHAKuo
Regular
Posts: 41
Joined: Tue Feb 06, 2018 11:10 am
Projects: SoUnd Is ToxIc
Organization: AHAKuo
Tumblr: ahakuo
Deviantart: ahakuo
Contact:

Re: How do I use $ renpy.unlink_save

#11 Post by AHAKuo »

kivik wrote: Tue May 29, 2018 8:41 am
Milkymalk wrote: Mon May 28, 2018 5:41 pm
kivik wrote: Mon May 28, 2018 4:14 pm Is this another one of those four wall breaking game that every body's trying to do which are actually anti-player?
Don't be so harsh. A lot of people who played DDLC were so impressed by it that they found their way here, it's only natural that many of them want to do something similar.

While I can't help with the problem, a word of advice: What DDLC did is fun once in a while, but it grows old quickly. That said, if what you are doing is actually an original idea, go for it. Just always think, "How would I feel if that happened to me as a player?"
I agree I could be softer with my comment, sorry if it comes across as harsh!

That said, this is probably the most destructive and anti-player idea I've seen yet, and I'm rather concerned about novelty over gameplay - one of the things that's easy to forget is why we make games and who we're making the games for, which should in most cases be for the players.
The idea of the game is actually involving bits of horror, puzzles, and is a story revolving around the sound design concepts. I don't know how it will be taken by users but I find it fun ^^
I'd strongly recommend you test your idea with players first. I understand if you poll them it'll defeat the concept since it has to be a surprise - but you should test it in a way that players won't lose a huge amount of progress - so you can hopefully get a vibe of whether it'll be well received in the final game or not.

Breaking the fourth wall is all well and good, but to actually destroy saves that players physically made - something that players are invested in enough to manually create saves for - is very anti-player and disrespects their time invested in YOUR game. Unless you have critical successes previously and people are anxious to player your game, the reality is probably - they'll play another game as soon as this happens.

If you'd asked if you can back up the saves beforehand, that's different. I recall there's been a professional game that deletes your save(s), but that came from active warning AND required player to actively ignore the warnings before it happened.

If you don't intend on backing up players' games first, please at least "trick" them into relying on an autosave, but create points that would subtly prompt players to make their own saves (critical choices that they may want to try alternative paths to), and delete the autosave instead of the manual saves.

You're right. I should test with more people.

And I didn't mean to have the player lose progress. Deleting the saves is what advances the story because everything that happens afterward doesn't require the saves, and surprisingly enough, I just realized I don't even need to delete the saves. I made it so that if a player loads a save from a previous point, they would find something new happening. (Further bettering the experience.)

But about testing the game with people, it will happen as soon as I finish it up.

I already released a demo here, if you're interested in seeing what it's about. https://soundistoxic.wordpress.com/

Thanks for the comment :D
Working on:

Image

kivik
Miko-Class Veteran
Posts: 786
Joined: Fri Jun 24, 2016 5:58 pm
Contact:

Re: How do I use $ renpy.unlink_save

#12 Post by kivik »

Glad to hear that you don't need to delete saves afterall!

The important thing is to put yourself in player's perspective (and their mindset) - anything that disempowers them should be treated with caution. There's a reason that despite Dark Souls being one of the cult favourite games in the gaming world, most of my friends won't get into it. But with that - it's a case of "it's not my type of game", they all just tried the game and gave up - they wouldn't have invested a lot of time already.

Save deleting on the other hand, that's potentially rewarding fans of your game with soul crashing blow. People save games for different reasons (branch in choices, liking a particular scene, a habitual save scrumper), whatever you do, let them be themselves and not punish them for it. It's one of the reasons why X-COM 2 got such a backlash when they forced players to play a certain way by adding turn limits - they disempowered certain types of players who love that game series.

Good luck with the game! A nice use of lighting & depth of field in your renders :)

User avatar
AHAKuo
Regular
Posts: 41
Joined: Tue Feb 06, 2018 11:10 am
Projects: SoUnd Is ToxIc
Organization: AHAKuo
Tumblr: ahakuo
Deviantart: ahakuo
Contact:

Re: How do I use $ renpy.unlink_save

#13 Post by AHAKuo »

kivik wrote: Sat Jun 02, 2018 4:43 am Glad to hear that you don't need to delete saves afterall!

The important thing is to put yourself in player's perspective (and their mindset) - anything that disempowers them should be treated with caution. There's a reason that despite Dark Souls being one of the cult favourite games in the gaming world, most of my friends won't get into it. But with that - it's a case of "it's not my type of game", they all just tried the game and gave up - they wouldn't have invested a lot of time already.

Save deleting on the other hand, that's potentially rewarding fans of your game with soul crashing blow. People save games for different reasons (branch in choices, liking a particular scene, a habitual save scrumper), whatever you do, let them be themselves and not punish them for it. It's one of the reasons why X-COM 2 got such a backlash when they forced players to play a certain way by adding turn limits - they disempowered certain types of players who love that game series.

Good luck with the game! A nice use of lighting & depth of field in your renders :)
Thanks! I'm glad you liked it :D And thanks for the hints ^^
Working on:

Image

Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], Ocelot