Color Trigger Question

lionhardt13
Posts: 1
Joined: Fri Mar 21, 2014 5:02 pm

Re: Color Trigger Question

Post by lionhardt13 »

demonnic wrote:By default, it will only highlight the part it matches.

adding this to the trigger's script should help you out:
Code: [show] | [select all] lua
selectCurrentLine()
fg("green")
deselect()
resetFormat()
What this does is select the line the trigger has matched on, sets the foreground (or text) color to green, then clears the selection and resets format so your next triggers/lines come out looking as intended and you don't accidentally bleed into other text.
I was looking into this earlier, but I wanted to just match a specific word on my line and make it highlight. "You have 24/200 hit, 34/68 mana, and 112/120 moves." I want to highlight the hit points green, the mana, yellow, and the moves orange. Would it just be easier to make a trigger for each word I want highlighted or can I put it all in one script?

User avatar
demonnic
Posts: 884
Joined: Sat Dec 05, 2009 3:19 pm

Re: Color Trigger Question

Post by demonnic »

So if regex looks like this:

^You have (\d+)/(\d+) hit, (\d+)/(\d+) mana, and (\d+)/(\d+) moves.$

Then you could do:
Code: [show] | [select all] lua
selectCaptureGroup(1)
fg("green")
selectCaptureGroup(2)
fg("green")
selectCaptureGroup(3)
fg("yellow")
selectCaptureGroup(4)
fg("yellow")
selectCaptureGroup(5)
fg("orange")
selectCaptureGroup(6)
fg("orange")

deselect()
resetFormat()

Post Reply