|
Fr3ak
|
Fr3ak
|
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. 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: 214
Fjord artisan
|
Fjord artisan
Joined: Mar 2014
Posts: 214 |
the script has msg $nick instead of msg $chan/# 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)
}
}
}
|
|
|
|
Fr3ak
|
Fr3ak
|
Fixed the $chan issue, Still not doing timeouts though
|
|
|
|
Joined: Dec 2013
Posts: 771
Hoopy frood
|
Hoopy frood
Joined: Dec 2013
Posts: 771 |
What is "timeout -ku600 # $nick 2" supposed to do? I believe the syntax is simply "timeout $nick <time>"
|
|
|
|
Joined: Mar 2014
Posts: 214
Fjord artisan
|
Fjord artisan
Joined: Mar 2014
Posts: 214 |
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 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 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%
|
|
|
|
Fr3ak
|
Fr3ak
|
Thanks for the help guys, Managed to fix the problem, I totally derp'd with the timeout command, new 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: 214
Fjord artisan
|
Fjord artisan
Joined: Mar 2014
Posts: 214 |
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
|
|
|
|
Joined: Jan 2004
Posts: 1,330
Hoopy frood
|
Hoopy frood
Joined: Jan 2004
Posts: 1,330 |
What kind of ridiculous names for variables are %. %: and %;? var %percent.caps = $calc($regex($1-,/[A-Z]/g) / $regex($1-,/[A-Z]/ig) * 100)
|
|
|
|
|