Page 1 of 1

colour trigger states

Posted: Sun May 30, 2010 5:19 am
by Caled
I would like to match a line based on its colour.

Some generic text two words some random text.

This is how I tried to do it:

1. Create a filter head with the pattern: ^Some generic text (\w+\s\w+)
(right terminology? I created a trigger group and gave it the above pattern.)
2. I checked "filter"
3. I created a trigger inside this trigger group, and changed state 0 to type to "colour trigger"
4. I selected a red foreground and black background.
5. I populated state 0 with the pattern: (\w+\s\w+) and selected type: perl regex
6. I put echo("success") in the script.

This trigger fires, seemingly correctly.
However, if I change the foreground colour to something else, such as yellow or blue, it still fires.
What am I doing wrong?

Re: colour trigger states

Posted: Sun May 30, 2010 5:37 am
by Caled
I worked out half of this problem.
All I needed to do was check "match all occurrences".

However, there is still more. I decided to play around with the 'filter' option.

The filter option passes the part of the line that matched the pattern, to the next trigger in the filter chain.

Is it possible to pass only the contents of matches[n] to the next trigger in the chain?

Re: colour trigger states

Posted: Sun May 30, 2010 9:27 am
by Heiko
No, but there's several Lua functions to test for ansi colors so pretty much any scripting need should be covered.

Re: colour trigger states

Posted: Sun May 30, 2010 1:20 pm
by Vadi
http://forums.mudlet.org/viewtopic.php? ... card#p3120

Maybe you can stick that into a lua trigger pattern.