Your loop is fine, why he suggested comparing a nick to being <= to the total number nicks is beyond me.
Your code broke down here...
while ($hget(Hosts,$hfind(Hosts,%a,%xy,w).data) {
shoule have been...
while ($hget(Hosts,$hfind(Hosts,%a,%xy,w).data))
) {
* below are suggestion only....
(1) Free the tables to begin with as from memory the script stops if the table already exists (i might be wrong on that)
(2) $hfind( ???? , * $+ %x $+ *, ? ,w) can be replaced with $hfind( ???? ,%x, ? ,w) ( the %x is formated *!*@somedomain.com already so **!*@somedomain.com* is unlikely to find anything more)
Below is the code i had after debuging the error and adding the suggestions, results before and after suggestion (2) remained the same.
alias CloneScan {
hfree -w Hosts
hfree -w Clones
hmake Hosts 5000
hmake Clones 5000
var %chan = $$1
var %i = 1, %c = 1
while ($nick(%chan,%i)) {
var %s = $address($nick(%chan,%i),2)
if ($hfind(Hosts,%s,0,w).data) {
if (!$hfind(Clones,%s,0,w).data) {
hadd -m Clones %c %s
inc %c
}
}
hadd -m Hosts $nick(%chan,%i) %s
inc %i
}
var %y = 1
while ($hget(Clones,%y)) {
var %a = $hget(Clones,%y)
var %xy = 1
while ($hget(Hosts,$hfind(Hosts,%a,%xy,w).data)) {
echo -a Clone: %xy Nick: $hfind(Hosts,%a,%xy,w).data) Address: $hget(Hosts, $hfind(Hosts,%a,%xy,w).data))
inc %xy
}
inc %y
}
hfree -w Hosts
hfree -w Clones
echo -a Scan Finishes
}
PS : I didnt actually find the output of this overly helpfull, but I guess if its what you needed
