Tutorial Ren'Py Can't change characters color

P_S_Y_C_H_O

therappist
Game Developer
Sep 3, 2018
756
3,090
For some weird reason I can't change the what_color and who_color defining characters.
It was ok recently. But now all what_color is white and who_color is blue no matter what.

define unknown = Character("???", who_color="#FFFFFF")
define m = Character("[m]", who_color="#FFFFFF", what_color="#0099ff")
define n = Character("[n]", who_color="#0099ff")
define g = Character("[g]", who_color="#a4fd00")
define a = Character("[a]", who_color="#fe8aff")

define r = Character("[r]", who_color="#a44700")

I'm pretty sure this code is ok because it was working. What on earth could act as 'override' for this define part of code?
 

P_S_Y_C_H_O

therappist
Game Developer
Sep 3, 2018
756
3,090
Your character definitions look fine, what did you change/add that resulted in it no longer working?
I'm completely lost because I didn't override this statement (intentionally at least).
All I did to it was reposition
define gui.name_xpos = 0.0
define gui.name_ypos = 0.8
define gui.dialogue_ypos = 0.7


My MC who_color was blue and what_color was white. When I put just check sentence for all other characters they were with different color.
Then I wrote a dialogue that occasionally involved other character and realized it was also blue. Wrote dialogue for all characters and all of them are blue now.
Changed MC who_color to white but it remains blue. Tried to change what_color and it remains white.
Maybe there is something that makes who_color and what_color default no matter what you define with characters?
 
Oct 30, 2018
395
1,143
Maybe there is something that makes who_color and what_color default no matter what you define with characters?
There's gui.text_color, which sets a default text color, but that's supposed to be overridden by your Characters who/what_color.
Out of curiosity, what have you set your gui.text_color to? And if possible could you change it to a different color then tell me the results?

Edit: gui.text_color is just for body text, gui.accent_color is for character names, so check that too
 
  • Like
Reactions: P_S_Y_C_H_O

P_S_Y_C_H_O

therappist
Game Developer
Sep 3, 2018
756
3,090
Edit: gui.text_color is just for body text, gui.accent_color is for character names, so check that too
Yes those two color statements override my characters definitions. Changing them changes color of who/what_color
I tried commenting it but it causes errors. What should I do now?
And the most interesting part - there was no gui.rpy file before (almost sure), that's why who/what_color was working ok.
 
Oct 30, 2018
395
1,143
Set both your gui.text_color and gui.accent_color to "#ffffff".
Also make sure you aren't defining anything gui related in your definintions.rpy.
 
  • Like
Reactions: P_S_Y_C_H_O

P_S_Y_C_H_O

therappist
Game Developer
Sep 3, 2018
756
3,090
Set both your gui.text_color and gui.accent_color to "#ffffff".
Also make sure you aren't defining anything gui related in your definintions.rpy.
Unfortunately everything is overriden by white now. I don't have definitions. rpy
Maybe there is something to do with these in screens.rpy?
style window is default
style say_label is default
style say_dialogue is default
style say_thought is say_dialogue

style namebox is default
style namebox_label is say_label
 

anne O'nymous

I'm not grumpy, I'm just coded that way.
Modder
Respected User
Donor
Jun 10, 2017
10,263
15,073
define m = Character("[m]", who_color="#FFFFFF", what_color="#0099ff")
Is this really 100% exactly what you wrote in your game ?

I ask, because here, you're telling Ren'py to use the value of the 'm' variable as name for the character... stored in the 'm' variable. It don't lead to a crash if the developer mode is disable, but it also obviously don't works.
This said, I just tested, and it don't prevent (who/what)_color to works. So it's a side bug, not the one you are looking for.
 
  • Like
Reactions: P_S_Y_C_H_O

P_S_Y_C_H_O

therappist
Game Developer
Sep 3, 2018
756
3,090
Is this really 100% exactly what you wrote in your game ?

I ask, because here, you're telling Ren'py to use the value of the 'm' variable as name for the character... stored in the 'm' variable. It don't lead to a crash if the developer mode is disable, but it also obviously don't works.
This said, I just tested, and it don't prevent (who/what)_color to works. So it's a side bug, not the one you are looking for.
I'm using one letter variable for characters to save time and they said that's the better way to define a character. [m] is used to call for player chosen name in dialogue.
m "They call me [m]."
will lead to
Mike (saying)
They call me Mike. (considering a player had chosen name Mike previously.)
So I think it is perfectly fine but I don't understand the part with developer mode and that it obviously doesn't work.
 
Oct 30, 2018
395
1,143
Right, so I created a new project making no alterations to the gui.rpy or screens.rpy files. I used your character definitions and it all works fine - colors change as they should. So we can rule out that.

What changes, if any, have you made to your gui.rpy and your screens.rpy?
 
  • Like
Reactions: P_S_Y_C_H_O

P_S_Y_C_H_O

therappist
Game Developer
Sep 3, 2018
756
3,090
What changes, if any, have you made to your gui.rpy and your screens.rpy?

I uploaded gui and screens file in archive
I believe it's easy to compare with notepad++ compare addon
I still think I didn't interfere enough to override it but who knows...
 

anne O'nymous

I'm not grumpy, I'm just coded that way.
Modder
Respected User
Donor
Jun 10, 2017
10,263
15,073
So I think it is perfectly fine and I don't understand the part with developer mode and that it obviously doesn't work.
It's a circular reference. You ask m to find it's name in m !
It's the same kind of circular reference than when you try to call your phone by using your phone. It happen in both case that it works but, in both case here again, it's mostly because the error is caught before the worse happen.

[more in depth]
Ren'py being stronger than many imagine it, it can deal with it. This mostly because the code is parsed before you effectively overwrite the Character's object stored in the 'm' variable, by the name of the character stored in the same exact 'm' variable.
But it only works because the developer mode is not enabled (why don't you use the SDK ?). When it's the case, Ren'py try to ignore many exceptions that are thrown, only crashing if it can't find a way to land, more or less graciously, on its feet. It happen that in this particular case, it achieve to do it, but there's no guaranty that it will continue in the future ; like it don't mean that what is wrote is correct.
 
  • Like
Reactions: P_S_Y_C_H_O
Oct 30, 2018
395
1,143
So I have some bad news, I ran my test project using your screens.rpy and gui.rpy and I didn't have any issue with the colors.
(The only change I made was I set the font type back to default).

I'm fairly stumped on where the problem could be coming from. Aside from changing the gui and screens was there anything else you did before it stopped working?
 
  • Like
Reactions: P_S_Y_C_H_O

P_S_Y_C_H_O

therappist
Game Developer
Sep 3, 2018
756
3,090
So I have some bad news
Oh shit.
Scripts - introduced characters (posted earlier) and wrote dialogue.
Options - some common stuff like renaming game etc, without defining anything.
Images - just put some images.
So about this part. Maybe this default variable change to smth?
style window is default
style say_label is default
style say_dialogue is default
style say_thought is say_dialogue

style namebox is default
style namebox_label is say_label
 
Oct 30, 2018
395
1,143
I'm very doubtful it has anything to do with that, that doesn't have any bearing on the color of the text and moreover it's the same as the boiler plate screens.rpy you get when creating a new project. This is most confusing, I must say.

If you feel comfortable doing so, could you upload your scripts.rpy so I can have a look at it? If not, I understand.
 
  • Like
Reactions: P_S_Y_C_H_O

P_S_Y_C_H_O

therappist
Game Developer
Sep 3, 2018
756
3,090
Sure, nothing to hide yet

I'm very doubtful it has anything to do with that, that doesn't have any bearing on the color of the text and moreover it's the same as the boiler plate screens.rpy you get when creating a new project. This is most confusing, I must say.

If you feel comfortable doing so, could you upload your scripts.rpy so I can have a look at it? If not, I understand.
 
Oct 30, 2018
395
1,143
Good news! I found the problem and fixed it. The problem arose after you prompted the player to input a character's name.

You named the input 'm' which was also the name of your character object and their name, which got the whole system into a tizzy and it lost all the information about the character aside from the new name the player put in, therefore it was going to default all colors to their gui specified ones.

To solve this, all you need to do is create a variable to use as your characters name

Example:
define m = Character("[testname]", who_color="#FFFFFF", what_color="#0099ff")

And then when you prompt the user to read in their new name change it to something like:
$ testname = renpy.input("Hi! My name is (hereinafter up to 12 characters to prevent overlapping)", default='Norman')
$ testname = testname.strip()
if testname == "":
$ testname="Norman"


And repeat that process for each character you have the player name.

Let me know how you get on
 
  • Like
Reactions: P_S_Y_C_H_O