| View previous topic :: View next topic |
| Author |
Message |
mm Halfop
Joined: 01 Jul 2004 Posts: 78
|
Posted: Tue Jul 26, 2005 10:24 pm Post subject: caps script |
|
|
Hi, I found this script from this forum, and i have added "bind ctcp" part.
it works fine but some time ctcp part doesn't work and it says
| Quote: | | Tcl error [ctcp_caps]: No such user. | , i'll appreciate for your help.
| Code: | #Set this to the minimum string wize, before it will act
#IE, set 6, "HELLO" = no kick, "HELLO ALL" = kick
set cap_min 6
#set this tot he percentage, wihtout any percentage char
#IE, 50
set cap_per 50
bind pubm - "*" cap:perc:kick
proc cap:perc:kick {nick uh hand chan arg} {
global cap_per cap_min
if {[string length $arg] <= $cap_min} { return }
set full [string length $arg]
regsub -all {[A-Z]} $arg "" arg
putlog "$arg"
set perc [expr (($full - [string length $arg]) * 100) / $full]
putlog "$perc"
if {$perc >= $cap_per} {
putserv "KICK $chan $nick :*** NO *** caps please!!!) ([string range $perc 0 5]% caps)"
}
}
bind ctcp - ACTION ctcp_caps
proc ctcp_caps {nick uh hand chan keyword arg} {
if {[isbotnick [lindex [split $chan "@"] 0]] || [lindex [split $chan "@"] 1] != ""} {return 0}
cap:perc:kick $nick $uh $hand $chan $arg
} |
Thanks _________________ MM |
|
| Back to top |
|
 |
Sir_Fz Revered One

Joined: 27 Apr 2003 Posts: 3793 Location: Lebanon
|
Posted: Tue Jul 26, 2005 10:32 pm Post subject: |
|
|
.set errorInfo in partyline to know more about the error. _________________ Follow me on GitHub
- Opposing
Public Tcl scripts |
|
| Back to top |
|
 |
mm Halfop
Joined: 01 Jul 2004 Posts: 78
|
Posted: Tue Jul 26, 2005 10:55 pm Post subject: |
|
|
Thanks, Sir_Fz.
This happens once in a while, so should I type .set errorInfo after i see that error? or
thanks _________________ MM |
|
| Back to top |
|
 |
Sir_Fz Revered One

Joined: 27 Apr 2003 Posts: 3793 Location: Lebanon
|
Posted: Wed Jul 27, 2005 7:21 am Post subject: |
|
|
| mm wrote: | Thanks, Sir_Fz.
This happens once in a while, so should I type .set errorInfo after i see that error? or
thanks |
Just type it, and if it tells you "you need help" then add a "#" before the line that says
| Quote: | | unbind dcc n tcl *dcc:tcl |
and the line after it as well (for the .set dcc command) _________________ Follow me on GitHub
- Opposing
Public Tcl scripts |
|
| Back to top |
|
 |
mm Halfop
Joined: 01 Jul 2004 Posts: 78
|
Posted: Thu Jul 28, 2005 10:17 pm Post subject: |
|
|
HI Sir_Fz, I get this
| Code: | Currently: No such user.
Currently: while executing
Currently: "setuser $nick PASS [rand 987654321]"
Currently: (procedure "cap:perc:kick" line 37)
Currently: invoked from within
Currently: "cap:perc:kick $nick $uhost $hand $chan $arg "
Currently: (procedure "ctcp_caps" line 4)
Currently: invoked from within
Currently: "ctcp_caps $_ctcpr1 $_ctcpr2 $_ctcpr3 $_ctcpr4 $_ctcpr5 $_ctcpr6" |
I've some extra codes in the script to use some userdefine flags etc
| Code: | if {$perc >= $cap_per} {
-
-
-
adduser $nick [maskhost [getchanhost $nick $chan]]
setuser $nick PASS [rand 987654321]
puthelp "PRIVMSG $chan :$nick: no caps."
chattr $nick +F |
it seems error on this line -> setuser $nick PASS [rand 987654321]
Thanks again _________________ MM |
|
| Back to top |
|
 |
demond Revered One

Joined: 12 Jun 2004 Posts: 3073 Location: San Francisco, CA
|
Posted: Fri Jul 29, 2005 12:26 am Post subject: |
|
|
are you sure the error is on that [setuser] immediately after [adduser]? with those 2 lines, even if [adduser] fails, [setuser] should succeed on the already existing user $nick
post the whole script |
|
| Back to top |
|
 |
mm Halfop
Joined: 01 Jul 2004 Posts: 78
|
Posted: Fri Jul 29, 2005 10:32 pm Post subject: |
|
|
Yeah, sometime i see error message that "No such user" but user is on the channel. I have these codes.
| Code: | set cap_min 21
set cap_per 50
bind pubm - * cap:perc:kick
bind ctcp - ACTION ctcp_caps
proc cap:perc:kick {nick uhost hand chan arg} {
global cap_per cap_min sbanner owner botnick
if {[string length $arg] <= $cap_min} { return }
set full [string length $arg]
regsub -all {[A-Z]} $arg "" arg
set perc [expr (($full - [string length $arg]) * 100) / $full]
set banmask "*!*[string range $uhost [string first "@" $uhost] end]"
if {$perc >= $cap_per} {
if {[onchan $nick $chan]} {
if {[matchattr $hand fo $chan]} {
putlog "*** ignored***********"
} elseif {[matchattr $hand Ek]} {
putserv "KICK $chan $nick :You are on auto kick..."
} elseif {[matchattr $hand F]} {
adduser $nick [maskhost [getchanhost $nick $chan]]
chattr $nick -F+Ek
newchanban $chan $banmask $owner "caps are not allowed" 60
} else {
adduser $nick [maskhost [getchanhost $nick $chan]]
setuser $nick PASS [rand 987654321]
puthelp "PRIVMSG $chan :$nick: no caps"
chattr $nick +F
}; return 1
}
}
}
proc ctcp_caps {nick uhost hand chan keyword arg} {
if {[isbotnick [lindex [split $chan "@"] 0]] || [lindex [split $chan "@"] 1] != ""} {return 0}
cap:perc:kick $nick $uhost $hand $chan $arg
} |
| Code: | now .set errorInfo results
Currently: No such user.
Currently: while executing
Currently: "setuser $nick PASS [rand 987654321]"
Currently: (procedure "caps:perc:kick" line 37)
Currently: invoked from within
Currently: "caps:perc:kick $_pubm1 $_pubm2 $_pubm3 $_pubm4 $_pubm5" |
Thanks again. _________________ MM |
|
| Back to top |
|
 |
demond Revered One

Joined: 12 Jun 2004 Posts: 3073 Location: San Francisco, CA
|
Posted: Sat Jul 30, 2005 12:10 am Post subject: |
|
|
| hmm interesting, that proc is less than 37 lines long but the error traceback points at line 37... are you sure you posted the whole script? |
|
| Back to top |
|
 |
mm Halfop
Joined: 01 Jul 2004 Posts: 78
|
Posted: Sat Jul 30, 2005 12:39 am Post subject: |
|
|
demond, yeap this is the whole script, actually i have remove some comments and extra codes.
here is the latest errorinfo with the above codes and i've removed all other scripts as well, only this one is loaded.
| Quote: | Currently: No such user.
Currently: while executing
Currently: "setuser $nick PASS [rand 987654321]"
Currently: (procedure "caps:perc:kick" line 27)
Currently: invoked from within
Currently: "caps:perc:kick $_pubm1 $_pubm2 $_pubm3 $_pubm4 $_pubm5" |
Thanks again _________________ MM |
|
| Back to top |
|
 |
demond Revered One

Joined: 12 Jun 2004 Posts: 3073 Location: San Francisco, CA
|
Posted: Sat Jul 30, 2005 1:06 am Post subject: |
|
|
well it's still less than 27 lines from the proc's beginning to that [setuser] anyway
are you absolutely sure that there is [adduser] right before [setuser]? since I don't see how could [setuser] fail, provided the user has been just added (or already there) |
|
| Back to top |
|
 |
mm Halfop
Joined: 01 Jul 2004 Posts: 78
|
Posted: Sat Jul 30, 2005 1:07 am Post subject: |
|
|
Just tried to recreate the problem with the test ip and i used caps using action command i.e. /me TESTTTTTTTTTTTTTTTTTTTTTTTTT
and i saw this message in the partyline
Tcl error [ctcp:caps]: No such user.
after seeing this error i used .set errorInfo
| Code: | Currently: No such user.
Currently: while executing
Currently: "setuser $nick PASS [rand 987654321]"
Currently: (procedure "caps:perc:kick" line 24)
Currently: invoked from within
Currently: "caps:perc:kick $nick $uhost $hand $chan $arg "
Currently: (procedure "ctcp:caps" line 3)
Currently: invoked from within
Currently: "ctcp:caps $_ctcpr1 $_ctcpr2 $_ctcpr3 $_ctcpr4 $_ctcpr5 $_ctcpr6" |
and these are the final codes and i've restarted the bot after loading the script.
| Code: | set cap_min 21
set cap_per 50
bind pubm - * cap:perc:kick
bind ctcp - ACTION ctcp_caps
proc cap:perc:kick {nick uhost hand chan arg} {
global cap_per cap_min sbanner owner botnick
if {[string length $arg] <= $cap_min} { return }
set full [string length $arg]
regsub -all {[A-Z]} $arg "" arg
set perc [expr (($full - [string length $arg]) * 100) / $full]
set banmask "*!*[string range $uhost [string first "@" $uhost] end]"
if {$perc >= $cap_per} {
if {[onchan $nick $chan]} {
if {[matchattr $hand fo $chan]} {
putlog "*** ignored***********"
} elseif {[matchattr $hand Ek]} {
putserv "KICK $chan $nick :You are on auto kick..."
} elseif {[matchattr $hand F]} {
adduser $nick [maskhost [getchanhost $nick $chan]]
chattr $nick -F+Ek
newchanban $chan $banmask $owner "caps are not allowed" 60
} else {
adduser $nick [maskhost [getchanhost $nick $chan]]
setuser $nick PASS [rand 987654321]
puthelp "PRIVMSG $chan :$nick: no caps"
chattr $nick +F
}; return 1
}
}
}
proc ctcp_caps {nick uhost hand chan keyword arg} {
if {[isbotnick [lindex [split $chan "@"] 0]] || [lindex [split $chan "@"] 1] != ""} {return 0}
cap:perc:kick $nick $uhost $hand $chan $arg
} |
Thanks _________________ MM |
|
| Back to top |
|
 |
demond Revered One

Joined: 12 Jun 2004 Posts: 3073 Location: San Francisco, CA
|
Posted: Sat Jul 30, 2005 1:28 am Post subject: |
|
|
patch the script, check the result of that [adduser]:
| Code: |
putlog "XXX [adduser $nick [maskhost [getchanhost $nick $chan]]]"
|
|
|
| Back to top |
|
 |
mm Halfop
Joined: 01 Jul 2004 Posts: 78
|
Posted: Sat Jul 30, 2005 1:32 am Post subject: |
|
|
OK, demond, let me try it, thanks. _________________ MM |
|
| Back to top |
|
 |
mm Halfop
Joined: 01 Jul 2004 Posts: 78
|
Posted: Sat Jul 30, 2005 1:45 am Post subject: |
|
|
I tried another another test using putlog "XXX [adduser $nick [maskhost [getchanhost $nick $chan]]]"
| Code: | [01:39] XXX 0
[01:39] Tcl error [ctcp:caps]: No such user.
Currently: No such user.
Currently: while executing
Currently: "setuser $nick PASS [rand 987654321]"
Currently: (procedure "caps:perc:kick" line 24)
Currently: invoked from within
Currently: "caps:perc:kick $nick $uhost $hand $chan $arg "
Currently: (procedure "ctcp:caps" line 3)
Currently: invoked from within
Currently: "ctcp:caps $_ctcpr1 $_ctcpr2 $_ctcpr3 $_ctcpr4 $_ctcpr5 $_ctcpr6" |
it's odd some it works fine and some time it doesn't...oh i am using eggdrop1.6.17
Thanks again _________________ MM |
|
| Back to top |
|
 |
demond Revered One

Joined: 12 Jun 2004 Posts: 3073 Location: San Francisco, CA
|
Posted: Sat Jul 30, 2005 1:59 am Post subject: |
|
|
| so what does the log say? 0 or 1? |
|
| Back to top |
|
 |
|