mIRC Home    About    Download    Register    News    Help

Print Thread
Requesting script #182706 13/08/07 03:35 PM
Joined: Aug 2006
Posts: 469
G
Garou Offline OP
Fjord artisan
OP Offline
Fjord artisan
G
Joined: Aug 2006
Posts: 469
Can someone make a nonsense nick kick using regex to ban on join and on change to newnick?
Exemple: wgkp or qznr so ban nicks with 4 big letters or more?
Well dosent have to be regex but whatever you think is better.

Last edited by Garou; 13/08/07 03:39 PM.
Re: Requesting script [Re: Garou] #182714 13/08/07 05:16 PM
Joined: Jan 2004
Posts: 509
L
LostShadow Offline
Fjord artisan
Offline
Fjord artisan
L
Joined: Jan 2004
Posts: 509
alias israndom { var %c = 1 | var %count = 0 | while (%c <= $len($1)) { if ($isconsonant($mid($1,%c,1))) { inc %count } | else { set %count 0 } | if (%count >= 4) { return $true } | inc %c } | return $false }

alias isconsonant { var %consonant = bcdfghjklmnpqrstvwxyz | return $iif($1 isin %consonant,$true,$false) }

on @*:JOIN:#:if $israndom($nick) { ban -k # $nick 2 Random nick. }

Re: Requesting script [Re: Garou] #182715 13/08/07 05:25 PM
Joined: Nov 2006
Posts: 1,559
H
Horstl Offline
Hoopy frood
Offline
Hoopy frood
H
Joined: Nov 2006
Posts: 1,559
This thread is a related request (regarding nonsense nick detection): click

Re: Requesting script [Re: LostShadow] #182721 13/08/07 07:44 PM
Joined: Aug 2006
Posts: 469
G
Garou Offline OP
Fjord artisan
OP Offline
Fjord artisan
G
Joined: Aug 2006
Posts: 469
Thx it works fine....Anyway it can be turn on/off ?

Re: Requesting script [Re: Garou] #182722 13/08/07 07:59 PM
Joined: Nov 2006
Posts: 1,559
H
Horstl Offline
Hoopy frood
Offline
Hoopy frood
H
Joined: Nov 2006
Posts: 1,559
Use e.g. a group arround the on join event:
Code:
#nonsense off
on @*:JOIN:#: {
  ...stuff...
}
#nonsense end


Then, you can add a menu definition to toggle that group:
Code:
menu channel {
  kick nonsense nicks $+($chr(91),$group(#nonsense),$chr(93))
  .$iif(($group(#nonsense) == on),$style(1)) on : .enable #nonsense 
  .$iif(($group(#nonsense) == off),$style(1)) off : .disable #nonsense 
}


Re: Requesting script [Re: Horstl] #182731 13/08/07 09:41 PM
Joined: Aug 2006
Posts: 469
G
Garou Offline OP
Fjord artisan
OP Offline
Fjord artisan
G
Joined: Aug 2006
Posts: 469
Thx Horstl.

Re: Requesting script [Re: Garou] #182794 14/08/07 08:35 PM
Joined: Aug 2006
Posts: 469
G
Garou Offline OP
Fjord artisan
OP Offline
Fjord artisan
G
Joined: Aug 2006
Posts: 469
It turn on and off but i dont think its counting right cause its kicking under the set limit of 7

Code:
  on @*:JOIN:#:{
if $israndom($nick) || (%consonant == off) || (!%consonant) { return } 
{ ban -ku600 # $nick 2 14Random Nick Detected }

alias isconsonant { var %consonant = bcdfghjklmnpqrstvwxyz | return $iif($1 isin %consonant,$true,$false) }

alias israndom { var %c = 1 | var %count = 0 | while (%c <= $len($1)) { if ($isconsonant($mid($1,%c,1))) { inc %count } | else { set %count 0 } | if (%count >= 7) { return $true } | inc %c } | return $false }

Re: Requesting script [Re: LostShadow] #182797 15/08/07 12:29 AM
Joined: Mar 2006
Posts: 47
C
CitizenKane Offline
Ameglian cow
Offline
Ameglian cow
C
Joined: Mar 2006
Posts: 47
Originally Posted By: LostShadow
Code:
alias israndom { var %c = 1 | var %count = 0 | while (%c <= $len($1)) { if ($isconsonant($mid($1,%c,1))) { inc %count } |  else { set %count 0 } | if (%count >= 4) { return $true } | inc %c } | return $false }

alias isconsonant { var %consonant = bcdfghjklmnpqrstvwxyz | return $iif($1 isin %consonant,$true,$false) }

on @*:JOIN:#:if $israndom($nick) { ban -k # $nick 2 Random nick. }


This does the same thing:
Code:
on @*:JOIN:#:if (!$regex($nick,a|e|i|o|u)) ban -k # $nick 2 Random nick.


Re: Requesting script [Re: CitizenKane] #182805 15/08/07 02:22 AM
Joined: Nov 2006
Posts: 1,559
H
Horstl Offline
Hoopy frood
Offline
Hoopy frood
H
Joined: Nov 2006
Posts: 1,559
Anyway, if you want to use your original code: there was a wrong syntax in the on join event.
The first opening bracket should not be in this line:
Code:
{ ban -ku600 # $nick 2 14Random Nick Detected }

And, imho it should be:
Code:
on @*:JOIN:#:{
    if (($israndom($nick)) && (%consonant == on)) { ban -ku600 # $nick 2 14Random Nick Detected } 
}

It's more clear to let for the script ban the user if 1) he has a random nick AND 2) the switch "%consonant" is toggled "on", than checking for "%consonant being off or no value for the %consonant switch at all, then do not proceed to the banning part". smile

Re: Requesting script [Re: Horstl] #182812 15/08/07 04:06 AM
Joined: Aug 2006
Posts: 469
G
Garou Offline OP
Fjord artisan
OP Offline
Fjord artisan
G
Joined: Aug 2006
Posts: 469
Its not kicking?
Code:
 


on @*:JOIN:#chat:{
    if (($israndom($nick)) && (%consonant == on)) { ban -ku600 # $nick 2 14Random Nick Detected }

alias isconsonant { var %consonant = bcdfghjklmnpqrstvwxyz | return $iif($1 isin %consonant,$true,$false) }

alias israndom { var %c = 1 | var %count = 0 | while (%c <= $len($1)) { if ($isconsonant($mid($1,%c,1))) { inc %count } | else { set %count 0 } | if (%count >= 6) { return $true } | inc %c } | return $false }





Re: Requesting script [Re: Garou] #182816 15/08/07 04:48 AM
Joined: Jun 2006
Posts: 508
D
deegee Offline
Fjord artisan
Offline
Fjord artisan
D
Joined: Jun 2006
Posts: 508
There is a missing closing brace in the join event.

Re: Requesting script [Re: Garou] #182817 15/08/07 04:49 AM
Joined: Nov 2006
Posts: 1,559
H
Horstl Offline
Hoopy frood
Offline
Hoopy frood
H
Joined: Nov 2006
Posts: 1,559
This time, there was a bracket missing in the on join event... smile
Here's a working piece of code. I perkily made some minor changes, too:
- merged and redrafted "israndom" and "isconsonant" aliases
- excluded the y char, as this may be used as a "vowel" in nicks
cool
Code:
; kick nicks containing 6 (or more) consonants in a row
on @*:JOIN:#chat:{
  if (($israndom($nick)) && (%consonant == on)) { ban -ku600 # $nick 2 14Random Nick Detected }
}


alias -l israndom {
  var %nr = 1, %count
  while ($mid($1,%nr,1)) { 
    if ($v1 isletter bcdfghjklmnpqrstvwxz) {
      inc %count
      if (%count >= 6) { return $true }
    }
    else { var %count = 0 }
    inc %nr
  }
  return $false
}

Tip: Don't overdo using |'s in your code. It makes the code harder to read and harder to debug - especially if you merge multiple { } brackets and/or if-then-else constructions in one line.

Re: Requesting script [Re: Horstl] #182835 15/08/07 02:35 PM
Joined: Aug 2006
Posts: 469
G
Garou Offline OP
Fjord artisan
OP Offline
Fjord artisan
G
Joined: Aug 2006
Posts: 469
Thx very much...Its working great.