Alias tracker (AKA)
Platform: mIRC
Published Mar 16, 2007
Updated Jan 02, 2009
Due to the high number of problems people encountered with the updated version of this script, I have deleted that version and reposted the original code. I do plan on bringing the code back to the level of the updated code regarding things like limiting the number of nicks tracked per address, and how/where the information is displayed, but I will be testing the code more thoroughly this time before posting.
Code updated to include a number of features that have been requested, both directly and indirectly.
For those of you who use the original code, the new one is 100% compatable with the storage method of the old code.
Added the following options:
1) Ability to turn on/off the echo when a person joins
2) Menu selection to see the aliased nicks
3) Option to limit number of nicks stored per address
4) Ability to ask in channel or via pm for the aliases for one or more nicks
5) Ability to send the command to show the aliases directly from the bot.
Removed limitation that occasionally did not set a nick to an address.
raw 366:*:{
.who $2
}
raw 352:*:{
.hadd -m AKA $4 $addtok($hget(AKA,$4),$6,32)
if %aka.auto {
echo 4 -t $2 $6 aka $replace($remtok($hget(AKA,$4),$6,1,32),$chr(32),$+($chr(44),$chr(32)))
}
if ($numtok($hget(AKA,$4),32) > $hget(AKA,0)) && ($v2 isnum 1-) {
.hadd -m AKA $4 $gettok($hget(AKA,$4),2-,32)
}
haltdef
}
on *:nick:{
var %a = $ial($nick,0)
while %a {
var %address = $ial($nick,%a)
.hadd -m AKA %address $addtok($hget(AKA,%address),$newnick,32)
if ($numtok($hget(AKA,%address),32) > $hget(AKA,0)) && ($v2 isnum 1-) {
.hadd -m AKA %address $gettok($hget(AKA,%address),2-,32)
}
dec %a
}
}
on *:exit:{
.hsave -o AKA AKA.hsh
}
on *:disconnect:{
.hsave -o AKA AKA.hsh
}
on *:start:{
if !$hget(AKA) { .hmake AKA 100 }
if $exists(AKA.hsh) { .hload AKA AKA.hsh }
}
ctcp *:version:*:{
ctcpreply $nick Version Alias Tracker 01.02.2009 by Russel Bairstow
}
menu * {
Auto-Display on join $iif(%AKA.auto,Off,On) : set %aka.auto $iif(%aka.auto,$false,$true)
Number of nicks per address currently $iif($hget(AKA,0),limited to $v1,Unlimited) : limit
}
menu nicklist {
Show alternative nicks : show $me show $iif($1,$1-,$$input(Space or comma separate multiple nicks,e,Enter nick(s) to be searched for))
}
alias -l limit {
.hadd -m AKA 0 $$input(Use 0 for no limit,e,Maximum number of nicks per address,$iif($hget(0),$v1,0))
var %a = $hget(AKA,0).item
while %a {
var %aka.address = $hget(AKA,%a).item
if ($numtok($hget(AKA,%aka.address),32) > $hget(AKA,0)) && ($v2 isnum 1-) {
.hadd -m AKA %aka.address $gettok($hget(AKA,%aka.address),$+($v1,-),32)
}
dec %a
}
}
on *:text:*:*:{
show $iif($chan,$chan,$nick) $1-
}
on *:input:*:{
show $iif($chan,$chan,$me) $1-
}
alias -l show {
var %aka.display = $1
tokenize 32 $strip($2-)
if !*show* iswm $1 {
if !$2 {
$iif(%aka.display ischan,.notice,.msg) $nick I need a nick to reference to find the known aliases (if any)
}
else {
var %aka.nicks = $replace($2-,$chr(44),$chr(32)), %a = 1, %b = $numtok(%aka.nicks,32)
while %a <= %b {
var %aka.nick = $gettok(%aka.nicks,%a,32), %c = $hfind(AKA,$+(*,%aka.nick,*),0,w).data, %aka
while %c {
var %aka.temp.nicks = $hget(AKA,$hfind(AKA,%aka.nicks,%c,w).data), %e = $numtok(%aka.temp.nicks,32)
while %e {
%aka = $addtok(%aka,$gettok(%aka.temp.nicks,%e,32),32)
dec %e
}
dec %c
}
%aka = $remtok(%aka,%aka.nick,1,32)
.msg %aka.display $iif(%aka,%aka.nick AKA $sorttok(%aka,32),No aliases for %aka.nick found)
}
inc %a
}
}
}