Seen nick script

By [DX] on Mar 10, 2010

Paste to remote (ALT + R)

Seen nick script uses hash table to store nicks used by certain address. When user joins, script returns nicks used before with that address. If nick is already added in table, it will remove it, than overwrite it again, to avoid duplicated items.
Can be used with all versions of mIRC which supports hash tables.

Script suggested by: jecket

Thanks on your suggestions.

Written at: 11 March 2010 00:45

Update 1#: 11 March 2010 13:36

  • Added NICK event for tracking newnick when nick is changed.

Update 2#: 13 March 2010 23:03

  • Added options to show nicks when nick is changed.
  • Added $numtok to join and nick events in echo function to show number of used nicks.

Update 3#: 14 March 2010 14:56

  • Added statement to not show echo command when you change nick

Update 4#: 22 March 2010 01:53

  • Added /seen nickname alias - Suggested by ericfx
  • Fixed several bugs
on *:JOIN:#: {
  if $hget(seen_nick) == $null { hmake seen_nick 10000 }
  hadd seen_nick $address($nick,0) $+($remtok($hget(seen_nick, $address($nick,0)), $nick, 32), $chr(32), $nick)
  if $numtok($hget(seen_nick, $address($nick,0)), 32) > 1 && $numtok($hget(seen_nick, $address($nick,0)), 32) =< 30 {
    echo $chan $timestamp -- $nick used these nicks earlier: $remtok($hget(seen_nick, $address($nick,0)), $nick, 32) - Nicks: $calc($numtok($hget(seen_nick, $address($nick,0)), 32) - 1)
  }
}

on *:NICK: {
  if $address($newnick,0) != $null {
    hadd seen_nick $address($newnick,0) $+($remtok($hget(seen_nick, $address($newnick,0)), $newnick, 32), $chr(32), $newnick)
  }
  if $numtok($hget(seen_nick, $address($newnick,0)), 32) > 2 && $numtok($hget(seen_nick, $address($newnick,0)), 32) =< 30 && $address($newnick,0) != $null && $newnick != $me {
    var %.c 1
    while $comchan($newnick,0) >= %.c {
      echo $comchan($newnick,%.c) $timestamp -- $newnick used these nicks earlier: $remtok($remtok($hget(seen_nick, $address($newnick,0)), $newnick, 32), $nick, 32) - Nicks: $calc($numtok($hget(seen_nick, $address($newnick,0)), 32) - 2)
      inc %.c
    }
  }
}
alias seen {
  if !$1 { echo $color(action) * /echo: insufficient parameters }
  else {
    echo $active $timestamp -- $1 used these nicks earlier: $remtok($hget(seen_nick, $address($1,0)), $1, 32) - Nicks: $calc($numtok($hget(seen_nick, $address($1,0)), 32) - 1)
  }
}

Comments

Sign in to comment.
cptpan   -  Jul 11, 2012

Nah it was actually a fuck up, some shit got pasted to aliases and it just raped the client.

 Respond  
[DX]   -  Jul 11, 2012

I guess you don't have enough virtual memory..

 Respond  
cptpan   -  Jul 11, 2012

This dumb fukking thing freezes my bots client

 Respond  
ericfx   -  Mar 21, 2010

Thanks a lot DX!

 Respond  
[DX]   -  Mar 12, 2010

Ah ok :)

 Respond  
xDaeMoN   -  Mar 12, 2010

Yeah, sorry. My last comment was meant for Trill.

 Respond  
napa182   -  Mar 11, 2010

lol I only helped trill out a lil bit. Not enough to take any credit.

Also nice work [DX]
it's a useful bit of code.

But id still use $wildsite rather then $address($nick,0) and also i would save the hash, but hey thats just me. ;x

 Respond  
Jethro   -  Mar 11, 2010

I think xDaeMon's comment was meant for trill, which may imply, "give credit where it's due." If I misconstrue the intention of his comment, I apologize.

 Respond  
[DX]   -  Mar 11, 2010

?

 Respond  
xDaeMoN   -  Mar 11, 2010

You might want to update the snippet itself with what you noted on your comment. ;)

 Respond  
trill   -  Mar 11, 2010

haha thanks napa and thanks again for the help.

 Respond  
napa182   -  Mar 11, 2010

lol you two sound like an old bickering married couple....

Oh an nice rewrite Trill ;x

 Respond  
Jethro   -  Mar 11, 2010

If I tried to demean you, I'd not have addressed you by your name, "Korvin," along with a polite wording of "please" in response to your post. Regardless, I don't need to put up with your name-calling. Please watch your tone first before telling me to watch mine.

 Respond  
Korvin   -  Mar 11, 2010

regardless of my sensitivity, you don't need to correct in such a demeaning tone.

 Respond  
Jethro   -  Mar 11, 2010

Geez Korvin, when would you learn to stop being oversensitive, melodramatic about people's comments? You give me such a bad taste in my mouth when you incite yourself with the name-calling. You must be very insecure while being online.

 Respond  
Korvin   -  Mar 11, 2010

http://www.hawkee.com/snippet/5773/

Korvin, you're right about hash data being saved on the ram (temporarily, that is), but NOT for when mirc is closed and then all the data gets lost. /hsave is needed as xDaeMoN stated. Please get the facts straight. what was intended was that upon disconnecting hashes aren't saved, i worded that badly, either way, that doesn't account for you being a douchebag, any word on why that's occuring? you seem to know everything about anything and are willing to defend it violently, might as well explain why you're such a faggot.

 Respond  
[DX]   -  Mar 11, 2010

Nick event added. :)

 Respond  
Jethro   -  Mar 11, 2010

Nice work, but you should add an on nick event, as suggested, to make this script complete in detecting nick changes to reflect the "last seen" users.

 Respond  
trill   -  Mar 11, 2010

hi i hope you don't mind me changing it a little.

#seen_nick on
on !*:JOIN:#: {
  hadd -m seen_nick $wildsite $+($remtok($hget(seen_nick,$wildsite),$nick,32),$chr(32),$nick)
  if ($numtok($hget(seen_nick,$wildsite),32) > 1) {
    echo $chan $timestamp -- $nick used these nicks earlier: $remtok($hget(seen_nick,$wildsite),$nick,32)
  }
}
on !*:NICK: { hadd -m seen_nick $wildsite $+($remtok($hget(seen_nick,$wildsite),$newnick,32),$chr(32),$newnick) }
alias -l saveseen_nick { .hsave seen_nick $qt($scriptdirseen_nick.hsh) }
alias -l loadseen_nick { 
  if (!$hget(seen_nick)) { .hmake seen_nick 10000 }
  elseif ($exists($scriptdirseen_nick.hsh)) { .hload seen_nick $qt($scriptdirseen_nick.hsh) } 
}
on *:disconnect:{ $saveseen_nick } 
on *:exit:{ $saveseen_nick }
on *:start:{ $loadseen_nick }
on *:connect:{ $loadseen_nick }
#seen_nick end
menu nicklist {
  -
  .Turn Seen Nick $iif($group(#seen_nick) = On,Off,On): $iif($group(#seen_nick) = On,.disable,.enable) #seen_nick | echo -a $timestamp -- Seen Nick is $group(#seen_nick)
  . $iif($numtok($hget(seen_nick,$address($$1,2)),32) <= 1,$style(2)) Check $$1's Previous Nicks: echo -a $timestamp -- $$1 used these nicks: $remtok($hget(seen_nick,$address($$1,2)),$1,32)
  . $iif($numtok($hget(seen_nick,$address($$1,2)),32) <= 1,$style(2)) Delete $$1's Previous Nicks: echo -a $timestamp -- $$1's Previous Nicks Are Now Deleted. | hdel seen_nick $address($$1,2)
  -
}

Edit: added the nick event.

 Respond  
Jethro   -  Mar 11, 2010

Korvin, you're right about hash data being saved on the ram (temporarily, that is), but NOT for when mirc is closed and then all the data gets lost. /hsave is needed as xDaeMoN stated. Please get the facts straight.

 Respond  
Korvin   -  Mar 11, 2010

hash, being saved on your ram, only is lost upon computer shutdown. tryit

 Respond  
xDaeMoN   -  Mar 10, 2010

AFAIK, hashes are not retained when you exit mirc. Which is why you need to use /hsave so you can save them and access the data later.

 Respond  
Korvin   -  Mar 10, 2010

Hashes are retained whether mirc is running or not, the problem lies in restarting :)

 Respond  
Jethro   -  Mar 10, 2010

You may want to /hsave your hash tables upon exiting and disconnecting...

 Respond  
TheImrac   -  Mar 10, 2010

Probably because hawkee is slow once in a while and he spammed post. But I would recommend adding a on nick event, so when they change their nick, it will add their new nick.

 Respond  
Cados   -  Mar 10, 2010

Why'd you post this 4 times?

 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.