- Sep 6, 2021
- 740
- 1,677
I'm trying to add a switch that players can toggle on the Preferences screen, which will turn NTR on and off.
I found some examples on the Ren'py Patreon page where they show how to first define a persistent variable and then add a toggle in the preferences screen and it seems to work, but the way it is written, the preference screen only shows one textbutton and the status of the variable is shown by if the textbutton is highlighted or not. I'd much rather prefer to have two texbuttons ... one saying "NTR On" and the other saying, of course, "NTR Off", similar to how the option for Fullscreen and Window are displayed.
Here is the code as I am testing it right now....
First, defining the persistent variable ntr_switch ...
Then adding the code in your screens file ...
So how could I change this to have two texbuttons, as I described above?
Another issue I am thinking about is what happens if I change the variable "ntr_switch" in the script somewhere? Does a script change of the variable cause the textbutton on the preferences screen to change? Because, right now, I am planing on asking the player during the opening introduction whether they want to turn NTR on or off, but if that is going to cause problems with the way it is presented on the Preferences Screen, then I might re-think that and leave the only option on the Preferences Screen.
I found some examples on the Ren'py Patreon page where they show how to first define a persistent variable and then add a toggle in the preferences screen and it seems to work, but the way it is written, the preference screen only shows one textbutton and the status of the variable is shown by if the textbutton is highlighted or not. I'd much rather prefer to have two texbuttons ... one saying "NTR On" and the other saying, of course, "NTR Off", similar to how the option for Fullscreen and Window are displayed.
Here is the code as I am testing it right now....
First, defining the persistent variable ntr_switch ...
Python:
default persistent.ntr_switch = False
Python:
vbox:
style_prefix "check"
label _("NTR")
textbutton _("NTR On") action ToggleField(persistent, "ntr_switch")
So how could I change this to have two texbuttons, as I described above?
Another issue I am thinking about is what happens if I change the variable "ntr_switch" in the script somewhere? Does a script change of the variable cause the textbutton on the preferences screen to change? Because, right now, I am planing on asking the player during the opening introduction whether they want to turn NTR on or off, but if that is going to cause problems with the way it is presented on the Preferences Screen, then I might re-think that and leave the only option on the Preferences Screen.