mIRC Homepage

Enhanced highlight capabilities

Posted By: maroon

Enhanced highlight capabilities - 17/04/22 06:29 PM

Highlight rules could have more flexibility if additional inputs/outputs were available to aliases being used.

Specifically, it would be great if the identifier used in the highlight rule itself could have $nick be filled, and same goes for better support of 'message' as being a 'command to be executed when there is a match'.

For example, while the highlights dialog allows specifying a whitelist of channels, it doesn't allow altered behavior based on which nick was saying the message, so you can't script the rule to apply only to ops, or only to non-ops.

If I create a rule like $reply_to_highlight($chan $nick $1-) the only thing passed to the alias is that $chan is filled by the channel where the message was 'said', and also the string inside the (parenthesis) is passed as $1- and $parms. However, it would be useful if $nick were passed, and it would also be helpful if the channel message itself could be passed to the alias somehow.

Also, when I attempted to echo a debug message to the status window or to @test or to $chan, nothing happens, even though $window(1) matches the place where I'm trying to dump the debug message. I can instead dump the text into a hashtable, and can later retrieve the data, but the /echo command seems to be disabled. So, in order to dump a debug message to the status window, I'm forced to use a timer.

If the message text were to be passed to the alias, I'm not sure what it should be called. Probably not $hotline even though this would be something similar to that.

Ih the past, I've been able to make a blacklist of channels for the rule to ignore by having the rule be $reply_to_highlight(#list #of #blacklisted #channels) and then return $me only if $chan is not a token in the $1- seen by the alias.


The only way I see to hijack the highlight tab's rules to do what was requested here:
is to make this kludge:

(#1) create a rule for "highlight lines that contain these words:" where you put the text:


(#2) At the bottom in the box at the bottom labeled "Message:" put the text:


(#3) Even though you're not wanting to generate a tooltip balloon, check the box "tip message", or else the (#2) "message" will be ignored.

#4) Put these aliases into a script:

alias highlightevent {
  .timer 1 0 reply_yes $chan

alias reply_yes {
  var %line $line($1,$line($1,0))
  var %nick $remove($gettok($strip(%line),2,32),<,>,@,+,&,~,%)
  editbox -pf1 $1 %nick $+ :

(#5) Click OK then have someone test your highlight. Any choice of giving the line a special color is independent of these actions. The above assumes you are using a timestamp which causes the speaker's nick to be the 2nd word. If there is no timestamp causing the speaker's nick to be the 1st word then change the ",2," to ",1,"


Warnings for those trying to use this kludge:

The timer was necessary for the above to work, because the line containing the highlight didn't yet appear from the viewpoint of the highlightevent alias.

Since $nick wasn't fed to the alias, it needs to use a kludge to try to examine the last line of $chan to get it. While the above worked in my testing, I'm not confident that there won't be cases where some other line slips between "timer 1 0 alias" and the message highlighting your nick.

This script will probably causes the user to be irritated by having the active window suddenly switched to the window where your nick was used, so if that's the case, remove the f1 from the editbox command, making it instead be:

editbox -p $1 %nick $+ :
© 2022 mIRC Discussion Forums