How to Reset Preference Setting?

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
tofuuu
Regular
Posts: 51
Joined: Tue Apr 24, 2018 7:15 pm
Contact:

How to Reset Preference Setting?

#1 Post by tofuuu »

Is it possible to reset the preference setting back to default when game opened? I tried this code and put it on screen.rpy but it doesn't change anything.

Code: Select all

init python:    
    def restartPref():
        _preferences.desktop_rollback_side = "disable"
        _preferences.skip_after_choices = False
        _preferences.skip_unseen = True
        _preferences.text_cps = 14
        
        renpy.restart_interaction()

$ ress = restartPref()
Can you guys help me?

User avatar
IrinaLazareva
Veteran
Posts: 399
Joined: Wed Jun 08, 2016 1:49 pm
Projects: Legacy
Organization: SunShI
Location: St.Petersburg, Russia
Contact:

Re: How to Reset Preference Setting?

#2 Post by IrinaLazareva »

Code: Select all

init python:    
    def restartPref():
        _preferences.desktop_rollback_side = "disable"
        _preferences.skip_after_choices = False
        _preferences.skip_unseen = True
        _preferences.text_cps = 14
You can add button in screen navigation

Code: Select all

        textbutton _("Clear") action Function(restartPref)
https://www.renpy.org/doc/html/screen_a ... l#Function

tofuuu
Regular
Posts: 51
Joined: Tue Apr 24, 2018 7:15 pm
Contact:

Re: How to Reset Preference Setting?

#3 Post by tofuuu »

Hi! I'm sorry for late reply >< can i reset it without a button? So it will reset by itself when we run the game
IrinaLazareva wrote: Sun Aug 12, 2018 3:24 am

Code: Select all

init python:    
    def restartPref():
        _preferences.desktop_rollback_side = "disable"
        _preferences.skip_after_choices = False
        _preferences.skip_unseen = True
        _preferences.text_cps = 14
You can add button in screen navigation

Code: Select all

        textbutton _("Clear") action Function(restartPref)
https://www.renpy.org/doc/html/screen_a ... l#Function

User avatar
IrinaLazareva
Veteran
Posts: 399
Joined: Wed Jun 08, 2016 1:49 pm
Projects: Legacy
Organization: SunShI
Location: St.Petersburg, Russia
Contact:

Re: How to Reset Preference Setting?

#4 Post by IrinaLazareva »

tofuuu wrote: Wed Aug 15, 2018 12:29 am Hi! I'm sorry for late reply >< can i reset it without a button? So it will reset by itself when we run the game
Yes:

Code: Select all

    $ restartPref
For example:

Code: Select all

label whatever():
    'Bla Bla'
    $ restartPref
    'Ups'

tofuuu
Regular
Posts: 51
Joined: Tue Apr 24, 2018 7:15 pm
Contact:

Re: How to Reset Preference Setting?

#5 Post by tofuuu »

I just realized that it will be bothersome for player if the preference got restart when the game started. So i'll use the Restart button. Thank you for your answer!

Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot]