mIRC Home    About    Download    Register    News    Help

Print Thread
#55448 17/10/03 11:51 AM
Joined: Jan 2003
Posts: 1,063
D
Doqnach Offline OP
Hoopy frood
OP Offline
Hoopy frood
D
Joined: Jan 2003
Posts: 1,063
is it possible to use regexp in the highlight matches?

I wish there was some way, you could disable the default highlights done by mIRC and script your own!
an alias that could TRIGGER highlights (by which I mean, make the button use the highlight color, make mIRC flash X time, display a message etc)

I would like to use regexp in highlight because I want exceptions for highlighting my nick

so I would very much like extensive highlight options...

(PS: I tried to search for topics about regexp + highlights and none were found so I hope this hasn't been dealt with already :-P probably it will because this forum has dealt with almost all options you can think of already *G*)

kind regards,


Doqnach


If it ain't broken, don't fix it!
#55449 17/10/03 01:08 PM
Joined: Aug 2003
Posts: 314
S
Fjord artisan
Offline
Fjord artisan
S
Joined: Aug 2003
Posts: 314
You can do all of what you described using an on text event, /flash and /window.

For example:

on $*:text:$(/,$me,/iS):#:window -g2 # | flash $nick said your nickname in #

And that simulates the highlight behavior mIRC uses. There are certain other switches you can use with /flash depending on what you want. You can change the regular expression to the one you are using in the matchtext part (to include your exceptions etc.)

#55450 17/10/03 02:49 PM
Joined: Jan 2003
Posts: 2,523
Q
Hoopy frood
Offline
Hoopy frood
Q
Joined: Jan 2003
Posts: 2,523
You can use an alternative method, that allows you to use the Highlight list and all the features it provides (like colouring the line). As it lets mirc handle the display, issues like consecutive spaces are avoided. This method is based on 2 features: a) the fact that you can use identifiers/variables as highlight items , b) the ^ event prefix, which triggers an event before mirc deals with the message internally. This allows you to change the value returned by the variable/identifier in the Highlight list before mirc attempts to match the items against the message/nick. Here it is:
Code:
on ^*:text:*:*: set -u1 %text $1- | set -u1 %nick $nick
on ^*:action:*:*: set -u1 %text $1- | set -u1 %nick $nick
alias hlreg {
  if $2 & 1 && $regex($strip(%text),$1) { return %text }
  if $2 & 2 && $regex(%nick,$1) { return %nick }
}
Then you can make custom identifiers and use them as items in the Highlight list, like this:
Code:
alias itemA return $hlreg(<pattern A>,[color:red]1[/color])
alias itemB return $hlreg(<pattern B>,[color:red]2[/color])
alias itemC return $hlreg(<pattern C>,[color:red]3[/color])
Then you can add $itemA, $itemB, $itemC etc in the Highlight list.
Notice the 2nd parameter in $hlreg (red numbers). If you set the "Match on:" item in the Highlight list to "Message only" you'd set that number to 1 in $itemA. For "Nickname only" the number should be 2 (ie something like $itemB) and for "Nickname and message" something like $item3.

Example: to highlight text containing double words (eg "hello hello" or "this is is a script" etc), you'd create this custom identifier:
Code:
alias someitem return $hlreg(/(\w+) \1/,1)
and then add "$someitem" in the Highlight list.

Edit: forgot to $strip() text

Last edited by qwerty; 17/10/03 02:52 PM.

/.timerQ 1 0 echo /.timerQ 1 0 $timer(Q).com

Link Copied to Clipboard