Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to verify your details, confirm your email, resolve issues, making threats, or asking for money, are
spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the
password reset link.
Due to spam on this forum, all posts now need moderator approval.
Entire forum
➜ MUSHclient
➜ General
➜ Triggers that match on colors that appear midway through a line
|
Triggers that match on colors that appear midway through a line
|
It is now over 60 days since the last post. This thread is closed.
Refresh page
| Posted by
| Bobble
Canada (76 posts) Bio
|
| Date
| Sun 11 Jan 2004 06:53 AM (UTC) |
| Message
| 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. |
Open the watch. | | Top |
|
| Posted by
| Nick Gammon
Australia (23,165 posts) Bio
Forum Administrator |
| Date
| Reply #1 on Sun 11 Jan 2004 07:37 PM (UTC) |
| Message
| | Are you using a regular expression to match on "clouds"? |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | | Top |
|
| Posted by
| Bobble
Canada (76 posts) Bio
|
| Date
| Reply #2 on Sun 11 Jan 2004 11:12 PM (UTC) |
| Message
| | 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. |
Open the watch. | | Top |
|
| Posted by
| Nick Gammon
Australia (23,165 posts) Bio
Forum Administrator |
| Date
| Reply #3 on Mon 12 Jan 2004 01:19 AM (UTC) |
| Message
| 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. :) |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | | Top |
|
| Posted by
| Bobble
Canada (76 posts) Bio
|
| Date
| Reply #4 on Wed 10 Mar 2004 05:31 AM (UTC) Amended on Wed 10 Mar 2004 05:35 AM (UTC) by Bobble
|
| Message
| 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? |
Open the watch. | | Top |
|
| Posted by
| Nick Gammon
Australia (23,165 posts) Bio
Forum Administrator |
| Date
| Reply #5 on Wed 10 Mar 2004 05:50 AM (UTC) |
| Message
| 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).
|
- Nick Gammon
www.gammon.com.au, www.mushclient.com | | Top |
|
| Posted by
| Bobble
Canada (76 posts) Bio
|
| Date
| Reply #6 on Wed 10 Mar 2004 10:24 PM (UTC) |
| Message
| Thank Nick!
Works great! I can't tell you how happy I am right now. |
Open the watch. | | Top |
|
| Posted by
| Poromenos
Greece (1,037 posts) Bio
|
| Date
| Reply #7 on Fri 12 Mar 2004 02:09 AM (UTC) |
| Message
| | Can't you just make a trigger that enables it, one that matches anything that's yellow on black, and one that disables it? |
Vidi, Vici, Veni.
http://porocrom.poromenos.org/ Read it! | | Top |
|
| Posted by
| Bobble
Canada (76 posts) Bio
|
| Date
| Reply #8 on Fri 12 Mar 2004 05:12 AM (UTC) |
| Message
| | 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. |
Open the watch. | | Top |
|
The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).
To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.
25,364 views.
It is now over 60 days since the last post. This thread is closed.
Refresh page
top