So, this is the default say() screen in screens.rpy file. Say screen is the screen that contains a textbox, a name, a dialogue... All that fancy stuff:
Code: Select all
screen say(who, what):
style_prefix "say"
window:
id "window"
if who is not None:
window:
style "namebox"
text who id "who"
text what id "what"
## If there's a side image, display it above the text. Do not display on the
## phone variant - there's no room.
if not renpy.variant("small"):
add SideImage() xalign 0.0 yalign 1.0
Now, long story short, it basically takes the name of the character talking ("who") and the dialogue ("what") and displays it in some windows.
Focus on the
text what id "what" , that is the line that displays the dialogue. First, let's branch it out onto multiple lines by adding a colon.
Now we need something that will determine the color used. For this, we will use a simple variable.
Code: Select all
text what:
id "what"
if colorOfText == "white":
color "#FFFFFF"
else:
color "#FF0000"
This simple code will add the "color" tag to our text, changing the color. But remember, variables always need to be defined before they are used. And because we need it defined
before the screens are defined, we need to put it into
init block.
Just outside of the screen, behind
if not renpy.variant..., like this:
Code: Select all
if not renpy.variant("small"):
add SideImage() xalign 0.0 yalign 1.0
init -2 python:
colorOfText = "white"
This will set the variable to "white" by default. Currently, it will show white text, and if we were to change that variable to anything else with
$ colorOfText = "something", the text will turn red (#FF0000). Of course, you can customize this by changing the if/else branch.