Nick Alert

By yelow79 on Aug 10, 2011

I know this has been done a million times... But here is yet another nick alert.

What it does is tell you in your active channel that someone said your nick in another channel, it will also beep 3 times at you when your nick is said in another channel.

Options:

  1. turn the nick alert on or off

  2. You can set an alternative word to trigger your nick alert (IE. My nick is yelow79 many people tend to say just yelow to get my attention - with this snippet I can set either my nick or yelow to trigger my nick alert)

  3. You can set a nick to ignore such as a bot that repeats your nick constantly.

  4. I have also added an option to see the list of nicks to be triggers and ignored

To install simply copy and paste this snippet into your remotes tab... save and you are done.

To use this you just need to right click in either the status, channel, or query window and select "Nick Alert" followed by one of the options. (alternatively you can click on mirc at the top)

This is the first script I have posted on here... Please tell me your thoughts

Credit goes out to Jethro_ and Veritas see comments below.

KNOWN BUGS:
none after 11-30-11 update

menu status,menubar,channel,query {
  Nick Alert
  .set $iif(%alert == on, OFF, ON ) :{
    set %alert $iif(%alert == on,off,on)
    echo 3 -a nickalert is now turned %alert
  }
  .-
  .set alt. trigger {
    if (!$istok(%altnick,$$?"enter an alternative nick here:",32)) {
      set %altnick $addtok(%altnick,$!,32)
      echo 3 -a your alternative nick $! has been added to my alternative nick list!
      return
    }
    echo 3 -a $! is already set as an alternative nick!
  }
  .del alt. trigger {
    if ($istok(%altnick,$$?"Enter an alternative nickname to delete:",32)) {
      set %altnick $remtok(%altnick,$!,1,32)
      echo 3 -a your alternative nick $! has been deleted successfully!
      return
    }
    echo 3 -a The alternative nickname $! is either deleted or doesn't exist in my alternative nick list.
  }
  .-
  .set nick to ignore {
    if (!$istok(%ignick,$$?"enter a nickname to ignore:",32)) {
      set %ignick $addtok(%ignick,$!,32)
      echo 3 -a $! will now be ignored!
      return
    }
    echo 3 -a $! has already been ignored.
  }
  .del ignored nick {
    if ($istok(%ignick,$$?"enter a nickname to remove from ignore:",32)) {
      set %ignick $remtok(%ignick,$!,1,32)
      echo 3 -a $! is now removed from my ignore list!
      return
    }
    echo 3 -a $! is not found in the ignore list.
  }
}
on $*:text:$(/\b(\Q $+ $me $+ \E|\Q $+ %altnick $+ \E)\b/iS):*: {
  if (%altnick == $null) && (!$istok($me,$1-,32))  {
    halt
  } 
  if ($activewid != $window($iif(#, #, $nick)).wid) {
    nickalert $1- 
  }
}
on $*:action:$(/\b(\Q $+ $me $+ \E|\Q $+ %altnick $+ \E)\b/iS):*: { 
  if (%altnick == $null) && (!$istok($me,$1-,32))  {
    halt
  }
  if ($activewid != $window($iif(#, #, $nick)).wid) {
    nickalert $1- 
  }
}
alias -l nickalert {
  if (!$istok(%ignick,$nick,32)) && (%alert == on) {
    echo -a 4[ $+ $time $+ ] $nick said your name $iif($scid(0) > 1, on $network) in $chan $+ : $1-
    beep 3
  }
}

Comments

Sign in to comment.
yelow79   -  Nov 30, 2011

Updated to fix the constant triggering when there was no alternative trigger added.

 Respond  
yelow79   -  Nov 27, 2011

I have been meaning to fix this. But have gotten busy with too many other projects.

 Respond  
Quierra   -  Nov 27, 2011

Thank you :)

 Respond  
yelow79   -  Nov 27, 2011

the way to fix that is to set an alt nick

 Respond  
Quierra   -  Nov 27, 2011

Okay perhaps I'm a bit too drunk, but when I loaded this in, all it did was basically copy the entire chat into a pm I was currently in.... Alexakai is not every word lol... How do i fix that?

 Respond  
yelow79   -  Aug 18, 2011

Cool thanks. This is why I posted this snippet.

 Respond  
Jethro   -  Aug 18, 2011

Suggestion:

on $*:text:$(/\b(\Q $+ $me $+ \E|\Q $+ %altnick $+ \E)\b/iS):*: nickalert
on $*:action:$(/\b(\Q $+ $me $+ \E|\Q $+ %altnick $+ \E)\b/iS):*: nickalert
alias -l nickalert {
  if (!$istok(%ignick,$nick,32)) && (%alert == on) && ($active != $chan) {
    echo -a 4[ $+ $time $+ ] $nick said your name in $chan $iif($scid(0) > 1,on $network) $+ : $1-
    beep 3
  }
}
 Respond  
yelow79   -  Aug 18, 2011

Final update done. added action triggers.

 Respond  
yelow79   -  Aug 17, 2011

That is very interesting because when I copy and paste directly from what you posted Virtually everything triggers. I even thought maybe I needed to delete the variables and restart mirc but even that didn't work. I am still using 6.35, you think maybe that could be the cause?
And BTW thanks for explaining. I probably didn't word it very well but that is exactly how I thought it was working

EDIT:
I just did a little further testing, your version works as long as there is not multiple nicks to be ignored or multiple alternative triggers. I have gotten it to work properly if I go in and manually set the second nick to be ignored so that under the variables tab it looks like this { %ignick nick1 | nick2 | nick3 }. I will try to figure out on my own how to make it add the spaces but won't complain if you help me out there.

 Respond  
Jethro   -  Aug 15, 2011

Upon brief testing at my end, it does work for me. I'm not sure why it's not working for you.

the C means a divider so to speak. Every nickname is separated by a space, so as a result, we use $chr(32), and it looks like this:

if ($istok(nick1 nick2 nick3 nick4,$nick,32) != $true) { these nicks are to be ignored }
else { the rest of nicks are to return $true and be matched }

By putting a ! before the the $istok() identifier will negate, same as != $true.

 Respond  
yelow79   -  Aug 15, 2011

Updated to what I am currently using. only 1 alternative trigger, and 1 nick can be ignored.

 Respond  
yelow79   -  Aug 15, 2011

I also tested with multiple alternative triggers and if more than one is set it doesn't work

 Respond  
yelow79   -  Aug 15, 2011

from reading this

$istok(text,token,C)

Returns $true if token exists, otherwise returns $false.

it looks to me like no matter what the text is the token is present there for it always returns $true
in this line

on $*:text:$(/\b(\Q $+ $me $+ \E|\Q $+ %altnick $+ \E)\b/iS):#:{
  if (!$istok(%ignick,$nick,32)) && (%alert == on) && ($active != $chan)  {
    echo -a 4[ $+ $time $+ ] $nick said your name in $chan $+ : $1-
    beep 3
  }
} 

I believe the ! in !$istok means doesn't as like != would. but still this does not work, because it does not seem to compare the text with the token. I am not sure about what the C means I know it is supposed to be replaced with some number just don't know what numbers mean what.

 Respond  
yelow79   -  Aug 15, 2011

Jethro_ unfortunately this does not work :(

 Respond  
yelow79   -  Aug 15, 2011

Thank you for clearing all of that up for me. I will test this then edit the snippet. And of course giving you due credit.

 Respond  
Jethro   -  Aug 15, 2011

You almost had it covered, but you mispositioned the added code. Here is the finished product for you:

menu status,menubar,channel,query {
  Nick Alert
  .set $iif(%alert == on, OFF, ON ) :{
    set %alert $iif(%alert == on,off,on)
    echo 3 -a nickalert is now turned %alert
  }
  -
  .set alt. trigger {
    set %altnick $addtok(%altnick,$$?"enter an alernative nickname here:",124)
    echo 3 -a your alternative nick $! has been added to my alternative list!
  }
  -
  .del alt. trigger {
    if ($istok(%altnick,$$?"Enter an alernative nickname to delete:",124)) {
      set %altnick $remtok(%altnick,$!,1,124)
      echo 3 -a your alternative nick $! has been deleted successfully!
    }
    else {
      $input(The alternative nickname $! is either deleted or doesn't exist in my alterntive nick list.,o)
    }
  }
  -
  .set nick to ignore {
    if (!$istok(%ignick,$$?"enter a nickname to ignore:",124)) {
      set %ignick $addtok(%ignick,$!,124)
      echo 3 -a $! will now be ignored!
      return
    }
    echo 3 -a $! has already been ignored.
  }
  -
  .del ignored nick {
    if ($istok(%ignick,$$?"enter a nickname to remove from ignore:",124)) {
      set %ignick $remtok(%ignick,$!,1,124)
      echo 3 -a $! is now removed from my ignore list!
      return
    }
    echo 3 -a $! is not found in the ignore list.
  }
}
on $*:text:$(/\b(\Q $+ $me $+ \E|\Q $+ %altnick $+ \E)\b/iS):#:{
  if (!$istok(%ignick,$nick,32)) && (%alert == on) && ($active != $chan)  {
    echo -a 4[ $+ $time $+ ] $nick said your name in $chan $+ : $1-
    beep 3
  }
}

I've taken the liberty of adding a couple of checks, along with an if statement to ignore added nicknames.

 Respond  
Jethro   -  Aug 14, 2011

I added \Q and \E to make the match literal, because a nickname can contain ^, [, ], etc...and regex will not match them correctly if you leave them out. Maybe not for you, but some people do have nicknames made or prefixed with special characters.

 Respond  
yelow79   -  Aug 14, 2011

Jethro_ there is a problem with the way you did this. first of all

(/\b(\Q $+ $me $+ \E|\Q $+ %altnick $+ \E)\b/iS)

did not need to be changed from

$(/\b( $+ $me $+ | $+ %altnick $+ )\b/iS)

I tested and it works the same either way.

but the real problem is that there now has to be an alternative trigger set in order for this to not go off constantly from people/bots not even saying one of the triggers.

but I also have another question that I hope someone can help me with.

I have added

  .set nick to ignore {
    set %ignick $addtok(%ignick,$$?"enter a nickname to ignore:",124)
    echo 3 -a $! will now be ignored!
  }
  .del ignored nick {
    if ($istok(%ignick,$$?"Enter nickname to delete from ignore list:",124)) {
      set %ignick $remtok(%ignick,$!,1,124)
      echo 3 -a $! will no longer be ignored!
    }
    else {
      $input( $! is not in the ignore list.,o)
    }
  }

so that the whole thing looks like this

menu status,menubar,channel,query {
  Nick Alert
  .set $iif(%alert == on, OFF, ON ) :{
    set %alert $iif(%alert == on,off,on)
    echo 3 -a nickalert is now turned %alert
  }
  .set alt. trigger {
    set %altnick $addtok(%altnick,$$?"enter an alernative nickname here:",124)
    echo 3 -a your alternative nick $! has been added to my alternative list!
  }
  .del alt. trigger {
    if ($istok(%altnick,$$?"Enter an alernative nickname to delete:",124)) {
      set %altnick $remtok(%altnick,$!,1,124)
      echo 3 -a your alternative nick $! has been deleted successfully!
    }
    else {
      $input(The alternative nickname $! is either deleted or doesn't exist in my alterntive nick list.,o)
    }
  }
  .set nick to ignore {
    set %ignick $addtok(%ignick,$$?"enter a nickname to ignore:",124)
    echo 3 -a $! will now be ignored!
  }
  .del ignored nick {
    if ($istok(%ignick,$$?"Enter nickname to delete from ignore list:",124)) {
      set %ignick $remtok(%ignick,$!,1,124)
      echo 3 -a $! will no longer be ignored!
    }
    else {
      $input( $! is not in the ignore list.,o)
    }
  }
}
on $*:text:$(/\b( $+ $me $+ | $+ %altnick $+ )\b/iS):#: {
  if (%alert == on) && ($active $nick != $chan %ignick) {
    echo -a 4[ $+ $time $+ ] $nick said your name in $chan $+ : $1-
    beep 3
  }
}

however I have tried a few different ways and I can't get it to ignore the people in the list

 Respond  
yelow79   -  Aug 13, 2011

I like that Jethro_ . Thank you! Learning is an everyday process.

 Respond  
Jethro   -  Aug 13, 2011

yelow79, your script can be improved a bit so you can add more than one alternative nickname. You don't need to put the control code for color number 3 but simple use echo 3 -a to do the same thing. Also, a delete feature would have been nice:

menu status,menubar,channel,query {
  Nick Alert 
  .set $iif(%alert == on, OFF, ON ) :{
    set %alert $iif(%alert == on,off,on) 
    echo 3 -a nickalert is now turned %alert
  }
  -
  .set alt. trigger {
    set %altnick $addtok(%altnick,$$?"enter an alernative nickname here:",124) 
    echo 3 -a your alternative nick $! has been added to my alternative list!
  }
  -
  .del alt. trigger {
    if ($istok(%altnick,$$?"Enter an alernative nickname to delete:",124)) {
      set %altnick $remtok(%altnick,$!,1,124)
      echo 3 -a your alternative nick $! has been deleted successfully!
    }
    else {
      $input(The alternative nickname $! is either deleted or doesn't exist in my alterntive nick list.,o)
    }
  }
}
on $*:text:$(/\b(\Q $+ $me $+ \E|\Q $+ %altnick $+ \E)\b/iS):#: {
  if (%alert == on) && ($active != $chan) {
    echo -a 4[ $+ $time $+ ] $nick said your name in $chan $+ : $1-
    beep 3
  }
}

Now, you can have as many alternative nicknames added as you wish. The %altnick is added as such: > %altnick nick1|nick2|nick3|nick4|etc..,which will simulate regex's OR operator.
I also have an popup box check to warn if an alternative nickname to be deleted exists or not.

 Respond  
yelow79   -  Aug 13, 2011

@DEAN: I added the alternative nick because many people don't type out my full nick, many of then instead of saying yelow79 will simply put yelow when my nick is yelow79.

@jaytea: I was not aware of the $highlight identifier. I will look into this.

 Respond  
TheWhistler   -  Aug 10, 2011

Thanks Jethro_ works great

 Respond  
Jethro   -  Aug 10, 2011

Whistler, make a custom window and have it echo to it:

if (!$window(@nickalert)) window @nickalert
echo @nickalert 4[ $+ $time $+ ] $nick said your name in $chan $+ : $1-

 Respond  
TheWhistler   -  Aug 10, 2011

any possible way this could go to its own window call @NickAlert
i have a few files that way @Join @Part @Traffic

 Respond  
jaytea   -  Aug 10, 2011

i still don't know why people avoid using mIRC's inbuilt highlight detection ($highlight()) rather than (poorly) reinvent the wheel :P

 Respond  
_Dean_   -  Aug 10, 2011

i still dont know why ppl use "alternative nick" since $me will always return your nickname...
there is no reason to use an alternative nick on the text match

if you change your nick, $me will assume the new value, so alternative nick its not needed

 Respond  
Veritas   -  Aug 10, 2011

Ah I see, It looks much cleaner now indeed :)

 Respond  
yelow79   -  Aug 10, 2011

Thanks to your brilliant idea I made another small change. No more aliases at all. Looks much cleaner now.

 Respond  
yelow79   -  Aug 10, 2011

Good Idea. I will test this and if works properly will edit.

 Respond  
Veritas   -  Aug 10, 2011

Looks nice to me, but maybe you can change the on/off function so you can only see "off" if it's on and "on" if it's off.

So, for example you can change this:

.on: alerts on
.off: alerts off

into this:

.Set $iif(%alert == on, OFF, ON ) :set %alert $iif(%alert == on,off,on) |  echo -a 3nickalert is now turned %alert

Haven't test it yet but you can try, with this you don't even need the alerts alias ;).

Anyway, nice snippet, keep up the good work :)!

 Respond  
Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.