button delete persistent in menu configuration?
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.
- Lyedka
- Newbie
- Posts: 12
- Joined: Thu Jan 08, 2015 1:01 am
- Completed: Blackjack Deluxe
- Projects: Ai Aisuru, Puri-Puri, BlGame(still unnamed), D.A.
- Organization: Puzzle Deluxe
- Deviantart: Liedka
- Skype: Lyedka Panni
- Location: this way!
- Contact:
button delete persistent in menu configuration?
Hello!! sorry! SORRY for my bad english D:
wanted to know if you can create a button to delete persistent data the game in the screen configuration. (delete progress and saved)
Thank you!
wanted to know if you can create a button to delete persistent data the game in the screen configuration. (delete progress and saved)
Thank you!
- shivanshs9
- Regular
- Posts: 54
- Joined: Sun Jul 20, 2014 1:59 pm
- Projects: The Destiny(http://thedestiny-cxz.blogspot.com)
- Organization: Cyber-X-Zone
- Location: India
- Contact:
Re: button delete persistent in menu configuration?
From http://lemmasoft.renai.us/forums/viewto ... =8&t=23068:
As for deleting saved games...
For explanation, check out: http://renpy.org/doc/html/save_load_rol ... -variables
So, write for all your persistent variables in this way:PyTom wrote:This is unlikely to work from within the game, as the game will re-write the file as it quits.
Your best bet would be to just set the fields that you've set back to None.
Code: Select all
persistent.variable_name = NoneCode: Select all
for slot in renpy.list_saved_games(fast=True):
renpy.unlink_save(slot)
# Code tested!
Last edited by shivanshs9 on Wed Jan 21, 2015 9:15 am, edited 2 times in total.
"Destiny is a no matter of chance
It is a matter of choice
It is not a thing to be waited for
It is a thing to be achieved..."
-William Jennings Bryan
It is a matter of choice
It is not a thing to be waited for
It is a thing to be achieved..."
-William Jennings Bryan
If you can dream and not make dreams your master;
If you can think and not make thoughts your aim,
If you can meet with Triumph and Disaster;
And treat those two impostors just the same,
Only then can you ever win against yourself...
If you can think and not make thoughts your aim,
If you can meet with Triumph and Disaster;
And treat those two impostors just the same,
Only then can you ever win against yourself...
-
nintendotoad
- Regular
- Posts: 42
- Joined: Sat Mar 31, 2012 2:56 pm
- Location: projectexist.net
- Contact:
Re: button delete persistent in menu configuration?
Code: Select all
$ persistent._clear(progress=True)If you'd prefer to leave the properties but still set them to None, you can do something like this:
Code: Select all
def destroy_persistent():
for attr in dir(persistent):
if not callable(attr) and not attr.startswith("_"):
setattr(persistent, attr, None)
returnCode: Select all
textbutton _("Persistent Reset") action Function(destroy_persistent)- Lyedka
- Newbie
- Posts: 12
- Joined: Thu Jan 08, 2015 1:01 am
- Completed: Blackjack Deluxe
- Projects: Ai Aisuru, Puri-Puri, BlGame(still unnamed), D.A.
- Organization: Puzzle Deluxe
- Deviantart: Liedka
- Skype: Lyedka Panni
- Location: this way!
- Contact:
Re: button delete persistent in menu configuration?
not working the Code to remove the saved, or I do not know how to make it work D:shivanshs9 wrote:From http://lemmasoft.renai.us/forums/viewto ... =8&t=23068:So, write for all your persistent variables in this way:PyTom wrote:This is unlikely to work from within the game, as the game will re-write the file as it quits.
Your best bet would be to just set the fields that you've set back to None.As for deleting saved games...Code: Select all
persistent.variable_name = NoneFor explanation, check out: http://renpy.org/doc/html/save_load_rol ... -variablesCode: Select all
for slot in renpy.list_saved_games(fast=True): renpy.unlink_save(slot) # Code not tested yet
when use "textbutton _("Persistent Reset") action Function(destroy_persistent)" this message appears:nintendotoad wrote:That actually (I believe) completely resets the persistent data. 'progress' is False by default; setting it to true resets Ren'Py's progress data. This is destructive, since the dictionary keys are completely destroyed.Code: Select all
$ persistent._clear(progress=True)
If you'd prefer to leave the properties but still set them to None, you can do something like this:
It should be somewhat simple to make a button use one of those functions.Code: Select all
def destroy_persistent(): for attr in dir(persistent): if not callable(attr) and not attr.startswith("_"): setattr(persistent, attr, None) return
Code: Select all
textbutton _("Persistent Reset") action Function(destroy_persistent)
I'm doing wrong? as I do?I'm sorry, but an uncaught exception occurred.
While running game code:
File "renpy/common/_layout/screen_main_menu.rpym", line 29, in script
File "game/screens.rpy", line 29, in python
NameError: name 'Function' is not defined
-- Full Traceback ------------------------------------------------------------
(o^u^)o Thank you! o(^u^o)
Re: button delete persistent in menu configuration?
You're using old version of Ren'Py, before Function action was introduced (you need to updated Ren'Py).
On a sidenote, "Function" is bloody useless here:
Is what you need assuming that function does whatever it is supposed to.
On a sidenote, "Function" is bloody useless here:
Code: Select all
textbutton _("Persistent Reset") action destroy_persistent- Lyedka
- Newbie
- Posts: 12
- Joined: Thu Jan 08, 2015 1:01 am
- Completed: Blackjack Deluxe
- Projects: Ai Aisuru, Puri-Puri, BlGame(still unnamed), D.A.
- Organization: Puzzle Deluxe
- Deviantart: Liedka
- Skype: Lyedka Panni
- Location: this way!
- Contact:
Re: button delete persistent in menu configuration?
Thanks, I did no know that!
But....
Ren'py doesn't want me!! ): D:
happened what I feared...
https://docs.google.com/document/d/1OHL ... Ee82xQ/pub
happened what I feared...
this is my code:I'm sorry, but an uncaught exception occurred.
While running game code:
File "game/screens.rpy", line 3, in execute
screen preferences:
File "game/screens.rpy", line 51, in execute
File "game/screens.rpy", line 51, in keywords
NameError: name 'destroy_persistent' is not defined
-- Full Traceback ---------------------------------------------
https://docs.google.com/document/d/1OHL ... Ee82xQ/pub
- xavimat
- Eileen-Class Veteran
- Posts: 1458
- Joined: Sat Feb 25, 2012 8:45 pm
- Completed: Yeshua, Jesus Life, Cops&Robbers
- Projects: Fear&Love, unknown
- Organization: Pilgrim Creations
- Github: xavi-mat
- itch: pilgrimcreations
- Location: Spain
- Contact:
Re: button delete persistent in menu configuration?
Well, you haven't defined 'destroy_persistent' in that code...
Comunidad Ren'Py en español: ¡Únete a nuestro Discord!
Rhaier Kingdom A Ren'Py Multiplayer Adventure Visual Novel.
Cops&Robbers A two-player experiment | Fear&Love Why can't we say I love you?
Honest Critique (Avatar made with Chibi Maker by ~gen8)
Rhaier Kingdom A Ren'Py Multiplayer Adventure Visual Novel.
Cops&Robbers A two-player experiment | Fear&Love Why can't we say I love you?
Honest Critique (Avatar made with Chibi Maker by ~gen8)
- Lyedka
- Newbie
- Posts: 12
- Joined: Thu Jan 08, 2015 1:01 am
- Completed: Blackjack Deluxe
- Projects: Ai Aisuru, Puri-Puri, BlGame(still unnamed), D.A.
- Organization: Puzzle Deluxe
- Deviantart: Liedka
- Skype: Lyedka Panni
- Location: this way!
- Contact:
Re: button delete persistent in menu configuration?
Little big mistake,
as could be defined? I'm bad at this 
- xavimat
- Eileen-Class Veteran
- Posts: 1458
- Joined: Sat Feb 25, 2012 8:45 pm
- Completed: Yeshua, Jesus Life, Cops&Robbers
- Projects: Fear&Love, unknown
- Organization: Pilgrim Creations
- Github: xavi-mat
- itch: pilgrimcreations
- Location: Spain
- Contact:
Re: button delete persistent in menu configuration?
Well, nintendotoad gave you the definition:
I don't know if this function works, but please read more carefully the answers people give you
Put the definition outside the screen.nintendotoad wrote:Code: Select all
init python: def destroy_persistent(): for attr in dir(persistent): if not callable(attr) and not attr.startswith("_"): setattr(persistent, attr, None) return
I don't know if this function works, but please read more carefully the answers people give you
Comunidad Ren'Py en español: ¡Únete a nuestro Discord!
Rhaier Kingdom A Ren'Py Multiplayer Adventure Visual Novel.
Cops&Robbers A two-player experiment | Fear&Love Why can't we say I love you?
Honest Critique (Avatar made with Chibi Maker by ~gen8)
Rhaier Kingdom A Ren'Py Multiplayer Adventure Visual Novel.
Cops&Robbers A two-player experiment | Fear&Love Why can't we say I love you?
Honest Critique (Avatar made with Chibi Maker by ~gen8)
Who is online
Users browsing this forum: Google [Bot], Ocelot
