mIRC Home    About    Download    Register    News    Help

Print Thread
#114444 14/03/05 03:47 PM
Joined: Jun 2004
Posts: 291
W
Fjord artisan
OP Offline
Fjord artisan
W
Joined: Jun 2004
Posts: 291
how come this doesnt work?
Code:
[color:purple]
alias CloneScan {
  var %chan = $$1
  var %i = 1, %c = 1
  hmake Hosts 5000
  hmake Clones 5000
  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 Hosts
  hfree Clones
  echo -a Scan Finishes
}
[/color]

thanks

#114445 14/03/05 08:51 PM
Joined: Mar 2005
Posts: 212
N
Fjord artisan
Offline
Fjord artisan
N
Joined: Mar 2005
Posts: 212
at a glance your while loop is set to go on forever
granted i dont know much but you might want to do while ($nick(%chan, %i) <= $nick(%chan, 0)
then it runs through the routine until it has looked at everyone in the channel

#114446 14/03/05 10:18 PM
Joined: Sep 2003
Posts: 4,230
D
Hoopy frood
Offline
Hoopy frood
D
Joined: Sep 2003
Posts: 4,230
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.

Code:
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 smile

#114447 14/03/05 10:28 PM
Joined: Jun 2004
Posts: 291
W
Fjord artisan
OP Offline
Fjord artisan
W
Joined: Jun 2004
Posts: 291
haah ^_^
thats great thanks
works perfect now :P

#114448 15/03/05 12:03 AM
Joined: Feb 2004
Posts: 2,019
Hoopy frood
Offline
Hoopy frood
Joined: Feb 2004
Posts: 2,019
Quote:
Your loop is fine, why he suggested comparing a nick to being <= to the total number nicks is beyond me.

Neutronstar == ricky knuckles.

Why he said that is also beyond me... trying to help people is a great thing, though sometimes, if you are really inadequate at something, perhaps one shouldn't bother trying to help.

#114449 15/03/05 03:22 PM
Joined: Jun 2004
Posts: 291
W
Fjord artisan
OP Offline
Fjord artisan
W
Joined: Jun 2004
Posts: 291
any way i can make this script work..without having to /who the channel?

#114450 15/03/05 09:40 PM
Joined: Sep 2003
Posts: 4,230
D
Hoopy frood
Offline
Hoopy frood
D
Joined: Sep 2003
Posts: 4,230
Oh yeah sorry, i forgot to say, i had to do a /who #channel to load the IAL up, when i was debugging it, i was like, WTF whys this person got no $address ?!?!?!?

To answer your question, you could whois everyone in the channel, lol

#114451 21/03/05 08:51 PM
Joined: Jun 2004
Posts: 291
W
Fjord artisan
OP Offline
Fjord artisan
W
Joined: Jun 2004
Posts: 291
lol ok thanks ^^


Link Copied to Clipboard