[SOLVED]Set Style Preference is persistent through saves

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
DFlimbingo
Newbie
Posts: 24
Joined: Wed Mar 24, 2021 2:37 am
Contact:

[SOLVED]Set Style Preference is persistent through saves

#1 Post by DFlimbingo » Fri Dec 24, 2021 4:25 am

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?
Last edited by DFlimbingo on Fri Dec 24, 2021 4:46 pm, edited 1 time in total.

User avatar
Ocelot
Eileen-Class Veteran
Posts: 1883
Joined: Tue Aug 23, 2016 10:35 am
Github: MiiNiPaa
Discord: MiiNiPaa#4384
Contact:

Re: Set Style Preference is persistent through saves

#2 Post by Ocelot » 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
< < insert Rick Cook quote here > >

DFlimbingo
Newbie
Posts: 24
Joined: Wed Mar 24, 2021 2:37 am
Contact:

Re: Set Style Preference is persistent through saves

#3 Post by DFlimbingo » Fri Dec 24, 2021 4:45 pm

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!

Post Reply

Who is online

Users browsing this forum: Google [Bot]