How to add a new preference config to settings screen
Posted: Sun Nov 10, 2019 12:14 pm
Hello, I have some DLC for my game that I want to release but I need a toggle / radio option in the Settings in order to enable what this DLC adds. In this case, it allows the user to enable it to see the adult mode sprites in the game, and disable it if they don't.
After some research it seems that all I need to do is add the button into the preferences screen in screens.rpy so I did this:
And since this mode changes the sprites, in my definitions.rpy file, I added some conditionals to define the sprites:
I also added a default for the prefence in options.rpy:
And even added this into my definitions.rpy file just in case:
However when I run the game, I just keep getting a traceback.txt file pop up saying:
What am I doing wrong? I could use some advice here as I have not altered the default menus before.
After some research it seems that all I need to do is add the button into the preferences screen in screens.rpy so I did this:
Code: Select all
vbox:
style_prefix "radio"
label _("Oppai Mode")
textbutton _("Enabled") action Preference("oppai_mode", True)
textbutton _("Disabled") action Preference("oppai_mode", False)Code: Select all
if oppai_mode is True:
## Adult sprites defined here
else:
## Regular sprites hereCode: Select all
default preferences.oppai_mode = False
Code: Select all
define oppai_mode = False
Code: Select all
Exception: Preference(u'oppai_mode', True) is unknown.