[SOLVED] reset preferences button

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
Moshibit
Regular
Posts: 50
Joined: Wed Oct 16, 2019 1:58 pm
Location: Mexico
Contact:

[SOLVED] reset preferences button

#1 Post by Moshibit »

Hi. How can I make a button to reset the default preferences? Thanks for the help.
Last edited by Moshibit on Fri Mar 06, 2020 4:56 pm, edited 1 time in total.

User avatar
Alex
Lemma-Class Veteran
Posts: 3094
Joined: Fri Dec 11, 2009 5:25 pm
Contact:

Re: reset preferences button

#2 Post by Alex »

You can use a list of actions that set different preferences values, like

Code: Select all

textbutton "Click!" action [Preference("display", "window") , Preference("text speed", 0), Preference("sound volume", 0.5) ]
Or make a function, that sets different preferences values and use Function action to run this function.

Code: Select all

init python:
    def my_func():
        _preferences.display = "window"
        _preferences.text_cps = 0
        _preferences.volumes['sfx'] = 0.5

Code: Select all

textbutton "Click!" action Function(my_func)
https://www.renpy.org/doc/html/screen_a ... Preference
Last edited by Alex on Fri Mar 06, 2020 1:23 pm, edited 1 time in total.

rayminator
Miko-Class Veteran
Posts: 793
Joined: Fri Feb 09, 2018 12:05 am
Location: Canada
Contact:

Re: reset preferences button

#3 Post by rayminator »

hope this help you out

got this from here say thanks to IrinaLazareva for the code

viewtopic.php?t=51336#p493243

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

Code: Select all

textbutton _("Clear") action Function(restartPref)
more info here

https://www.renpy.org/doc/html/screen_a ... references

User avatar
Moshibit
Regular
Posts: 50
Joined: Wed Oct 16, 2019 1:58 pm
Location: Mexico
Contact:

Re: reset preferences button

#4 Post by Moshibit »

Thanks

Post Reply

Who is online

Users browsing this forum: Exabot [Bot], fufuffiero, Google [Bot], Sugar_and_rice