Multiple word highlights on same line

Post Reply
User avatar
Rakon
Posts: 350
Joined: Tue Feb 16, 2010 7:41 pm
Contact:

Multiple word highlights on same line

Post by Rakon »

Why does this trigger not work the way I am expecting??

This is the trigger:
Image

This is what I get with that trigger (only highlights the word monolith): http://ada-young.appspot.com/pastebin/0ccac9de

This is what I expect from that trigger (highlights all occurrences of the words that match) : http://ada-young.appspot.com/pastebin/12d3cf0e

In order to get the second aspect, I have to make different triggers for each word I want highlighted in that manner.

Jor'Mox
Posts: 1142
Joined: Wed Apr 03, 2013 2:19 am

Re: Multiple word highlights on same line

Post by Jor'Mox »

While I can't say why it does what it does, I can say how to make it do what you want it to do.

Change the pattern type to Perl regex, and make the pattern this: shrouded|monolith|hidden

That will get all copies of any of those words in a line.

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

Re: Multiple word highlights on same line

Post by Vadi »

match all is for regex patterns to continue matching them on the line. It doesn't do anything in a substring context across multiple patterns.

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

Re: Multiple word highlights on same line

Post by Heiko »

@vadi
Vadi wrote:match all is for regex patterns to continue matching them on the line. It doesn't do anything in a substring context across multiple patterns.
This is not correct. The match-all option also captures substring patterns, e.g. you can use it in conjunction with the highlight option to highlight all occurrences of a given substring in a line.

@Rakon
Your problem is game specific. Your game obviously doesn't wrap the paragraph and just delivers one big line that mudlet soft-wraps for you. Consequently, as the OR trigger only runs once for the entire paragraph instead of once per "screen" line, you need one trigger per pattern in this special case.

User avatar
Rakon
Posts: 350
Joined: Tue Feb 16, 2010 7:41 pm
Contact:

Re: Multiple word highlights on same line

Post by Rakon »

Heiko wrote:@vadi
Vadi wrote:match all is for regex patterns to continue matching them on the line. It doesn't do anything in a substring context across multiple patterns.
This is not correct. The match-all option also captures substring patterns, e.g. you can use it in conjunction with the highlight option to highlight all occurrences of a given substring in a line.

@Rakon
Your problem is game specific. Your game obviously doesn't wrap the paragraph and just delivers one big line that mudlet soft-wraps for you. Consequently, as the OR trigger only runs once for the entire paragraph instead of once per "screen" line, you need one trigger per pattern in this special case.
Yes, this is the case, that Achaea is sending one long line for the room elements/people. I'm not needing 'match all occurrences on line' to match more than one line. I just am wondering why it's not doing what it says it's doing.

As per my first screenshot, I believe the trigger should not only run ONCE when 'match all occurrences on line' is selected. It should continue even after matching, and continue matching, until the end of the line is reached. If Achaea is sending the room desc and people in one long line, I don't see how it is a game specific error. Mudlet is not applying the 'match all occurrences on line' to the single, incoming line.

I know of the work around, and I know that I can make a single trigger for each word I want highlighted in this manner; but I shouldn't have to, if 'match all occurrences on line' functioned for substrings.

Drevarr
Posts: 43
Joined: Tue Aug 06, 2013 12:07 am
Location: GA, USA

Re: Multiple word highlights on same line

Post by Drevarr »

Doesn't the Lines 0 - 2 work as an OR statement, once it matches line 0 it ceases matching beyond 0 for further matching. However it would highlight all matches of line 0 pattern.

Image

Image

reverse lines
Image

Image

regex eliminates your issue in that all 3 can match on line 0 eliminating the OR

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

Re: Multiple word highlights on same line

Post by Heiko »

@Rakon
To be honest, I have no idea what you are trying to say. The trigger engine works on a per line basis, i.e. a single trigger is run at most once per line. In the case of the match_all option, Mudlet simply expands all matches of the trigger pattern that fired the trigger (-> difference between AND and OR triggers) - the rest of the OR patterns is ignored (-> execution speed).

Jor'Mox
Posts: 1142
Joined: Wed Apr 03, 2013 2:19 am

Re: Multiple word highlights on same line

Post by Jor'Mox »

He is saying that he wished it checked through the OR statement for each additional match, rather than checking the whole line for one match, and then matching that multiple times.

Honestly, I think having it operate the way it does is beneficial, in that it provides a functionality that you can't really get any other way. On the other hand, as has been stated, there are several different ways to achieve the goal he is aiming for, just not the way he chose.

Post Reply