|
dish13 Newbie
Joined: 21 Apr 2011 Posts: 1
|
Posted: Thu Apr 21, 2011 6:44 pm
Change the color of only one word of the line with triggers |
Hello,
I've found in the forums how to change the color of the entire line. Bur for example, my status is:
<Hp:1/100 M:1/100>
and I want to change Hp:1/100 red and M:1/100 to blue. If I do a pattern that matches Hp:%d/%d #CO red it turns the entire line red. How can I change only a portion of the text?
Thanks. |
|
|
|
charneus Wizard
Joined: 19 Jun 2005 Posts: 1876 Location: California
|
Posted: Thu Apr 21, 2011 7:22 pm |
You can use #CW for color word, or you can use #PCOL. Personally, I'd go with #CW.
|
|
|
|
Fizgar Magician
Joined: 07 Feb 2002 Posts: 333 Location: Central Virginia
|
Posted: Thu Apr 21, 2011 11:43 pm |
Scripting is great because you can do the same thing many different ways usually. It sounds like you want to match the HP:1/100 part of the prompt and turn it all red then match M:1/100 and turn all that blue. If that's what you are trying to do #CW will work like charneus suggested but that will require two triggers to match and color each part of the prompt. Since most people already have a single prompt trigger set up #PCOL will probably suit your needs better and eliminate the need for two extra triggers.
Add the pattern:
Code: |
<(Hp:(%d)/(%d)) (M:(%d)/(%d))> |
Alot of capturing going on there just to demonstrate how it works. If the prompt received was:
The first capturing group would grab: Hp:1/100
The second: 1
The third: 100
The Fourth capturing group would grab: M:2/200
The fifth: 2
The sixth: 200
Now in the trigger script just add:
Code: |
#pcol mxpred %x1
#pcol mxpblue %x4 |
You now have one single prompt trigger that will do what you want and there is room to add more functionality in the future. |
|
_________________ Windows Vista Home Premium SP2 32-bit
AMD Athlon Dual Core 4400+ 2.31 GHz
3 GB RAM
CMUD 3.34 |
|
|
|
|
|