How to change color of existing text in a label?

Post Reply
Posts: 27
Joined: Fri Jun 26, 2015 8:52 am

How to change color of existing text in a label?

Post by EulersIdentity » Tue Jul 21, 2015 6:12 am

I've set up a label that uses echo() to fill itself with my character's defences, with red and green representing whether they are present or not. It's for Achaea, and I'm using gmcp.Char.Defences.List to populate the label. This doesn't, however, catch defences as they are added or lost, so I was hoping I could toggle the colors of an existing word on the events gmcp.Char.Defences.Add and gmcp.Char.Defences.Remove. Having it re-echo the entire thing would require me to change all of the script that I've written for echoing defences so far. I tried to do so using selectString() and setFgColor() and had no luck:
Code: [show] | [select all] lua
registerAnonymousEventHandler("gmcp.Char.Defences.Add", "defenceWin.updateAdd()")
function defenceWin.update ()
	defenceWin.right:setFgColor(0,255,0 )
end -- defenceWin.update
defenceWin.right and defenceWin.left are the two labels holding the defences. Is there a way to redo this without re-echoing the defence list on all 3 events?

Post Reply

Who is online

Users browsing this forum: No registered users and 12 guests