mIRC Home    About    Download    Register    News    Help

Print Thread
Page 2 of 2 1 2
Garou #170373 07/02/07 07:01 PM
Joined: Dec 2006
Posts: 80
Babel fish
Offline
Babel fish
Joined: Dec 2006
Posts: 80
your statement here ~~> on *:open:?:{


...also refers to a second while loop within its commands

spamdetect $nick, must be changed. mIRC cant execute the second loop when the first one is still running, it will crash (freeze) you every time guaranteed.

Ill be back tommorrow my friend smile


Scripto ---- Life is about the relationships. The correct code being: $replace($them,$you,$me)
Scripto #170410 08/02/07 02:55 PM
Joined: Dec 2006
Posts: 80
Babel fish
Offline
Babel fish
Joined: Dec 2006
Posts: 80
Give this a shot.

You will have to test it...

Let me know what errors you get, we will go from there.


Code:

on *:start:{
  if !$hget(BadWords) { .hmake BadWords 10 }
  if $exists(BadWords.hsh) { .hload BadWords BadWords.hsh }
}
on *:exit:{
  .hsave -o BadWords BadWords.hsh
}
on *:disconnect:{
  .hsave -o BadWords BadWords.hsh
}

menu menubar {
  -
  Private Offensive Message                      
  .Turn $iif($hget(BadWords,0),Off,On) : .hadd -m BadWords 0 $iif($hget(BadWords,0),$false,$true)
  .-
  .Add a word : .hadd -m BadWords $$?="Bad Word to be added" $true
  .-
  .Remove a word : .hdel BadWords $$?="Bad Word to be removed"
  .-
  .List Spam Words : .bad_words_list
  .-
}
alias -l bad_words_list {
  var %a = 1, %b = $hget(BadWords,0).item
  unset %badwords
  while %a <= %b {
    set %badwords $addtok(%badwords,$hget(BadWords,%a).item,32)
    if ($calc($numtok(%badwords,32) + $len(%badwords)) > 900) {
      echo -a $replace(%badwords,$chr(32),$+($chr(44),$chr(32)))
      unset %badwords
    }
    inc %a
  }
  if %badwords {
    echo -a $replace(%badwords,$chr(32),$+($chr(44),$chr(32)))
    unset %badwords
  }
}
on *:open:?:{
  if ($ulevel != op) && ($hget(BadWords,0)) {
    var %cnt = 1
    while (%cnt <= $hget(BadWords,0).item) {
      if ($hget(BadWords,%cnt).item isin $1-) {
        close -m $nick
        .timer. $+ $nick 1 1 spamdetect $nick
        halt
      }
      inc %cnt      
    }
  }
}

on ^*:notice:*:?: {
  var %oknames = ChanServ NickServ MemoServ
  if ($nick !isin %oknames) && ($hget(BadWords,0)) {
    var %cnt = 1
    while (%cnt <= $hget(BadWords,0).item) {
      if ($hget(BadWords,%cnt).item isin $1-) {
        .timer. $+ $nick 1 1 spamdetect $nick
        halt
      }
      inc %cnt 
    }
  }
}


alias spamdetect {
  var %a = $comchan($1,0).op
  while (%a > 0) {
    ban -ku3600 $comchan($1,%a).op $1 2 14Private Offensive Language 
  }
  dec %a
}  
 


Copy and paste the whole thing, i did change the spamdetect alias a little... its on a timer now, so it wont crash your mIRC.

Ill try to watch the board later on, I have some calculus homework to attend to


Scripto ---- Life is about the relationships. The correct code being: $replace($them,$you,$me)
Scripto #170411 08/02/07 03:10 PM
Joined: Aug 2006
Posts: 469
G
Garou Offline OP
Fjord artisan
OP Offline
Fjord artisan
G
Joined: Aug 2006
Posts: 469
ok thx,
got this error
* /ban: invalid parameters (line 72, dialog55.op)

Last edited by Garou; 08/02/07 03:19 PM.
Garou #170412 08/02/07 03:25 PM
Joined: Dec 2006
Posts: 80
Babel fish
Offline
Babel fish
Joined: Dec 2006
Posts: 80
Ok...

try changing your spamdetect alias to this

Code:

alias spamdetect {
  var %a = $comchan($1,0).op
  while (%a > 0) {
    ban -ku3600 $comchan($1,%a).op $1 14Private Offensive Language 
  }
  dec %a
}  

 


Im not particularly fond of using a while loop to ban and kick, but that is the format you had, so that is what we will use for now. Loops are fast, it could have the potential to flood you off of the server. I prefer to use a .timer -m 250 on an alias to kick, it slows things down a little. But for now, lets just use what you have until it doesnt work... lol


Scripto ---- Life is about the relationships. The correct code being: $replace($them,$you,$me)
Scripto #170413 08/02/07 03:27 PM
Joined: Aug 2006
Posts: 469
G
Garou Offline OP
Fjord artisan
OP Offline
Fjord artisan
G
Joined: Aug 2006
Posts: 469
same error

* /ban: invalid parameters (line 72, dialog55.op)

Garou #170414 08/02/07 03:33 PM
Joined: Dec 2006
Posts: 80
Babel fish
Offline
Babel fish
Joined: Dec 2006
Posts: 80
hmm, i havent installed 6.21 (shame on me) but im not sure what the dialog55.op error is referring to. There must be an issue with the $comchan identifier... let me write this loop slightly different, to see if we can go around it.


Scripto ---- Life is about the relationships. The correct code being: $replace($them,$you,$me)
Garou #170415 08/02/07 03:36 PM
Joined: Dec 2006
Posts: 80
Babel fish
Offline
Babel fish
Joined: Dec 2006
Posts: 80
Code:
 
alias spamdetect {
  var %a = $comchan($1,0)
  while (%a > 0) {
    if ($me isop $comchan($1,%a)) {
      ban -ku3600 $comchan($1,%a) $1 14Private Offensive Language 
    }
    dec %a
  } 
}


Scripto ---- Life is about the relationships. The correct code being: $replace($them,$you,$me)
Scripto #170416 08/02/07 03:43 PM
Joined: Aug 2006
Posts: 469
G
Garou Offline OP
Fjord artisan
OP Offline
Fjord artisan
G
Joined: Aug 2006
Posts: 469
Cool its working now but its not exempting op anyway to exempt op?

Garou #170419 08/02/07 04:26 PM
Joined: Dec 2006
Posts: 80
Babel fish
Offline
Babel fish
Joined: Dec 2006
Posts: 80
you mean to not kick other ops?

Code:
alias spamdetect {
  var %a = $comchan($1,0)
  while (%a > 0) {
    if ($me isop $comchan($1,%a)) && (($1 !isop $comchan($1,%a)) || ($1 !ishop $comchan($1,%a)))  {
      ban -ku3600 $comchan($1,%a) $1 14Private Offensive Language 
    }
    dec %a
  } 
}
 


This is set up so that ($me isop $chan) and when $nick does not have (ops or halfops)


Scripto ---- Life is about the relationships. The correct code being: $replace($them,$you,$me)
Scripto #170420 08/02/07 04:31 PM
Joined: Aug 2006
Posts: 469
G
Garou Offline OP
Fjord artisan
OP Offline
Fjord artisan
G
Joined: Aug 2006
Posts: 469
Thank you very much bro, All is working fine :P

Garou #170421 08/02/07 04:34 PM
Joined: Dec 2006
Posts: 80
Babel fish
Offline
Babel fish
Joined: Dec 2006
Posts: 80
cool cool

youre welcome


Scripto ---- Life is about the relationships. The correct code being: $replace($them,$you,$me)
Scripto #170422 08/02/07 04:38 PM
Joined: Oct 2006
Posts: 342
L
Fjord artisan
Offline
Fjord artisan
L
Joined: Oct 2006
Posts: 342
Quote:
(($1 !isop $comchan($1,%a)) || ($1 !ishop $comchan($1,%a)))


why not use

Code:
$1 isreg $comchan($1,%a)


Code:
alias spamdetect {
  var %i = 1
  if $comchan($nick,0) {
    while $comchan($nick,%i) {
      var %c = $v1
      if $me isop %c && $nick isreg %c { ban -ku600 %c $nick 2  14Private Offensive Language  }
      inc %i
    }
  }
}


learn learn learn
learn3r #170423 08/02/07 04:43 PM
Joined: Dec 2006
Posts: 80
Babel fish
Offline
Babel fish
Joined: Dec 2006
Posts: 80
that would work smile

$nick would have to be $1 though, $nick is evalutated directly in the original script and its identifying value would be lost in transition from timer to alias.


Scripto ---- Life is about the relationships. The correct code being: $replace($them,$you,$me)
Scripto #170521 10/02/07 01:30 AM
Joined: Oct 2006
Posts: 342
L
Fjord artisan
Offline
Fjord artisan
L
Joined: Oct 2006
Posts: 342
Code:
on *:start:{
  if !$hget(BadWords) { .hmake BadWords 10 }
  if $exists(BadWords.hsh) { .hload BadWords BadWords.hsh }
}
on *:exit:{
  .hsave -o BadWords BadWords.hsh
}
on *:disconnect:{
  .hsave -o BadWords BadWords.hsh
}

menu menubar {
  -
  Private Offensive Message
  .Turn $iif($hget(BadWords,0),Off,On) : .hadd -m BadWords 0 $iif($hget(BadWords,0),$false,$true)
  .-
  .Add a word : .hadd -m BadWords $$?="Bad Word to be added" $true
  .-
  .Remove a word : .hdel BadWords $$?="Bad Word to be removed"
  .-
  .List Spam Words : .bad_words_list
  .-
}
alias -l bad_words_list {
  var %a = 1, %b = $hget(BadWords,0).item
  unset %badwords
  while %a <= %b {
    set %badwords $addtok(%badwords,$hget(BadWords,%a).item,32)
    if ($calc($numtok(%badwords,32) + $len(%badwords)) > 900) {
      echo -a $replace(%badwords,$chr(32),$+($chr(44),$chr(32)))
      unset %badwords
    }
    inc %a
  }
  if %badwords {
    echo -a $replace(%badwords,$chr(32),$+($chr(44),$chr(32)))
    unset %badwords
  }
}
on *:open:?:{
  if ($ulevel != op) && ($hget(BadWords,0)) {
    var %cnt = 1
    while (%cnt <= $hget(BadWords,0).item) {
      if ($hget(BadWords,%cnt).item isin $1-) {
        close -m $nick
        .timer. $+ $nick 1 1 spamdetect
        halt
      }
      inc %cnt
    }
  }
}
on ^*:notice:*:?: {
  var %oknames = ChanServ NickServ MemoServ
  if ($nick !isin %oknames) && ($hget(BadWords,0)) {
    var %cnt = 1
    while (%cnt <= $hget(BadWords,0).item) {
      if ($hget(BadWords,%cnt).item isin $1-) {
        .timer. $+ $nick 1 1 spamdetect
        halt
      }
      inc %cnt
    }
  }
}
alias spamdetect {
  var %i = 1
  if $comchan($nick,0) {
    while $comchan($nick,%i) {
      var %c = $v1
      if $me isop %c && $nick isreg %c { ban -ku600 %c $nick 2  14Private Offensive Language  }
      inc %i
    }
  }
}


learn learn learn
learn3r #170524 10/02/07 05:39 AM
Joined: Dec 2006
Posts: 80
Babel fish
Offline
Babel fish
Joined: Dec 2006
Posts: 80
"$nick" has to be "$1" in the spamdetect alias... all the way through it. Otherwise it will not identify. The information in "$nick" is lost in the transition from timer to alias.

The isreg identifier wont moderate voiced users. He said he wanted only op exempt and isreg would do that, however, it would not include voiced users on the channel. It would result in the same length of that line to catch voices as well, which is why i submitted it that way.


Scripto ---- Life is about the relationships. The correct code being: $replace($them,$you,$me)
Scripto #170583 11/02/07 10:15 AM
Joined: Oct 2006
Posts: 342
L
Fjord artisan
Offline
Fjord artisan
L
Joined: Oct 2006
Posts: 342
Code:
"$nick" has to be "$1" 


did you tried it and didn't worked?


learn learn learn
learn3r #170606 11/02/07 05:05 PM
Joined: Dec 2006
Posts: 80
Babel fish
Offline
Babel fish
Joined: Dec 2006
Posts: 80


No, I did not test it, identifiers have always been formatted in that manner. It will not work as $nick.

$nick will not retain its value through the transition of time into the .timer's command when set up like this. It will retain it within the original script, but once you use a timer for a custom alias like this, the value of "$nick" is lost and becomes "$1" to the custom alias. Once that timer is set... the value of $1 is filled to that specific timer alias command, until that timer is either performed, or reset, or shut off.

In other words, (I'll see if i can explain it a little better) the value of $nick is filled when an event occurs. (join, notice, part.. etc. etc) While commands are being performed under that event, directly in that script, $nick will have whatever value it was filled with. However, when you leave the event, and go onto an alias with a timer (which in this case is 'spamdetect'...and it had to be a timer, to break out of the while loop, because spamdetect is a second loop, two 'while' loops cant operate at the same time)

mIRC has no idea what $nick youre talking about... it must drop it, in case other events occur.

$nick only holds 1 value within mIRC at a single time. So for instance, if I had said .timer 1 25 spamdetect $nick... And another event occured like a join or a part or a quit, that needed to re-fill $nick with information, then spamdetect would be kicking the newly filled information of $nick. That is why mIRC is set up this way. It stops 'lines' from being crossed. It would have to retain the value of $nick until that timer went off twenty-five full seconds later, It doesnt keep track of it as $nick, because the information was identified as $1, to the alias to free up the $nick identifier.

Try it out, write a short alias that does something simple like echo something....

Code:

on ^*:JOIN:#:{
   echo -a here is the event value of nick ~~> $nick 
  .timer.testnick 1 5 nickinfo $nick
}
alias nickinfo { 
  echo -a here is the info of nick ~~> $nick 
  echo -a here is the info of string 1 ~~~> $1 
}

 


nickinfo will retain whatever $1 is, and/or $2 or $3... etc.

identifiers work this way, try it with $chan and $nick both.

Code:
 
on ^*:JOIN:#:{
   echo -a here is the event value of nick and chan ~~> $nick joined $chan
  .timer.testnick 1 5 nickinfo $nick $chan
}
alias nickinfo { 
  echo -a here is the info of nick and channel ~~> $nick joined $chan
  echo -a here is the info of string 1 and string 2~~~> $1 joined $2
}





Scripto ---- Life is about the relationships. The correct code being: $replace($them,$you,$me)
Scripto #170612 11/02/07 06:51 PM
Joined: Oct 2006
Posts: 342
L
Fjord artisan
Offline
Fjord artisan
L
Joined: Oct 2006
Posts: 342
Code:
.timer.testnick 1 5 nickinfo $nick



i didn't use
spamdetect $nick
spamdetect only and it's working


learn learn learn
learn3r #170665 12/02/07 04:28 PM
Joined: Dec 2006
Posts: 80
Babel fish
Offline
Babel fish
Joined: Dec 2006
Posts: 80
I just tested this, using only an alias with no identifier behind it, and the same result occurs, the information is lost. It does not work. $nick must be $1 or the parameter is empty.

Try the two examples I posted. $nick returns $null after the timer, and $1 returns what was in $nick. $nick will not be re-evaluated in the format I explained smile

$1 is referred to as the parameter string of an alias.

type /help aliases


Scripto ---- Life is about the relationships. The correct code being: $replace($them,$you,$me)
Scripto #170675 12/02/07 07:02 PM
Joined: Aug 2006
Posts: 469
G
Garou Offline OP
Fjord artisan
OP Offline
Fjord artisan
G
Joined: Aug 2006
Posts: 469
Thx.

Page 2 of 2 1 2

Link Copied to Clipboard