Idle-op

By blodix on Jul 11, 2010

I have allways been troubled with people spamming characters and etc. when i'm not "there"

So I finally realised it would be best to create a script for it.

It warns twice and kicks the third, it resets after the kick, but it is possible to let it ban for an hour first. This will not be in this version tho.

Long time ago since I gave anything to this community, for those who remembers me, I hope you see my scripting knowledge has increased a tiny bit.

Yes I already know I could do it in other ways, like using a tekst document and etc. But I would be glad if you share your ways. :)

And if you doesnt have anything nice to contribute, rather don't!

on *:text:!warn on:#:{
  if ($nick isop $chan) || ($nick ishop $chan) {
    if (%warnon [ $+ [ $chan ] ] == $null) {
      set %warnon [ $+ [ $chan ] ] sup
      msg $chan 7Idle-op is now ON
    }
    else notice $nick it is already on.
  }
  else notice $nick you need to be op or hop to use this.
}

on *:text:!warn off:#:{
  if ($nick isop $chan) || ($nick ishop $chan) {
    if (%warnon [ $+ [ $chan ] ] != $null) {
      unset %warnon [ $+ [ $chan ] ]
      msg $chan 7Idle-op is now OFF
    }
    else notice $nick it is already off.
  }
  else notice $nick you need to be op or hop to use this.
}

on *:TEXT:*:#: {
  if (%warnon [ $+ [ $chan ] ] != $null) {

    if (aaaaaa isin $1-) || (bbbbbb isin $1-) || (cccccc isin $1-) || (dddddd isin $1-) || (eeeeee isin $1-) || (ffffff isin $1-) || (gggggg isin $1-) || (hhhhhh isin $1-) || (iiiiii isin $1-) || (jjjjjj isin $1-) || (kkkkkk isin $1-) || (llllll isin $1-) || (mmmmmm isin $1-) || (nnnnnn isin $1-) || (oooooo isin $1-) || (pppppp isin $1-) || (qqqqqq isin $1-) || (rrrrrr isin $1-) || (ssssss isin $1-) || (tttttt isin $1-) || (uuuuuu isin $1-) || (vvvvvv isin $1-) || (wwwwww isin $1-) || (xxxxxx isin $1-) || (yyyyyy isin $1-) || (zzzzzz isin $1-) {
      if (%nickick [ $+ [ $nick ] ] == 2) { /kick $chan $nick Please use less characters in one word (3/3) | halt }
      if (%nickick [ $+ [ $nick ] ] == 1) { /msg $chan 4[Warning]  $+ $nick $+  Please use less characters in one word (2/3) | set %nickick [ $+ [ $nick ] ] 2 | halt }
      msg $chan 4[Warning]  $+ $nick $+  Please use less characters in one word (1/3)
      set %nickick [ $+ [ $nick ] ] 1
    }
    if (!!!!!! isin $1-) {
      if (%nickick [ $+ [ $nick ] ] == 2) { /Kick $chan $nick Please use less exclamation marks! (3/3) | halt }
      if (%nickick [ $+ [ $nick ] ] == 1) { /msg $chan 4[Warning]  $+ $nick $+  Please use less exclamation marks! (2/3) | set %nickick [ $+ [ $nick ] ] 2 | halt }
      msg $chan 4[Warning]  $+ $nick $+  Please use less exclamation marks! (1/2)
      set %nickick [ $+ [ $nick ] ] 1
    }
  }
  elseif (%warnon == $null) { halt }  
}

on *:PART:#: { unset %nickick [ $+ [ $nick ] ] }
on *:kick:#: { unset %nickick [ $+ [ $knick ] ] }

Comments

Sign in to comment.
sunslayer   -  Jul 14, 2010

ye i misunderstood what you were saying Jethro_

 Respond  
Jethro   -  Jul 14, 2010

WorldDMT, I've realized that you use $(,var), which is the same as $eval(var,2) or $(var,2) or $var(var,1).value, but that identifier is bugged, not a feature.

 Respond  
WorldDMT   -  Jul 14, 2010

with a comma (marked in red) , you'll get an insufficient parameter error. Without the comma, it returns the variable name only.

i dont think i do it many times and that's work

test this

alias t {
  var %x $+ $me 1
  echo 4 -a evaluated 1: $(,$+(%,x,$me))
  echo 6 -a evaluated 2: $($+(%,x,$me),2)
  echo 3 -a not eval. 1: $+(%,x,$me) 
  echo 5 -a not eval. 2: $+(%x,$me) 
  if $(,$+(%,x,$me)) { echo -a test ok for evaluation }
}
 Respond  
Jethro   -  Jul 13, 2010

sunslayer, did you not miss my post in response to yours above? The dot > /(.+)/ will match "literally everything," be that so-called characters or strings that you've mentioned here. The only difference is that your example will match one or more strings/characters because you added the plus sign. Mine only has a dot, which will only match the single repeated character or string.

 Respond  
sunslayer   -  Jul 13, 2010

Ok you're right, but according to blodix's script, he wants to match for the same repeated letters 6 or more, not one or more other letters...mine only matches repeated characters/strings not just random letters

 Respond  
Jethro   -  Jul 13, 2010

But WorldDMT, I want to match the variable value "on" in my example, not blodix's. By not using a number, it'll only get matched for the variable itself. Besides, when you do > //echo -a $(,$+(%,warnon,#)) with a comma (marked in red) , you'll get an insufficient parameter error. Without the comma, it returns the variable name only.

 Respond  
WorldDMT   -  Jul 13, 2010

@sunslayer:> [quote]about if (aaaaaa isin $1-) || (bbbbbb isin $1-) || ........ use regex .{6}
will match any character repeated 6 times, i.e. "hello there" would be matched
[/quote]i give him only an eg

@jethro_: about "set $+(%,warnon,#) on" u can set it 1 and 0

set %warnon $+ # 1
then the condition can be

if $(,$+(%,warnon,#)) { ... }
 Respond  
Jethro   -  Jul 13, 2010

Yes, that's what the dot is for to match everything (literally)

Of the regex I've learned, and I quote, > most regex engines have a "dot matches all" or "single line" mode that makes the dot match any single character, including line breaks. Use the dot sparingly. Often, a character class or negated character class is faster and more precise.

 Respond  
sunslayer   -  Jul 13, 2010

it will match both letters and strings

 Respond  
Jethro   -  Jul 13, 2010

Ok you're right, but according to blodix's script, he wants to match for the same repeated letters 6 or more, not one or more other letters...

Anyway, I agree with you. Sooner or later, some spammers are gonna find an "inventive" way to tamper with the code. We can't be too careful these days...:p

 Respond  
sunslayer   -  Jul 12, 2010

Jethro_, the + was for matching strings, i.e. babababababa

 Respond  
Jethro   -  Jul 12, 2010

I thought I'd edit your script and improve upon it, and here is it:

on @*:text:*:#:{
  var %r = /(.)\1{5}/S
  if ($regex($1-,/!warn o(n|ff)/iS)) { 
    if (!$nick(#,$nick,oh)) {
      notice $nick you need to be op or hop to use this.
    }
    elseif ($regml(1) == n) && ($($+(%,warnon,#),2) != on) {
      set $+(%,warnon,#) on
      msg # 7Idle-op is now ON
    }
    elseif ($regml(1) == ff) && ($($+(%,warnon,#),2) == on) {
      set $+(%,warnon,#) off
      msg # 7Idle-op is now OFF
    }
    else { notice $nick It is already $($+(%,warnon,#),2) }
  }
  elseif ($($+(%,nickkick,$nick),2) > 1) && ($regex($1-,%r)) {
    kick # $nick 5 repeated characters in your exceeded!
    unset $+(%,nickkick,$nick)
  }
  elseif ($regex($1-,%r)) && ($($+(%,warnon,#),2) == on) {
    inc $+(%,nickkick,$nick)
    msg # 4[Warning]  $+ $nick $+  Please don't exceed $&
      5 repeated characters in your sentence. Thank you.
  }
}

blodix's snippet is 2057 bytes, and mine is 738 bytes.

On thing I don't get is the topic of this snippet "Idle-op." This script has nothing do with idling. It should have been titled "Repeated Character Kicker with Warnings."

 Respond  
Jethro   -  Jul 12, 2010

sunslayer, you don't need to use {5,} and .+ just

/(.)\1{5}/

will do the trick to trigger upon the repeated characters 6 times or above. Try it and see for yourself.

 Respond  
sunslayer   -  Jul 12, 2010

about if (aaaaaa isin $1-) || (bbbbbb isin $1-) || ........ use regex .{6}will match any character repeated 6 times, i.e. "hello there" would be matched

/(.+)\1{5,}/

will match any character or string that is repeated 6 times or more

 Respond  
WorldDMT   -  Jul 12, 2010

if (!$+(%warnon,#))
must be evaluated

 Respond  
Lord-Harlot   -  Jul 12, 2010

if (%warnon [ $+ [ $chan ] ] != $null)

would be better as

if (!$+(%warnon,#))

 Respond  
sk68   -  Jul 12, 2010

usually not a good habit to use multiple text (or any) events on the same script, they can clash :)

on *:TEXT:*:#:{ 
if ($1 == !warn) { 
if ($2 == on) { ... }
elseif ($2 == off) { ... }
} 
else { ... }
}
 Respond  
WorldDMT   -  Jul 12, 2010

hi

if ($nick isop $chan) || ($nick ishop $chan) {
can be
if $nick(#,$nick,oh) {

when u set or unset a variable u dont need to evaluate $identifer or %var so

set %warnon [ $+ [ $chan ] ] sup
can be
set %warnon $+ # sup

about if (aaaaaa isin $1-) || (bbbbbb isin $1-) || ........ use regex .{6}

 Respond  
Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.