Ren'Py [Solved] persistent variables in functions

GNVE

Active Member
Jul 20, 2018
703
1,158
So I had this idea that players should be able to choose what they do and do not want to see in game. I put that in a menu and used persistent variables to set the likes and dislikes. So far so good:
1631292765952.png

Now I do want to use a few quick selects where you can change the feel of the game quickly (basically the first question in the screenshot). I could all put that into screen language and have massive banks of togglevariable/setvariable actions for those quickselects. For sanity and readability I thought it might be better to put those quickselect changes into functions. However it seems to completely ignore the logic of the function and just load the last persistent.var setting.
I tried googling but it didn't get me anywhere so what am I missing?

This is the creation of the persistent variables (just a couple for clarity):
Python:
#Other
default persistent.menanalrimming = True # If True men may lick the anus
default persistent.menanalfingering = True # If True men may use their fingers to stimulate the anus
default persistent.menanalfucking = True # If True men may use their genitals to stimulate the anus
default persistent.menanalrecieve = 'off' # Level of anal stimulation allowed for men
and the accompanying code for the function (again just a sample for clarity):
Python:
    def otherswitch(setting,perma='',switch=''):

        if setting == 'off':
            persistent.menanalrimming = False
            persistent.menanalfingering = False
            persistent.menanalfucking = False
            persistent.menanalrecieve = 'off'
        elif setting == 'porn':
            persistent.menanalrimming = True
            persistent.menanalfingering = True
            persistent.menanalfucking = True
            persistent.menanalrecieve = 'off'
Thanks for any help in advance!
 
Last edited:

GNVE

Active Member
Jul 20, 2018
703
1,158
I forgot to mention I did try several permutations like global persistent.var (It did not like that)
 

GNVE

Active Member
Jul 20, 2018
703
1,158
Damn Screen language! I called the function in regular python fashion rather then Function(otherswitch.'off') Never would have guessed the issue was there rather than in the function itself...
Thanks for the guys at the LemmaSoft forum for help. I did not figure this out on my own...
 
  • Like
Reactions: LightmanP