What I have:
I have a textbox (two different textboxes that switch, based on whether or not the narrator or a character with a name speaks - there's a cutout in the background of the name-one to fit the namebox correctly).
That works fine, I've implemented that code in the say screen like this:
Code: Select all
if who is not None:
background Image("gui/textbox_cutout.png", xalign=0.5, yalign=1.0)
else:
background Image("gui/textbox.png", xalign=0.5, yalign=1.0)
So, I was hoping I could use a similar approach for the nameboxes (I have a default, grey namebox - what I want to do is have the namebox itself change background color on specific characters, instead of changing their text-color).
However, I don't know if there is a way to compare the "who" value of the say-screen, with character-variables.
I tried the following:
Code: Select all
if who == getattr(store,"fP"):
background Image("gui/namebox_fp.png", xalign=0.5, yalign=0)
elif who == getattr(store, "fM"):
background Image("gui/namebox_fm.png", xalign=0.5,yalign=0)
I've also tried this:
Code: Select all
if who == fP:
background Image("gui/namebox_fp.png", xalign=0.5, yalign=0)
elif who == fM:
background Image("gui/namebox_fm.png", xalign=0.5,yalign=0)
So, I'm pondering how I can compare the value of the character variable (in these cases fP and fM, containing "Marten" and "Anne") respectively and define their background based on that?
It DOES work if I compare to a specific string - so for another character, an NPC with a set name, it works doing:
Code: Select all
if who == "Karen":