[Script] Boldify nicks mentions in messages

Added by Mr. BS about 8 years ago

Until a possible built in feature is implemented, there is a script solution. Thanks kikuchi for the $regsubex snippet and kr0n for the On Parseline suggestion.

on *:PARSELINE:in:*:{
  var %target $gettok($parseline,3,32)
  if ($gettok($parseline,2,32) == PRIVMSG && %target ischan) {
    .parseline -it : $+ $gettok($parseline,1,58) $+ : $+ $regsubex($gettok($parseline,2-,58),/([^\72\s,]+)/g,$iif(\1 != $me && \1 ison %target,$+($chr(2),\1,$chr(2)),\1))

Be free to share an improved version, I'm sure it can be optimized.

ps: $me (your own nick) is excluded because supposedly user already has this as default highlight entry in AdiIRC options.


AdiIRC v1.9.7+

Replies (2)

RE: [Script] Boldify nicks mentions in messages - Added by Paul Janson over 5 years ago

The above script does not handle messages which begin with a colon, swallowing them all as part of the delimiter between the channel message and the PRIVMSG prefix. It also condenses all later consecutive colons into a single colon. The solution is to use $pos to find the location of the 1st colon, then use the string following that.

is replaced with

so the parseline command becomes:

.parseline -it : $+ $gettok($parseline,1,58) $+ : $+ $regsubex($mid($parseline,$calc(1+$pos($parseline,:,1))),/([^\72\s,]+)/g,$iif(\1 != $me && \1 ison %target,$+($chr(2),\1,$chr(2)),\1))

RE: [Script] Boldify nicks mentions in messages - Added by westor (GR) over 5 years ago

That fixed parseline you quoted causing issues:

OLD PARSELINE: : PRIVMSG #dragondyce :브락핀그 잇 기 레보루숀!!!
NEW PARSELINE: : PRIVMSG #dragondyce : PRIVMSG #dragondyce :브락핀그 잇 기 레보루숀!!!