Triggers that match on colors that appear midway through a line

Posted by Bobble on Sun 11 Jan 2004 06:53 AM — 9 posts, 29,125 views.

Canada #0
Greets all,

I've run into a bit of a problem, I need to create a trigger that matches on a specific color, however, the text in this particular color appears midway through a line. For instance the line:

clouds. Outside the Cave.

has two colors. "Clouds. " is in cyan on black while "outside the cave" is yellow on black. I want the trigger to catch any text that's in yellow on black into a wildcard, but I've run into a problem, if the first character of the line isn't in yellow on black, it won't fire the trigger. Is there any way to work around this?

Please let me know if I need to clarify anything.
Australia Forum Administrator #1
Are you using a regular expression to match on "clouds"?
Canada #2
no, this was just an example. The text that appears in cyan and the text that appears in gold will change depending on circumstances. So what I need is a trigger that ignores the cyan part of the line and captures the part in gold.
Australia Forum Administrator #3
If the trigger is a regular expression, it can match a single word (or group of words), which you can see if you colour it a different colour.

Then once matched the colour evaluation is done on the first letter of the matching text. So, in your example, if you matched "Outside the Cave" (regular expression) and then matched yellow on black, it would match a line with "Outside the Cave" in yellow on black.

However if there a pre-conditions, like the line must start with something else, then it becomes harder, although you might achieve that with a second trigger that discards lines that do *not* have that precondition, and use sequence numbers to control evaluation order.

See if that works, otherwise there is another approach you could use. :)
Canada #4
Hi Nick,

Sorry for the long delay in the reply. This strategy won't work, since what's written in cyan and what's written in yellow on black changes unpredictably. It won't always be "Outside the Cave." In fact, it might never be that text. I know only that some word (or group of words) in the line will be written in yellow on black. Sometimes these will appear at the beginning of the line, other times, they will appear after other text written in any colour other than yellow on black.

So what I need is a trigger that captures *only* the yellow on black text, whatever it may be, wherever it may be on the line.

Does this clarify at all?
Amended on Wed 10 Mar 2004 05:35 AM by Bobble
Australia Forum Administrator #5
Yes it clarifies it, but trigger matching currently works the other way. That is, it matches the text you supply and then confirms it is the colour you want (if any).

You want it to scan for colours first.

It can be done, write a script that does GetLineInfo, and GetStyleInfo to iterate through the style runs for the line (it would help reduce computation if you could at least partly identify the line, but if not you could do it for all lines).

You could fairly quickly find the colour sequences you want, and then start evaluating the text (the style info has the text as well as the colours).
Canada #6
Thank Nick!

Works great! I can't tell you how happy I am right now.
Greece #7
Can't you just make a trigger that enables it, one that matches anything that's yellow on black, and one that disables it?
Canada #8
The problem is that if the line doesn't start in gold on black, the trigger won't match the gold on black text later in the line.