Is it possible to change a game setting mid-game?

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
User avatar
namastaii
Eileen-Class Veteran
Posts: 1350
Joined: Mon Feb 02, 2015 8:35 pm
Projects: Template Maker for Ren'Py, What Life
Github: lunalucid
Skype: Discord: lunalucid#1991
Soundcloud: LunaLucidMusic
itch: lunalucid
Location: USA
Contact:

Is it possible to change a game setting mid-game?

#1 Post by namastaii »

Is it possible to change something like dialogue text color etc. during the game and seeing the changes reflect real time? I tried changing the color of the text font in the script and it didn't reflect any changes. An example:

Code: Select all

e "Hello"

e "I'm going to change the text color now"

$ gui.interface_text_color = "#000000"

Sorry if this is a ridiculous question, I'm coming back years later and the engine has also changed quite a bit.

Also, ~default~ doesn't seem to be working for me like it used to?

User avatar
Imperf3kt
Lemma-Class Veteran
Posts: 3792
Joined: Mon Dec 14, 2015 5:05 am
itch: Imperf3kt
Location: Your monitor
Contact:

Re: Is it possible to change a game setting mid-game?

#2 Post by Imperf3kt »

Create a style and use that, I can't give an example right now as I need to head out, but some searching the documentation for styles may help.
https://www.renpy.org/doc/html/style.html
Warning: May contain trace amounts of gratuitous plot.
pro·gram·mer (noun) An organism capable of converting caffeine into code.

Current project: GGD Mentor

Twitter

User avatar
namastaii
Eileen-Class Veteran
Posts: 1350
Joined: Mon Feb 02, 2015 8:35 pm
Projects: Template Maker for Ren'Py, What Life
Github: lunalucid
Skype: Discord: lunalucid#1991
Soundcloud: LunaLucidMusic
itch: lunalucid
Location: USA
Contact:

Re: Is it possible to change a game setting mid-game?

#3 Post by namastaii »

I completely forgot about styles. I will look into that soon thanks

User avatar
namastaii
Eileen-Class Veteran
Posts: 1350
Joined: Mon Feb 02, 2015 8:35 pm
Projects: Template Maker for Ren'Py, What Life
Github: lunalucid
Skype: Discord: lunalucid#1991
Soundcloud: LunaLucidMusic
itch: lunalucid
Location: USA
Contact:

Re: Is it possible to change a game setting mid-game?

#4 Post by namastaii »

I want to permanently change the text color by choices in the game. Not sure if we can change (hard coded?) variables.

I'm wondering if I'll need to redefine everything on the side and change it that way? If that even makes sense. Using my own screens and variables unless someone more knowledgeable can give me an idea haha

User avatar
Imperf3kt
Lemma-Class Veteran
Posts: 3792
Joined: Mon Dec 14, 2015 5:05 am
itch: Imperf3kt
Location: Your monitor
Contact:

Re: Is it possible to change a game setting mid-game?

#5 Post by Imperf3kt »

I'm not at home for the next two days, so I can't give an example, but what you want to do is edit the say screen and add a variable that controls which style it uses.

Others might be able to help better than I can, I haven't fiddled with multiple styles yet, do am not overly familiar with the subject.
Warning: May contain trace amounts of gratuitous plot.
pro·gram·mer (noun) An organism capable of converting caffeine into code.

Current project: GGD Mentor

Twitter

User avatar
Remix
Eileen-Class Veteran
Posts: 1628
Joined: Tue May 30, 2017 6:10 am
Completed: None... yet (as I'm still looking for an artist)
Projects: An un-named anime based trainer game
Contact:

Re: Is it possible to change a game setting mid-game?

#6 Post by Remix »

I'd advise against trying to redefine style parts (as you'd likely need to call renpy.rebuild_styles() which is quite a heavy function and will lag for a moment)

The alternative (and likely better) way is to set what_prefix and suffix attributes for your characters (you can even make them all different) using an interpolated variable and then alter that value as the game progresses...

Code: Select all

default say_color = "#F00"

define e = Character("Eileen", what_prefix="{color=[say_color]}", what_suffix="{/color}") 

label start:

    e "Test Red" 

    $ say_color = "0F0"

    e "Test Green"
Frameworks & Scriptlets:

User avatar
namastaii
Eileen-Class Veteran
Posts: 1350
Joined: Mon Feb 02, 2015 8:35 pm
Projects: Template Maker for Ren'Py, What Life
Github: lunalucid
Skype: Discord: lunalucid#1991
Soundcloud: LunaLucidMusic
itch: lunalucid
Location: USA
Contact:

Re: Is it possible to change a game setting mid-game?

#7 Post by namastaii »

What I'm doing doesn't rely on characters or anything like that, it's a theme building/template type program I mentioned a while back I wanted to work on and gui.rebuild() works perfectly I think.

Post Reply

Who is online

Users browsing this forum: Google [Bot]