Simple Nick Caller

By ThE ViPeR on Jun 20, 2010

This will notice you whenever your nick is said on any server.
No matter the server it will say the server who your nick was said by the day and the time it was said and what the message was they said.

on *:TEXT:*:#:{
  if ($chan == #services-diagnostics) { halt }
  if ($nick == OperServ) { halt }
  if ($nick == iServ) { halt }
  if (YourNickHere isin $1-) { .notice YourNickHere 15,1(12,1Alert15,1)14,1 Your name was said by 15,1(12,1 $+ $nick $+ 15,1)14,1 on this server 15,1(12,1 $+ $server $+ 15,1) in this room 15,1(12,1 $chan $+ 15,1) 14,1 $time(ddd h:nn.ss TT) 15,1(12,1 $nick $+ 15,1: $1- 12,1) }
  if (YourAlternateNickHere isin $1-) { .notice YourNickHere 15,1(12,1Alert15,1)14,1 Your name was said by 15,1(12,1 $+ $nick $+ 15,1)14,1 on this server 15,1(12,1 $+ $server $+ 15,1) in this room 15,1(12,1 $chan $+ 15,1) 14,1 $time(ddd h:nn.ss TT) 15,1(12,1 $nick $+ 15,1: $1- 12,1) }
}

Comments

Sign in to comment.
Bielie   -  Jun 24, 2010

fixed my last comment. This should work. Nice regex line at the on text jethro :0 =) =[)

 Respond  
Jethro   -  Jun 23, 2010

Bielie, a couple of things to consider:

Your regex will only work if someone calls your name at the first of his or her sentence, meaning they have to call your nick first for your regex to respond. If they they enter your name in the middle of their sentence, the regex won't trigger. That is what the caret sign in regex stands for.

You elseif condtion is incorrect. It should have been:

if ($nick == OperServ || $nick == iServ || $nick == chanserv || $nick == BotServ) {

Without the $nick and space being placed, it's going to be unworkable.

For that matter, you can use $istok or $fintok in place of the use of serveral OR opeators:

elseif ($istok(operserv|iserv|chanserv|botserv,$nick,124)) { halt }

can you notice an address? Why use an address when you can do it as such:

on $*:text:$(/(\s\Q $+ $me $+ \E\b)|(\s\Q $+ $anick $+ \E)\b/iS):#:{
  if (%flood [ $+ [ $nick ] ]) { return }
  set -eu3 %flood [ $+ [ $nick ] ] $nick
  inc %highlight
  notice $me $($+([ $+ [ $nick ] ]),2) highlighted you in $chan $+ . You have been highlighted %highlight times. 
  notice $nick You highlighted $regml(1) $+ . You are number: %highlight $+ . 
}
 Respond  
Bielie   -  Jun 23, 2010

If his script is for a bot he did it right. (talking about the yournickhere)

Cant he just use:

on $*:text:$(/(\s\Q $+ $me $+ \E\b)|(\s\Q $+ $anick $+ \E)\b/iS):#:{
  if (%flood [ $+ [ $nick ] ]) { return }
  set -eu3 %flood [ $+ [ $nick ] ] $nick
  if ($chan == #anychan) { halt }
  elseif ($istok(operserv|iserv|chanserv|botserv,$nick,124)) { halt } 
  else { inc %highlight | notice $me $($+([ $+ [ $nick ] ]),2) highlighted you in $chan $+ . You have been highlighted %highlight times. | notice $nick You highlighted $regml(1) $+ . You are number: %highlight that highlighted $regml(1) $+ . }
}
 Respond  
SnoooP   -  Jun 20, 2010

Yeah I do fully understand what you're saying mate ;)

 Respond  
Jethro   -  Jun 20, 2010

Mmm...hello abcSnooop123

Bam! the script triggers...

I know it's unusual for people to tamper with calling people's nick like that, but some old irc gits will abuse it that way.

I hope you catch my drift.

 Respond  
SnoooP   -  Jun 20, 2010

Jethro I also forgot to mention that:

Let's say someone has a nick called Snooopy while yours is Snooop,
I would find it useful for that reason, its like being called Jethro_ but people just saying Jethro, as an example. :)

 Respond  
Jethro   -  Jun 20, 2010

Ghost-writer, define what you mean by "they do the same thing."

I'll give you some differences between using $istok($me,$1-,32) $istok($1-,$me,32) and if ($me isin $1-) and $+(,$me,)

Then compare them to the use of $regex($1-,/(\s\Q $+ $me $+ \E\b)/iS)

I'm not saying regex is a muti-purpose engine to use everywhere in MSL. There will always be downfall, and nothing is 100% foolproof if you intend to be meticulously picky to find it. That really depends on what you try to achieve to get the best efficiency feasible.

 Respond  
Ghost-writer   -  Jun 20, 2010

jethro all that regex is useless m8. when it comes down to it, they do the same thing and his is shorter.

 Respond  
SnoooP   -  Jun 20, 2010

Sorry Jethro, i'll be good haha :P (You know I was joking)

 Respond  
Jethro   -  Jun 20, 2010

Yeah WorldDMT. $anick, it is!. I edited the code.

Snoop, of all the nick calling script I've tried. Be that with isin, $istok, $fintok, or the one you use in your example $+(,$me,), the regex beats them all, the main reason being that, isin and $+(,$me,) will get triggered if someone has a similar nick as yours.

Let's say someone has a nick called Snooopy while yours is Snooop, (anything that follows before or after), and since they're wild-card prone, the script will respond to either one of you.

Using $istok and $fintok are slightly better, but it's not as good, because if someone says Snooop[!?,], with any punctuation marks placed behind your nick, your script won't get triggered at all.

The final winner is the regex with the word boundary with \Q and \E and \S strip control codes. They will make sure your nick is called precisely as "snooop" with punctuation marks or not, treating any special characters that you have in your nick literal, and not to be wild-card prone.

 Respond  
WorldDMT   -  Jun 20, 2010

AlternateNickHere = $anick

 Respond  
SnoooP   -  Jun 20, 2010

/me slaps jethro
out doing me you douche hahah :P

 Respond  
Jethro   -  Jun 20, 2010

ThE ViPeR, this is not a pastebin, where you randomly post your personal snippet and be done with it. When you submit a snippet, be sure it's suitable for the general public. For starters, you should remove this line:> if ($chan == #services-diagnostics) { halt }

Your overall code can further be improved with regex:

on $*:text:$(/\s\Q $+ $me $+ \E\b|(\s\Q $+ $anick $+ \E)\b/iS):#:{
  if ((!$istok(OperServ iServ,$nick,32)) && ($regml(1) = $anick)) { 
    .notice YourNickHere 15,1(12,1Alert15,1)14,1 Your name $&
      was said by 15,1(12,1 $+ $nick $+ 15,1)14,1 on this $&
      server 15,1(12,1 $+ $server $+ 15,1) in this $&
      room 15,1(12,1 $chan $+ 15,1) 14,1 $&
      $time(ddd h:nn.ss TT) 15,1(12,1 $nick $+ 15,1: $1- 12,1)
  }
  else { .notice YourNickHere 15,1(12,1Alert15,1)14,1 Your name was $&
      said by 15,1(12,1 $+ $nick $+ 15,1)14,1 on this $&
      server 15,1(12,1 $+ $server $+ 15,1) in this room $&
      15,1(12,1 $chan $+ 15,1) 14,1 $time(ddd h:nn.ss TT) 15,1(12,1 $nick $+ 15,1: $1- 12,1) 
  }
}

Use !$istok to exclude the server nick, along with an if-then-else condition.

 Respond  
SnoooP   -  Jun 20, 2010

A few improvements could be made mate, but nice attempt..

You don't need to insert your name, $me is your name.
You don't need to /notice yourself, you can use /echo -a

Example:

on *:text:$($+(*,$me,*)):#:{
  echo -a $nick said your name in ( $+ $chan $+ ) at ( $+ $time $+ ) on ( $+ $network $+ ) $nick Said: $1-
}

That does the same job but it doesn't have any if events, as the on text event checks for your nick being said. that is this part: *on :text:$($+(,$me,)):#:{**

Also for a bit of fun you may want to add something that counts how many times your nickname has been said, for this you would use inc %nickcounter 1, this means that the counter will increase by 1 each time your nickname has been said.

Also I saw you want to make it so some nicknames don't trigger the script, you could add an if statement to prevent this. for exmaple: if ($nick == nick1 || nick2 || nick3 ) { halt }
How ever if you do this you would then need to include the following else { and then another close brace at the end of the script.

And if you would like to turn the script on/off at any given time, you add a menu channel { code and #NickWatch ON and #NickWatch OFF at the beginning and end of the script, you then toggle the script on by right clicking in the channel.. And with the menu now added, you can click and see how many times your nick has been said!

If you do this you end up with something like this:

#nickwatch on
on *:text:$($+(*,$me,*)):#:{
 if ($nick == nick1 || nick2 || nick3 ) { halt }
  else {
 echo -a $nick said your name in ( $+ $chan $+ ) at ( $+ $time $+ ) on ( $+ $network $+ ) $nick Said: $1-
 inc %nickcounter 1
 } 
}
#nickwatch end

menu Channel {
  Nick Watcher
  .Nick Counter: echo -a  My Nickname Has Been Said %nickcounter times
  .Enable: /enable #nickwacth
 .Disable: /disable #nickwatch
}
 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.