mIRC Home    About    Download    Register    News    Help

Print Thread
Page 1 of 2 1 2
#117448 16/04/05 02:09 AM
Joined: Sep 2004
Posts: 44
T
Thermal Offline OP
Ameglian cow
OP Offline
Ameglian cow
T
Joined: Sep 2004
Posts: 44
hello, i was wonderin if i could get some help on this script, im not very good at this kind of stuff, and i was hoping that someone could help me alil
on *:text:*:*:if ??? isin $1- { .msg $chan $nick Please do not use excessive punctuation or excessive letter, This is your First warning. Next will be a kick, 4th time will result in a 12 hour ban, 5th time will result in a 24 hour ban }

im tryin to make it, if they use like 4 or more ?'s or 4 or more ....'s or 4 or more !'s, it would trigger the script, and if the same nick done it, it would kick them, and so on, or if they use 4 or more letters like aaaa.
thanks in advance

Joined: Dec 2002
Posts: 1,541
L
Hoopy frood
Offline
Hoopy frood
L
Joined: Dec 2002
Posts: 1,541
Have you thought about:

Code:
on *:text:*:#: {
  if ($str($chr(63),4) isin $1-) {
   inc %punctuation. $+ $nick 1
   if (%punctuation. $+ $nick == 1) {  .msg $chan $nick Please dont excessively repeat characters.  This is your First warning. }
   if (%punctuation. $+ $nick == 2) {  kick # $nick <kick message> }
   if (%punctuation. $+ $nick == 4) {  ban -ku43200 $nick <kick message> }
   if (%punctuation. $+ $nick > 4) {  ban -ku86400 $nick <kick message> }
  }
}


This code is untested and also will NOT forget their last status. BTW, $chr(63) is mirc's $chr code for a question mark. Change it however you need to for any other punctuation. All you'd have to do really is something like this:

if (($str($chr(63),4) isin $1-) || ($str($chr(33),4) isin $1-) || ($str($chr(44),4) isin $1-)) {

Just keep adding them into the line really.


God, how many times do I need to edit this post lol

Last edited by landonsandor; 16/04/05 02:33 AM.

Those who fail history are doomed to repeat it
Joined: Sep 2004
Posts: 44
T
Thermal Offline OP
Ameglian cow
OP Offline
Ameglian cow
T
Joined: Sep 2004
Posts: 44
when i first try it, it gives me this error

* /ban: invalid parameters (line 13, script2.mrc)

Joined: Dec 2002
Posts: 1,541
L
Hoopy frood
Offline
Hoopy frood
L
Joined: Dec 2002
Posts: 1,541
ok, replace the ban -k with this:

ban $nick 2 | kick # $nick <kick message of choice>

older mircs dont have the ban -k and that could be fudging it all up


Those who fail history are doomed to repeat it
Joined: Feb 2004
Posts: 714
Z
Hoopy frood
Offline
Hoopy frood
Z
Joined: Feb 2004
Posts: 714
The reason that the /ban isn't working is because the # value is missing.

{ ban -ku43200 # $nick <kick message> }
{ ban -ku86400 # $nick <kick message> }

Zyzzyx smile


"All we are saying is give peace a chance" -- John Lennon
Joined: Sep 2004
Posts: 44
T
Thermal Offline OP
Ameglian cow
OP Offline
Ameglian cow
T
Joined: Sep 2004
Posts: 44
k the ban works great heh, but thats the only thing it does, is when someone first does a ???? it bans them , it doesnt give the warning msg first

Joined: Feb 2004
Posts: 714
Z
Hoopy frood
Offline
Hoopy frood
Z
Joined: Feb 2004
Posts: 714
Code:
on *:text:*:#: {
  if ($str($chr(63),4) isin $1-) {
   inc %punctuation. [color:Red][[/color] $+ [color:red][[/color] $nick [color:red]] ][/color]
   if (%punctuation. [color:Red][[/color] $+ [color:red][[/color] $nick [color:red]] ][/color] == 1) { .msg $chan $nick Please dont excessively repeat characters.  This is your First warning. }
   if (%punctuation. [color:Red][[/color] $+ [color:red][[/color] $nick [color:red]] ][/color] == 2) { kick # $nick &lt;kick message&gt; }
   if (%punctuation. [color:Red][[/color] $+ [color:red][[/color] $nick [color:red]] ][/color] == 4) { ban -ku43200 # $nick &lt;kick message&gt; }
   if (%punctuation. [color:Red][[/color] $+ [color:red][[/color] $nick [color:red]] ][/color] &gt; 4) { ban -ku86400 # $nick &lt;kick message&gt; }
  }
}


I think this should work.


"All we are saying is give peace a chance" -- John Lennon
Joined: Sep 2004
Posts: 44
T
Thermal Offline OP
Ameglian cow
OP Offline
Ameglian cow
T
Joined: Sep 2004
Posts: 44
works great, 1 other question if you dont mind, i hate to keep buggin, but how would u unset it after it does a 24 hour ban?

Joined: Feb 2004
Posts: 714
Z
Hoopy frood
Offline
Hoopy frood
Z
Joined: Feb 2004
Posts: 714
It's not 'bugging' at all wink

If you are talking about unsetting the variable (so that the count restarts), replace inc %punctuation. [ $+ [ $nick ] ] for inc -u86400 %punctuation. [ $+ [ $nick ] ]

Hope this helps,
Zyzzyx smile


"All we are saying is give peace a chance" -- John Lennon
Joined: Sep 2004
Posts: 44
T
Thermal Offline OP
Ameglian cow
OP Offline
Ameglian cow
T
Joined: Sep 2004
Posts: 44
u mean like this?

on *:text:*:#: {
if (($str($chr(63),4) isin $1-) || ($str($chr(33),4) isin $1-) || ($str($chr(35),4) isin $1-) || ($str($chr(36),4) isin $1-) || ($str($chr(45),4) isin $1-) || ($str($chr(46),4) isin $1-) || ($str($chr(60),4) isin $1-)) {
inc -u86400 %punctuation. [ $+ [ $nick ] ]
if (%punctuation. [ $+ [ $nick ] ] == 1) { .msg $chan $nick Please dont excessively repeat characters. This is your First warning. Next Warning Will Be Followed By A Kick }
if (%punctuation. [ $+ [ $nick ] ] == 2) { kick # $nick Please Stop With The Excessive Characters }
if (%punctuation. [ $+ [ $nick ] ] == 4) { ban -ku43200 # $nick 3rd Warning *12 Hour Ban* }
if (%punctuation. [ $+ [ $nick ] ] > 4) { ban -ku86400 # $nick 4th And Final Warning *24 Hour Ban* }
}
}

Joined: Feb 2004
Posts: 714
Z
Hoopy frood
Offline
Hoopy frood
Z
Joined: Feb 2004
Posts: 714
Yes, that is it laugh


"All we are saying is give peace a chance" -- John Lennon
Joined: Sep 2003
Posts: 4,230
D
Hoopy frood
Offline
Hoopy frood
D
Joined: Sep 2003
Posts: 4,230
if your using this in multiple channels like it shows :#: i suggest u replace %punctuation. [ $+ [ $nick ] ] with %punctuation. [ $+ [ $+($chan,.,$nick) ] ] everywhere, as being banned on a different channel with no warning is a bit sad thing to do.

Joined: Sep 2004
Posts: 44
T
Thermal Offline OP
Ameglian cow
OP Offline
Ameglian cow
T
Joined: Sep 2004
Posts: 44
doesnt unset it

Joined: Sep 2003
Posts: 4,230
D
Hoopy frood
Offline
Hoopy frood
D
Joined: Sep 2003
Posts: 4,230
Code:
on *:text:*:#: {
  if (($str($chr(63),4) isin $1-) || ($str($chr(33),4) isin $1-) || ($str($chr(35),4) isin $1-) || ($str($chr(36),4) isin $1-) || ($str($chr(45),4) isin $1-) || ($str($chr(46),4) isin $1-) || ($str($chr(60),4) isin $1-)) {
    inc -u86400 %punctuation. [ $+ [ $nick ] ]
    if (%punctuation. [ $+ [ $nick ] ] == 1) { .msg $chan $nick Please dont excessively repeat characters.  This is your First warning. Next Warning Will Be Followed By A Kick }
    if (%punctuation. [ $+ [ $nick ] ] == 2) { kick # $nick Please Stop With The Excessive Characters }
    if (%punctuation. [ $+ [ $nick ] ] == 4) { ban -ku43200 # $nick 3rd Warning *12 Hour Ban* }
    if (%punctuation. [ $+ [ $nick ] ] &gt; 4) { ban -ku86400 # $nick 4th And Final Warning *24 Hour Ban* }
  }
}


^ The -u86400 above means only one thing, that if $nick makes no more puncution events in 24hrs (86400 seconds) that the counter of howmany he has done so far well be deleted, ie he starts from zero, IT well also reset to zero if you shut mirc down, since variables defined with the -u flag are not saved when mirc exits.

If you ment you would like to manually be able to remove a ban then add this.

Code:
MENU nicklist,query {
  $iif(((!$chan) || ($me isop $chan)),Remove Punctuation Ban) : {
    var %chan = $iif($chan,$chan,$$?="Unban From What Channel#")
    if ($me !isop $chan(%chan)) {
      echo -a Punctuation Ban NOT Removed from $1 on channel %chan ( You are not an Op on %chan )
    }
    else {
      ban -r %chan $1
      unset %punctuation. [ $+ [ $1 ] ]
      echo -a Punctuation Ban Removed from $1 on channel %chan
    }
  }
}


if you choose to use my suggestion on adding channels in then use this

Code:
MENU nicklist,query {
  $iif(((!$chan) || ($me isop $chan)),Remove Punctuation Ban) : {
    var %chan = $iif($chan,$chan,$$?="Unban From What Channel#")
    if ($me !isop $chan(%chan)) {
      echo -a Punctuation Ban NOT Removed from $1 on channel %chan ( You are not an Op on %chan )
    }
    else {
      ban -r %chan $1
      unset %punctuation. [ $+ [ $+(%chan,.,$1) ] ]
      echo -a Punctuation Ban Removed from $1 on channel %chan
    }
  }
}


* i deliberitly didnt check if a punctuation unban was in effect, since theres possabliities that the value might have been lost but the ban still in effect.

Joined: Sep 2004
Posts: 44
T
Thermal Offline OP
Ameglian cow
OP Offline
Ameglian cow
T
Joined: Sep 2004
Posts: 44
i thank you 3 for all your help, and sorry for being a pain smile

Joined: Dec 2002
Posts: 1,541
L
Hoopy frood
Offline
Hoopy frood
L
Joined: Dec 2002
Posts: 1,541
glad we could help!


Those who fail history are doomed to repeat it
Joined: Feb 2004
Posts: 2,019
Hoopy frood
Offline
Hoopy frood
Joined: Feb 2004
Posts: 2,019
If I may, I'd like to point out a little something that increases readability in the code that
has been presented, and gets rid of those aweful eval brackets.

Since the eval brackets are not needed when setting a variable, we can do:

inc -u86400 %punctuation. [ $+ [ $+($cid,.,$chan,.,$nick) ] ]
inc -u86400 $+(%,punctuation.,$cid,.,$chan,.,$nick)

However, what is even neater is the following:
  • var %a = $+(%,punctuation.,$cid,.,$chan,.,$nick)
    inc -u86400 $(%a)
    var %b = $(%a,2)

    if %b == 1 { }
    elseif %b == 2 { }
    elseif %b == 3 { }
    elseif %b == 4 { }
    else { }

    What it does is assign %punctuation.<value of $cid>.<value of $chan>.<value of $nick> to the
    variable %a. The value of variable %a could for example look like: %punctuation.2.#blah.FiberOPtics

    I've added $cid so that the variable is network specific (assuming you don't have a clone of yours in the same
    channels running the same script)

    We then increment the value of variable %a to be unset in 24 hours. Why didn't I just do: inc %a ?
    Because when settting a variable, the variable that u want to set is obviously not evaluated, otherwise it
    would be impossible to set one in the first place. When you do //var %a = value, if the %a would evaluate,
    then how can we set the variable %a to something?

    Therefore we force evaluation of %a by putting an $eval around it, so that %punctuation.2.#blah.FiberOPtics is
    incremented, rather than %a itself. There are more ways to force evaluation of %a prior to the setting.

    Examples //inc [ [ %a ] ] or //inc $+(%a) etc.

    Then we assign the value of %punctuation.2.#blah.FiberOPtics to variable %b. How is this done?
    By forcing double evaluation on variable %a, with the use of $eval(<variable>,2).

    Level 0: $(%a,0) = %a
    Level 1: $(%a,1) = $(%a) = %punctuation.2.#blah.FiberOPtics
    Level 2: $(%a,2) = value of %punctuation.2.#blah.FiberOPtics for example = 2

    So then we simply compare %b, which has the value of the incremented variable, to see what kind of
    measurements should be taken.

For the excessive punctuation detection, that incredibly long if statement can be replaced with a regex.

If I understand the OP correctly, he wants it to trigger in the case of: 4 or more following identic characters,
which can be punctuation or letters. I'm just going to include everything but digits and whitespaces, just
know that it can be customized exactly to fit ones needs, they just have to be specific with
what they mean with "punctuation".

if $regex($1-,/([^\d\s])\1{3}/S) { }

If you would like it so that it also detects mixes of certain punctuation, like .+*-.+ then leave out \1, change 3 to 4,
and remove the brackets around the character class. HOWEVER I would not allow letters to be part of the punctuation
then, as that would just kick ban on basically any 4 letter word.

Therefore we could construct another regex which matches in case of:
  • 4 or more identic letters (both lower/upper case), but not in mixed shape. Matches aaaa, not abab.
  • 4 or more non-alfanumeric characters, so basically anything apart from letters and numbers,
    with the condition that the non-alfanumerics may not be whitespaces like tab, space, $cr, $lf.

    These can be in mixed shape, so not only !!!!! but also *+-?![-

    The incoming string is stripped from control codes.

    if $regex($1-,/[^a-z\d\s]{4}|([a-z])\1{3}/Si) { }

    Unfortunately \w covers a-zA-Z0-9 and _ so I couldn't have simply done [^\w\s] it would had to be something like: (?:[^\w\s]|_)

If you want it to match more specific things, then just say the word, but be specific.


Gone.
Joined: Sep 2003
Posts: 4,230
D
Hoopy frood
Offline
Hoopy frood
D
Joined: Sep 2003
Posts: 4,230
Excellent presentation.

Quote:
inc -u86400 %punctuation. [ $+ [ $+($cid,.,$chan,.,$nick) ] ]
inc -u86400 $+(%,punctuation.,$cid,.,$chan,.,$nick)


I thought that changing to $(,2) in the middle of the thread might confuse him a little.

Quote:
However, what is even neater is the following:
var %a = $+(%,punctuation.,$cid,.,$chan,.,$nick)
inc -u86400 $(%a)
var %b = $(%a,2)


lol, id just love to debug code like that

Joined: Feb 2004
Posts: 2,019
Hoopy frood
Offline
Hoopy frood
Joined: Feb 2004
Posts: 2,019
Thank you.

Hehe yeah, I suppose for the non-trained eye, that second part you quoted must surely look dodgy, and a bit hard to follow.

If it were part of some huge code I'd of course have named the %a, %b to variables with names that give you some information about what they contain (easier to follow in case of debugging), but for these little scripts I don't bother, however it's a personal choice.

Greets


Gone.
Joined: Sep 2004
Posts: 44
T
Thermal Offline OP
Ameglian cow
OP Offline
Ameglian cow
T
Joined: Sep 2004
Posts: 44
i still need help on this script smirk

Page 1 of 2 1 2

Link Copied to Clipboard