mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Jun 2014
Posts: 3
F
Fr3ak Offline OP
Self-satisified door
OP Offline
Self-satisified door
F
Joined: Jun 2014
Posts: 3
Hey, I'm a beginner when it comes to scripting, I grabbed the following code from a thread and customized it a bit, Having a slight problem with it, I probably messed with the code and it doesn't timeout on the third warning, It does say what it's suppost to say but not timing out.

Code:
on @*:text:*:#:capscheck $1-
on @*:action:*:#:capscheck $1-
on @*:notice:*:#:capscheck $1-
alias -l capscheck {
  var %. ,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,%; $len($remove($1- [ %. ] )),%: $len($1-) - %;
  if ($nick !isop #) && ($calc(100*($len($removecs($1- [ %. ] ))-%;)/%:) > 50) && (%: > 5) { 
    set -e $+(%,c,$chr(32),$int($v1))
    inc $+(%,$nick) 
    if ($($+(%,$nick),2) > 2) {
      timeout -ku600 # $nick 2
      .msg $nick , You had $+(%c,%) usage of CAPS memory in your sentence, 5 Minutes timeout for you my friend! (3/3)
      unset $($+(%,$nick),1)
    }
    elseif ($($+(%,$nick),2) = 2) { 
      .msg $chan $nick , You had $+(%c,%) usage of CAPS memory in your sentence, Second warning! Next warning is a timeout. (2/3)
    }
    else { 
      .msg $chan $nick , You had $+(%c,%) usage of CAPS memory in your sentence, First warning! (1/3)
    }
  }
  }	



Joined: Mar 2014
Posts: 215
J
Fjord artisan
Offline
Fjord artisan
J
Joined: Mar 2014
Posts: 215
the script has msg $nick instead of msg $chan/#
Code:
on @*:text:*:#:capscheck $1-
on @*:action:*:#:capscheck $1-
on @*:notice:*:#:capscheck $1-
alias -l capscheck {
  var %. ,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,%; $len($remove($1- [ %. ] )),%: $len($1-) - %;
  if ($nick !isop #) && ($calc(100*($len($removecs($1- [ %. ] ))-%;)/%:) > 50) && (%: > 5) { 
    set -e $+(%,c,$chr(32),$int($v1))
    inc $+(%,$nick) 
    if ($($+(%,$nick),2) > 2) {
      timeout -ku600 # $nick 2
      .msg $chan , You had $+(%c,%) usage of CAPS memory in your sentence, 5 Minutes timeout for you my friend! (3/3)
      unset $($+(%,$nick),1)
    }
    elseif ($($+(%,$nick),2) = 2) { 
      .msg $chan $nick , You had $+(%c,%) usage of CAPS memory in your sentence, Second warning! Next warning is a timeout. (2/3)
    }
    else { 
      .msg $chan $nick , You had $+(%c,%) usage of CAPS memory in your sentence, First warning! (1/3)
    }
  }
  }	



#imAbeginner
i made a chat bot for mark_paintball! http://twitch.tv/mark_paintball
Joined: Jun 2014
Posts: 3
F
Fr3ak Offline OP
Self-satisified door
OP Offline
Self-satisified door
F
Joined: Jun 2014
Posts: 3
Fixed the $chan issue, Still not doing timeouts though

Joined: Dec 2013
Posts: 779
N
Hoopy frood
Offline
Hoopy frood
N
Joined: Dec 2013
Posts: 779
What is "timeout -ku600 # $nick 2" supposed to do?
I believe the syntax is simply "timeout $nick <time>"


Nillens @ irc.twitch.tv
Nillen @ irc.rizon.net
Joined: Mar 2014
Posts: 215
J
Fjord artisan
Offline
Fjord artisan
J
Joined: Mar 2014
Posts: 215
Originally Posted By: Nillen
What is "timeout -ku600 # $nick 2" supposed to do?
I believe the syntax is simply "timeout $nick <time>"

yes
If it still fails, try out this script
Code:
on *:text:*:#:{
  if ($nick isop #) return
  if ( $len($1-) >= 10 ) {
    if ( $calc($regex($1-,/[A-Z]/g) / $regex($1-,/[A-Z]/gi) * 100) >= 75 ) { 
      if !$istok(%caps.warned,$nick,32) {
        msg $chan $nick -> stop typing in caps! [warning] 
        set -e %caps.warned $addtok(%caps.warned,$nick,32)
        .timer 1 300 remove.warned $nick
      }
      else msg $chan Caps again :( | msg $chan .timeout $nick 60 
    }
  }
}
alias -l remove.warned {
  set -e %caps.warned $remtok(%caps.warned,$1,1,32)
}


the 75 in
Code:
    if ( $calc($regex($1-,/[A-Z]/g) / $regex($1-,/[A-Z]/gi) * 100) >= 75 ) {
is the % of the message needed for caps block, change it on wish

Last edited by judge2020; 29/06/14 05:53 PM. Reason: added 75%

#imAbeginner
i made a chat bot for mark_paintball! http://twitch.tv/mark_paintball
Joined: Jun 2014
Posts: 3
F
Fr3ak Offline OP
Self-satisified door
OP Offline
Self-satisified door
F
Joined: Jun 2014
Posts: 3
Thanks for the help guys, Managed to fix the problem, I totally derp'd with the timeout command, new code;

Code:
on @*:text:*:#:capscheck $1-
on @*:action:*:#:capscheck $1-
on @*:notice:*:#:capscheck $1-
alias -l capscheck {
  var %. ,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,%; $len($remove($1- [ %. ] )),%: $len($1-) - %;
  if ($nick !isop #) && ($calc(100*($len($removecs($1- [ %. ] ))-%;)/%:) > 50) && (%: > 5) { 
    set -e $+(%,c,$chr(32),$int($v1))
    inc $+(%,$nick) 
    if ($($+(%,$nick),2) > 2) {
      .msg $chan .timeout $nick 120
      .msg $chan $nick , You had $+(%c,%) usage of CAPS memory in your sentence, 2 Minutes timeout for you my friend! (3/3)
      unset $($+(%,$nick),1)
    }
    elseif ($($+(%,$nick),2) = 2) { 
      .msg $chan $nick , You had $+(%c,%) usage of CAPS memory in your sentence, Second warning! Next warning is a timeout. (2/3)
    }
    else { 
      .msg $chan $nick , You had $+(%c,%) usage of CAPS memory in your sentence, First warning! (1/3)
    }
  }
}


Joined: Mar 2014
Posts: 215
J
Fjord artisan
Offline
Fjord artisan
J
Joined: Mar 2014
Posts: 215
Just to point something out, i think the %usage of caps is messed up...

Last edited by judge2020; 01/07/14 03:48 PM. Reason: typing error

#imAbeginner
i made a chat bot for mark_paintball! http://twitch.tv/mark_paintball
Joined: Jan 2004
Posts: 1,358
L
Hoopy frood
Offline
Hoopy frood
L
Joined: Jan 2004
Posts: 1,358
What kind of ridiculous names for variables are %. %: and %;?

Code:
var %percent.caps = $calc($regex($1-,/[A-Z]/g) / $regex($1-,/[A-Z]/ig) * 100)


Link Copied to Clipboard