mIRC Home    About    Download    Register    News    Help

Print Thread
#111910 19/02/05 11:01 PM
Joined: Dec 2004
Posts: 43
M
Ameglian cow
OP Offline
Ameglian cow
M
Joined: Dec 2004
Posts: 43
I tried to write the following script but when I tried to test it, mirc crashes. is there something wrong with it or is there something wrong with mirc?
Code:
 
on *:nick:{ 
  if *666* iswm $newnick {
    var %i = i
    var %x = $comchan($newnick,1)
    while (%x) {
      if $me isop %x { ban -k %x $newnick 2 testing }
      inc %i
      %x = $comchan($newnick,%i)   
    }
  }
}
 

Joined: Jun 2003
Posts: 5,024
M
Hoopy frood
Offline
Hoopy frood
M
Joined: Jun 2003
Posts: 5,024
Nothing's wrong with your mIRC, but your while loop would cause it to crash smile

Try:

on !*:NICK:{
if (*666* iswm $newnick) {
var %i = 0
while (%i < $comchan($newnick,0)) {
inc %i
ban -ku60 $comchan($newnick,%i) $newnick 2 Testing
}
}
}


Regards,


Mentality/Chris
Joined: Nov 2003
Posts: 2,327
T
Hoopy frood
Offline
Hoopy frood
T
Joined: Nov 2003
Posts: 2,327
Code:
on !*:nick:{
  if (666 isin $newnick) {
    var %i = 1
    while (%i &lt;= $comchan($newnick,0)) {
      if ($comchan($newnick,%i).op) { ban -k $comchan($newnick,%i) $newnick 2 testing }
      inc %i
    }
  }
}


New username: hixxy
Joined: Dec 2004
Posts: 43
M
Ameglian cow
OP Offline
Ameglian cow
M
Joined: Dec 2004
Posts: 43
is there a way to ban only the nickname and not the IP address? confused

Joined: Nov 2003
Posts: 2,327
T
Hoopy frood
Offline
Hoopy frood
T
Joined: Nov 2003
Posts: 2,327
Remove the 2 before 'testing'.


New username: hixxy
Joined: Dec 2004
Posts: 43
M
Ameglian cow
OP Offline
Ameglian cow
M
Joined: Dec 2004
Posts: 43
well that didn't work either:

[13:14] * Morgan sets mode: +b herbz666!*Herbster@E6E243FF.BDE2038E.565FF36F.IP

Joined: Nov 2003
Posts: 2,327
T
Hoopy frood
Offline
Hoopy frood
T
Joined: Nov 2003
Posts: 2,327
I forgot that /ban does a /userhost on the user before banning them, you'll have to use:

Code:
mode $comchan($newnick,%i) +b $newnick
kick $comchan($newnick,%i) $newnick testing.


New username: hixxy
Joined: Dec 2004
Posts: 43
M
Ameglian cow
OP Offline
Ameglian cow
M
Joined: Dec 2004
Posts: 43
thanks it worked! laugh

Joined: Mar 2004
Posts: 359
L
Fjord artisan
Offline
Fjord artisan
L
Joined: Mar 2004
Posts: 359
usually you can halt the script thats making your mirc freeze up with ctrl+break

Joined: Nov 2004
Posts: 332
R
Fjord artisan
Offline
Fjord artisan
R
Joined: Nov 2004
Posts: 332
or /break providing you can type it
you should definitly familiarize yourself with breaking loops before trying to use while


The Kodokan will move you, one way or another.
Joined: Feb 2004
Posts: 2,019
Hoopy frood
Offline
Hoopy frood
Joined: Feb 2004
Posts: 2,019
You can't type /break since mIRC is busy looping infinitely.

/break is an mirc command that can be used within a script in a while loop, but does not provide the same functionality as ctrl+break does.


Gone.
Joined: Nov 2004
Posts: 332
R
Fjord artisan
Offline
Fjord artisan
R
Joined: Nov 2004
Posts: 332
Quote:

or type /break providing you can

ive broken loops with /break
like once but ive done it


The Kodokan will move you, one way or another.
Joined: Feb 2004
Posts: 2,019
Hoopy frood
Offline
Hoopy frood
Joined: Feb 2004
Posts: 2,019
Impossible.

See for yourself: //while 1 { }

You can type /break as many times as you want grin

Btw before you say "it was other code"...an infinite loop is an infinite loop, doesn't matter what code caused it.


Gone.
Joined: Nov 2003
Posts: 2,327
T
Hoopy frood
Offline
Hoopy frood
T
Joined: Nov 2003
Posts: 2,327
Sorry, but that's not possible.
mIRC doesn't display keyboard input in the middle of a loop, nor does it interpret scripts other than that in the middle of the loop.

See for yourself:

1. type //while 1 { }
2. type /break (Don't press enter)
3. wait for about a second
4. hit ctrl+break

The second mIRC displays "* Break: command halted" /break will show up in the editbox.


New username: hixxy

Link Copied to Clipboard