This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

caps script

Old posts that have not been replied to for several years.
m
mm
Halfop
Posts: 78
Joined: Thu Jul 01, 2004 10:24 pm

caps script

Post by mm »

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
Tcl error [ctcp_caps]: No such user.
, i'll appreciate for your help.

Code: Select all

#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
User avatar
Sir_Fz
Revered One
Posts: 3794
Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:

Post by Sir_Fz »

.set errorInfo in partyline to know more about the error.
m
mm
Halfop
Posts: 78
Joined: Thu Jul 01, 2004 10:24 pm

Post by mm »

Thanks, Sir_Fz.

This happens once in a while, so should I type .set errorInfo after i see that error? or


thanks
MM
User avatar
Sir_Fz
Revered One
Posts: 3794
Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:

Post by Sir_Fz »

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
unbind dcc n tcl *dcc:tcl
and the line after it as well (for the .set dcc command)
m
mm
Halfop
Posts: 78
Joined: Thu Jul 01, 2004 10:24 pm

Post by mm »

HI Sir_Fz, I get this

Code: Select all

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: Select all

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
User avatar
demond
Revered One
Posts: 3073
Joined: Sat Jun 12, 2004 9:58 am
Location: San Francisco, CA
Contact:

Post by demond »

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
m
mm
Halfop
Posts: 78
Joined: Thu Jul 01, 2004 10:24 pm

Post by mm »

Yeah, sometime i see error message that "No such user" but user is on the channel. I have these codes.

Code: Select all

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: Select all

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
User avatar
demond
Revered One
Posts: 3073
Joined: Sat Jun 12, 2004 9:58 am
Location: San Francisco, CA
Contact:

Post by demond »

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?
m
mm
Halfop
Posts: 78
Joined: Thu Jul 01, 2004 10:24 pm

Post by mm »

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.
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
User avatar
demond
Revered One
Posts: 3073
Joined: Sat Jun 12, 2004 9:58 am
Location: San Francisco, CA
Contact:

Post by demond »

well it's still less than 27 lines from the proc's beginning to that [setuser] :P 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)
m
mm
Halfop
Posts: 78
Joined: Thu Jul 01, 2004 10:24 pm

Post by mm »

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: Select all

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: Select all

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
User avatar
demond
Revered One
Posts: 3073
Joined: Sat Jun 12, 2004 9:58 am
Location: San Francisco, CA
Contact:

Post by demond »

patch the script, check the result of that [adduser]:

Code: Select all

putlog "XXX [adduser $nick [maskhost [getchanhost $nick $chan]]]"
m
mm
Halfop
Posts: 78
Joined: Thu Jul 01, 2004 10:24 pm

Post by mm »

OK, demond, let me try it, thanks.
MM
m
mm
Halfop
Posts: 78
Joined: Thu Jul 01, 2004 10:24 pm

Post by mm »

I tried another another test using putlog "XXX [adduser $nick [maskhost [getchanhost $nick $chan]]]"

Code: Select all

[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
User avatar
demond
Revered One
Posts: 3073
Joined: Sat Jun 12, 2004 9:58 am
Location: San Francisco, CA
Contact:

Post by demond »

so what does the log say? 0 or 1?
Locked