colour trigger states

Post Reply
Caled
Posts: 403
Joined: Thu Apr 09, 2009 4:45 am

colour trigger states

Post 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?

Caled
Posts: 403
Joined: Thu Apr 09, 2009 4:45 am

Re: colour trigger states

Post 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?

User avatar
Heiko
Site Admin
Posts: 1548
Joined: Wed Mar 11, 2009 6:26 pm

Re: colour trigger states

Post by Heiko »

No, but there's several Lua functions to test for ansi colors so pretty much any scripting need should be covered.

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

Re: colour trigger states

Post by Vadi »

http://forums.mudlet.org/viewtopic.php? ... card#p3120

Maybe you can stick that into a lua trigger pattern.

Post Reply