Page 1 of 1

Inconsistent color, bug or am I doing it wrong?

Posted: Wed Feb 03, 2010 6:41 am
by juraj
I have two triggers that I use to replace and colorize text for visibility that are identical except for the foreground color and a few of the replacement text characters, but one of them isn't coloring properly.

Image

for the balance one ("You have recovered balance on all limbs.", exact match):

Code: Select all

selectString( "You have recovered balance on all limbs.", 1)
replace( "<<     +++++ ON BALANCE +++++     >>")
setBgColor(0,0,200)
setFgColor(255,100,100)
resetFormat()
equilibrium one ("You have recovered equilibrium.", exact match):

Code: Select all

selectString( "You have recovered equilibrium.", 1)
replace( "<<        +++++ ON EQ +++++        >>")
setBgColor(0,0,200)
setFgColor(255,224,102)
resetFormat()
I can't see why they should act differently, is this a bug or am I doing it wrong?

Re: Inconsistent color, bug or am I doing it wrong?

Posted: Wed Feb 03, 2010 7:13 am
by Heiko
After replace() your selection is no longer defined as the text length changes. Call replace() after setting your colors.

Re: Inconsistent color, bug or am I doing it wrong?

Posted: Wed Feb 03, 2010 7:27 am
by juraj
That did it. Thanks!