create new game in main menu that delete all save game and persistent data
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.
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.
create new game in main menu that delete all save game and persistent data
how can i create new game textbutton in main menu and delete all saves game and all the persistent data in the game ? and create new game
dont know what to do.
dont know what to do.
- 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: create new game in main menu that delete all save game and persistent data
how can i create new game textbutton in main menu and delete all saves game
Code: Select all
init python:
def fileDeleteAll():
for s in renpy.list_saved_games():
renpy.unlink_save(s[0])
def FileDeleteAll(confirm=True, message=_("Do you really wish to delete all your saved games?")):
action = Function(fileDeleteAll)
if confirm:
action = Confirm(message, action)
return action
screen your_screen():
textbutton "Delete All Saved Games":
action FileDeleteAll()
all the persistent data in the game ?
Code: Select all
screen your_screen():
textbutton "Clear Persistent":
action Function(persistent._clear, True)
combining the two, you could come up with this.create new game in main menu that delete all save game and persistent data
Code: Select all
init python:
def fileDeleteAll():
for s in renpy.list_saved_games():
renpy.unlink_save(s[0])
def newGame(*args, **kwargs):
persistent._clear(True)
fileDeleteAll()
renpy.run(Start(*args, **kwargs))
def NewGame(*args, **kwargs): return Function(newGame, *args, **kwargs)
screen your_screen():
textbutton "New Game":
action NewGame() # once clicked it should go to the label `start`, of your script
-
cheonbyeol
- Regular
- Posts: 37
- Joined: Thu Feb 04, 2021 9:04 am
- Contact:
Re: create new game in main menu that delete all save game and persistent data
Are you trying to do something like the otome game Nameless? There, when playing the second hidden route, the game "deletes" all your data, but gives it back once you clear that route. In case you want to do something like that, I'd be much more careful with actually deleting stuff, rather just hide it.
Programmer @ Celestea Productions

NaNo demo out!
My code:
GalleryPlus - extending gallery functionality

NaNo demo out!
My code:
GalleryPlus - extending gallery functionality
Re: create new game in main menu that delete all save game and persistent data
oh it works ! salamat pohell_oh_world wrote: ↑Mon Feb 22, 2021 5:51 amhow can i create new game textbutton in main menu and delete all saves gameCode: Select all
init python: def fileDeleteAll(): for s in renpy.list_saved_games(): renpy.unlink_save(s[0]) def FileDeleteAll(confirm=True, message=_("Do you really wish to delete all your saved games?")): action = Function(fileDeleteAll) if confirm: action = Confirm(message, action) return action screen your_screen(): textbutton "Delete All Saved Games": action FileDeleteAll()all the persistent data in the game ?Code: Select all
screen your_screen(): textbutton "Clear Persistent": action Function(persistent._clear, True)combining the two, you could come up with this.create new game in main menu that delete all save game and persistent dataCode: Select all
init python: def fileDeleteAll(): for s in renpy.list_saved_games(): renpy.unlink_save(s[0]) def newGame(*args, **kwargs): persistent._clear(True) fileDeleteAll() renpy.run(Start(*args, **kwargs)) def NewGame(*args, **kwargs): return Function(newGame, *args, **kwargs) screen your_screen(): textbutton "New Game": action NewGame() # once clicked it should go to the label `start`, of your script
on load game, the quick save up to the other page together with the persistent data are all deleted, it all works thanks to that.
but except in the automatic save's part is not deleted, do you know about that?
Re: create new game in main menu that delete all save game and persistent data
um its not like that,cheonbyeol wrote: ↑Mon Feb 22, 2021 9:15 amAre you trying to do something like the otome game Nameless? There, when playing the second hidden route, the game "deletes" all your data, but gives it back once you clear that route. In case you want to do something like that, I'd be much more careful with actually deleting stuff, rather just hide it.
- Imperf3kt
- Lemma-Class Veteran
- Posts: 3636
- Joined: Mon Dec 14, 2015 5:05 am
- Location: Your monitor
- Contact:
Re: create new game in main menu that delete all save game and persistent data
I assume you will inform the player before they do so, otherwise I can sense a lot of hatred and harassment may be directed at you from your players. People don't take well to save file deletions, especially unexpected ones.
Warning: May contain trace amounts of gratuitous plot.
pro·gram·mer (noun) An organism capable of converting caffeine into code.
Current project: GGD Mentor
Free Android GUI - Updated occasionally
Twitter
Imperf3kt Blackjack - a WIP blackjack game for Android made using Ren'Py
pro·gram·mer (noun) An organism capable of converting caffeine into code.
Current project: GGD Mentor
Free Android GUI - Updated occasionally
Imperf3kt Blackjack - a WIP blackjack game for Android made using Ren'Py
-
cheonbyeol
- Regular
- Posts: 37
- Joined: Thu Feb 04, 2021 9:04 am
- Contact:
Re: create new game in main menu that delete all save game and persistent data
I second what Imperf3kt says.
I suggest you warn them when they start the first game already, so they know when to make the saves so they can explore branches without restarting.
When you delete persistent data, also the data of which lines have been seen is lost, so they can't even "skip read text".
Plus, if they unlocked CGs and stuff...
Well, that's all unless the point is exactly to mess with the player...? But the game should probably disclaim that.
I suggest you warn them when they start the first game already, so they know when to make the saves so they can explore branches without restarting.
When you delete persistent data, also the data of which lines have been seen is lost, so they can't even "skip read text".
Plus, if they unlocked CGs and stuff...
Well, that's all unless the point is exactly to mess with the player...? But the game should probably disclaim that.
Programmer @ Celestea Productions

NaNo demo out!
My code:
GalleryPlus - extending gallery functionality

NaNo demo out!
My code:
GalleryPlus - extending gallery functionality
Re: create new game in main menu that delete all save game and persistent data
Your right . Im will put confirmation .
thanks for the advice- 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: create new game in main menu that delete all save game and persistent data
I tried the code seems to work for all saved games. The thing is renpy automatically creates the autosave slots once you try to exit the game. You can confirm that by checking the saves folder after trying to press the x button on the window, also autosave occurs at a certain point in time, maybe every 10 mins, I forgot the exact time, but I know its documented somewhere (try searching for renpy config variables). So maybe that's why you thought that it does not do its job after you closed the game.
If you want to disable autosave you can try putting in your code `define config.has_autosave = False`.
Good luck as thesis nyo ^^. Nasa plano ko rin na gamitin Ren'Py samin e haha.
Re: create new game in main menu that delete all save game and persistent data
i try to add confirmation message in fileDeleteAll(): but its not working. theres no Confirmation message .hell_oh_world wrote: ↑Wed Feb 24, 2021 12:37 amI tried the code seems to work for all saved games. The thing is renpy automatically creates the autosave slots once you try to exit the game. You can confirm that by checking the saves folder after trying to press the x button on the window, also autosave occurs at a certain point in time, maybe every 10 mins, I forgot the exact time, but I know its documented somewhere (try searching for renpy config variables). So maybe that's why you thought that it does not do its job after you closed the game.
If you want to disable autosave you can try putting in your code `define config.has_autosave = False`.
Good luck as thesis nyo ^^. Nasa plano ko rin na gamitin Ren'Py samin e haha.
but when i create new game all the data is deleted but still theres no confirmation message. sorry
im not trying to disable the autosave cuz in this feature its a big help for the user, haha
and im making an educational android game in computer system servicing.
student karin pala, galing mo ha my CLASS ka . lodi
im not good in programming search search lang ako. hahaha but thanks for your help
Re: create new game in main menu that delete all save game and persistent data
oh i get it now.. hehe it all works an have a confirmation message . 
thanks to all of you.
thanks to all of you.
Who is online
Users browsing this forum: Bing [Bot], Google [Bot]