Howto: keep color in replace()

Post Reply
User avatar
Vadi
Posts: 4711
Joined: Sat Mar 14, 2009 3:13 pm

Howto: keep color in replace()

Post by Vadi » Thu Apr 21, 2011 4:44 pm

To keep colour in your replace(), just add this inbetween your select and replace functions:
Code: [show] | [select all] lua
  setBgColor(getBgColor())
  setFgColor(getFgColor())
For example, what was
Code: [show] | [select all] lua
selectString("Bob", 1)
replace("Bob the guy")
Now becomes
Code: [show] | [select all] lua
selectString("Bob", 1)
setBgColor(getBgColor())
setFgColor(getFgColor())
replace("Bob the wizard")

User avatar
Rakon
Posts: 350
Joined: Tue Feb 16, 2010 7:41 pm
Contact:

Re: Howto: keep color in replace()

Post by Rakon » Sun Apr 24, 2011 5:02 pm

What about lines that have different colours in them??

User avatar
Vadi
Posts: 4711
Joined: Sat Mar 14, 2009 3:13 pm

Re: Howto: keep color in replace()

Post by Vadi » Sun Apr 24, 2011 5:58 pm

Then this isn't applicable. If you'll be adding new text, how will a script know what colours to apply to the new wording?

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests