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:
turn the nick alert on or off
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)
You can set a nick to ignore such as a bot that repeats your nick constantly.
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
}
}
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
}
}
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.
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.
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.
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.
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
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.
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 :)!