Matalla wrote: ↑Sat Apr 13, 2019 9:54 am
It's either a bug or a piece of code somewhere else that contradicts that. I tested and it works. Why don't you test it in a blank project where it should be easier to troubleshoot it? Start only with the style definitions, the nameboxes files and some lines of dialogue.
I made a blank project and compared the two screen.rpy files to see what was different, and I discovered what was causing the issue:
Code: Select all
screen say(who, what):
style_prefix "say"
window:
id "window"
text what id "what"
if who is not None:
window:
id "namebox"##This was what I was missing. This lets me change the namebox to different colours for different characters
style "namebox"
text who id "who"
if not renpy.variant("small"):
add SideImage() xalign 0.0 yalign 1.0
And I was missing this line right underneath:
Code: Select all
## Make the namebox available for styling through the Character object.
init python:
config.character_id_prefixes.append('namebox')
Then I added the different namebox styles:
Code: Select all
style namebox:
xpos gui.name_xpos
xanchor gui.name_xalign
xsize gui.namebox_width
ypos gui.name_ypos
ysize gui.namebox_height
background Frame("gui/textbox/name tag pink.png", gui.namebox_borders, tile=gui.namebox_tile, xalign=gui.name_xalign)
padding gui.namebox_borders.padding
style nameboxgreen:
xpos gui.name_xpos
xanchor gui.name_xalign
xsize gui.namebox_width
ypos gui.name_ypos
ysize gui.namebox_height
background Frame("gui/textbox/name tag green.png", gui.namebox_borders, tile=gui.namebox_tile, xalign=gui.name_xalign)
padding gui.namebox_borders.padding
Then I defined the characters, as Per K Grok wrote it:
Code: Select all
define b = Character("Boy", image="boy", namebox_style="nameboxgreen", ctc="ctc", ctc_position="fixed")
(I discovered that it needs to be defined as
namebox_style="nameboxgreen" . If you use
namebox_background="gui/textbox/name tag green.png" , it uses the green namebox, but it removes any custom borders you've programmed.)
It works now! Thank you SO much, Matalla and Per K Grok!