Ren'Py Who can help me with the renpy.input and what_color?

Dolmen

Newbie
May 27, 2020
56
86
I am currently working on a LITTLE RenPy game and have a BIG problem :rolleyes:
It's about assigning the color for the namebox and for the dialogbox of the characters whose name I want to change by typing.
Python:
define uw = Character("Unknown woman", who_color="#FC15F9", what_color="#FA7BF9")
As long as the name is a string, it works.
But if I use sense, replace the string with a variable, the colors are gone.
Python:
$ uw = renpy.input("<Standard-Name is Unknown woman> Just call me:")
$ uw = uw.strip()
if uw == "":
    $ uw = Character("Unknown woman", who_color="#FC15F9", what_color="#FA7BF9") ### it works
    $ uw = Character("[uw]",  who_color="#FC15F9",  what_color="#FA7BF9") ### The name "Sarah" is correct but the color is gone.
Then I also tried with :
Python:
elif():
   $ uw = Character("[uw]",  who_color="#FC15F9",  what_color="#FA7BF9") ### Like above

I suspect this is a style-thing...
Has anyone dealt with this before? I would be happy.
 

PxGames

Member
Game Developer
Oct 2, 2020
115
471
No need to make it so complicated, using simple like this:


define mc = Character("[mc_name]",color="#009933", what_color="#6600cc") # first for the name, 2nd for dialogue text



mc_name is variable, got from renpy.input. The important is not to name it the same as a defined character variable (mc in this case).
 

Dolmen

Newbie
May 27, 2020
56
86
Thanks a lot, JPace !
Then I can't write define uw = Character("[uw]"... bla, bla..., because they are the same.
So it must be uw = Character("[uw_name]"... bla, bla...
I will change and then see the colors for sure - thanks :)
 

scott_c

New Member
Oct 7, 2017
6
1
you can actually also use a variable for the style like
# default
Python:
name_color = "#FFFFFF"

name = renpy.input('name?')

if name=='':

   name_color = "#000000"

   name = "unknown woman"


$ uw = Character(name, who_color=name_color, what_color="#FA7BF9")
 

Dolmen

Newbie
May 27, 2020
56
86
Oh, that looks interesting, putting the color in a variable. Thanks, for the impetus, scott_c ! :)
Hmm... but...
Code:
name = renpy.input('name?')
if name=='':                         ### If no input...
   name_color = "#000000"
   name = "unknown woman"            ### then variable name = unknown woman
$ uw = Character(name, who_color=name_color, what_color="#FA7BF9")  ### uw-variable = unknown woman??
But won't uw show the unknown woman and not the self created input name?

Edit: Aah... The $ uw given the renpy.input-name a new content, the self-created input name, right?
 
Last edited:

PxGames

Member
Game Developer
Oct 2, 2020
115
471
I still suggest you use the 'define' and put all characters in the same place (or file). It'll help your code be well organized in the long run when you have so many characters, it's also easier for troubleshooting or taking a look if you forgot the defined variable.

Don't make it more complex or unorganized, you'll regret it later.
 

Dolmen

Newbie
May 27, 2020
56
86
Um... you're right, JPace, I do have some characters and they need to be taken care of.
I have the variables in a separate file, the definitions with the assignments in script.rpy.
But... as I said, the renpy.input I have in the prologue and with the mc there is no problem, only with the side characters, which the player should also enter a name, could... there the colors are ignored by my renpy.
Well, with the suggestions from here, I guess I'll get back to work.
Either it works or it doesn't...