button to reset game

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
Kornyart
Newbie
Posts: 18
Joined: Mon Jan 25, 2021 1:18 pm
Projects: Mindworks: the great division
itch: Kornyart
Contact:

button to reset game

#1 Post by Kornyart » Tue May 10, 2022 4:54 am

Hey!
is there a way to create a button inside the settings of a game that allows the player to reset the game? (aka to delete persistent data) :?: :?: :?:

User avatar
m_from_space
Veteran
Posts: 302
Joined: Sun Feb 21, 2021 3:36 am
Contact:

Re: button to reset game

#2 Post by m_from_space » Tue May 10, 2022 6:27 am

You should be more precise about what you want. Of course you can create a button, that can delete persistent data. Or just any data. So what do you mean by "reset the game". A game is reset to default values whenever you start a new game. Every game uses its own set of data, but persistent data is shared across all games. So what is it you actually need?

Persisent data details: https://www.renpy.org/doc/html/persistent.html

User avatar
Kornyart
Newbie
Posts: 18
Joined: Mon Jan 25, 2021 1:18 pm
Projects: Mindworks: the great division
itch: Kornyart
Contact:

Re: button to reset game

#3 Post by Kornyart » Mon Aug 08, 2022 2:56 am

m_from_space wrote:
Tue May 10, 2022 6:27 am
You should be more precise about what you want. Of course you can create a button, that can delete persistent data. Or just any data. So what do you mean by "reset the game". A game is reset to default values whenever you start a new game. Every game uses its own set of data, but persistent data is shared across all games. So what is it you actually need?

Persisent data details: https://www.renpy.org/doc/html/persistent.html
I just saw ur reply
you know how in some games u have a button in the option that allows u to reset the game to be able to play it all over again? it resets it to how it was when it were first downloaded
Its like the "delete persistent" option in the launcher but for players

User avatar
enaielei
Regular
Posts: 114
Joined: Fri Sep 17, 2021 2:09 am
Tumblr: enaielei
Deviantart: enaielei
Github: enaielei
Skype: enaielei
Soundcloud: enaielei
itch: enaielei
Discord: enaielei#7487
Contact:

Re: button to reset game

#4 Post by enaielei » Mon Aug 08, 2022 3:19 am

Use the persistent._clear to reset the Persistent data.

Code: Select all

textbutton "Reset" action Function(persistent._clear, True)

User avatar
Imperf3kt
Lemma-Class Veteran
Posts: 3636
Joined: Mon Dec 14, 2015 5:05 am
Location: Your monitor
Contact:

Re: button to reset game

#5 Post by Imperf3kt » Mon Aug 08, 2022 7:24 am

There is also the clear achievements action.
achievement.clear_all()
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

Post Reply

Who is online

Users browsing this forum: Bing [Bot], Google [Bot]