Page 1 of 1

[SOLVED]Set Style Preference is persistent through saves

Posted: Fri Dec 24, 2021 4:25 am
by DFlimbingo
Hello, I have two different dialogue styles that I control using renpy.set_style_preference. This is good for most situations, however an issue arises when using the save and load system. Essentially, If I save in a part of the game that is using style preference 2 and load into a different part of the game that is supposed to use style preference 1, it will instead continue using style preference 2 for the duration of the game, at least until another part of the game manually switches it back. This also happens vice versa. I know this has something to do with persistent data, but I have no idea if the solution would be to either to use something other than renpy.set_style_preference or to somehow remove the persistent data part about it, if that is the issue.

The code for this is simply:

Code: Select all

label changer:
    if textstyle == 1:
        $ renpy.set_style_preference("text", "say1")
    elif textstyle == 2:
        $ renpy.set_style_preference("text", "say2")
    return
and during the game, I just change textstyle to be 1 or 2 depending on what I need. What should I do?

Re: Set Style Preference is persistent through saves

Posted: Fri Dec 24, 2021 4:51 am
by Ocelot
The simplest solution would be to call label changer in after_load.
https://www.renpy.org/doc/html/label.ht ... ial-labels

Re: Set Style Preference is persistent through saves

Posted: Fri Dec 24, 2021 4:45 pm
by DFlimbingo
Ocelot wrote:
Fri Dec 24, 2021 4:51 am
The simplest solution would be to call label changer in after_load.
https://www.renpy.org/doc/html/label.ht ... ial-labels
Thank you! Everything is now working perfectly!