egghelp.org community Forum Index
[ egghelp.org home | forum home ]
egghelp.org community
Discussion of eggdrop bots, shell accounts and tcl scripts.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

caps script
Goto page 1, 2  Next
 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    egghelp.org community Forum Index -> Archive
View previous topic :: View next topic  
Author Message
mm
Halfop


Joined: 01 Jul 2004
Posts: 78

PostPosted: Tue Jul 26, 2005 10:24 pm    Post subject: caps script Reply with quote

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
View user's profile Send private message
Sir_Fz
Revered One


Joined: 27 Apr 2003
Posts: 3793
Location: Lebanon

PostPosted: Tue Jul 26, 2005 10:32 pm    Post subject: Reply with quote

.set errorInfo in partyline to know more about the error.
_________________
Follow me on GitHub

- Opposing

Public Tcl scripts
Back to top
View user's profile Send private message Visit poster's website
mm
Halfop


Joined: 01 Jul 2004
Posts: 78

PostPosted: Tue Jul 26, 2005 10:55 pm    Post subject: Reply with quote

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
View user's profile Send private message
Sir_Fz
Revered One


Joined: 27 Apr 2003
Posts: 3793
Location: Lebanon

PostPosted: Wed Jul 27, 2005 7:21 am    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
mm
Halfop


Joined: 01 Jul 2004
Posts: 78

PostPosted: Thu Jul 28, 2005 10:17 pm    Post subject: Reply with quote

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
View user's profile Send private message
demond
Revered One


Joined: 12 Jun 2004
Posts: 3073
Location: San Francisco, CA

PostPosted: Fri Jul 29, 2005 12:26 am    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
mm
Halfop


Joined: 01 Jul 2004
Posts: 78

PostPosted: Fri Jul 29, 2005 10:32 pm    Post subject: Reply with quote

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
View user's profile Send private message
demond
Revered One


Joined: 12 Jun 2004
Posts: 3073
Location: San Francisco, CA

PostPosted: Sat Jul 30, 2005 12:10 am    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
mm
Halfop


Joined: 01 Jul 2004
Posts: 78

PostPosted: Sat Jul 30, 2005 12:39 am    Post subject: Reply with quote

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
View user's profile Send private message
demond
Revered One


Joined: 12 Jun 2004
Posts: 3073
Location: San Francisco, CA

PostPosted: Sat Jul 30, 2005 1:06 am    Post subject: Reply with quote

well it's still less than 27 lines from the proc's beginning to that [setuser] Razz 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
View user's profile Send private message Visit poster's website
mm
Halfop


Joined: 01 Jul 2004
Posts: 78

PostPosted: Sat Jul 30, 2005 1:07 am    Post subject: Reply with quote

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
View user's profile Send private message
demond
Revered One


Joined: 12 Jun 2004
Posts: 3073
Location: San Francisco, CA

PostPosted: Sat Jul 30, 2005 1:28 am    Post subject: Reply with quote

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

putlog "XXX [adduser $nick [maskhost [getchanhost $nick $chan]]]"
Back to top
View user's profile Send private message Visit poster's website
mm
Halfop


Joined: 01 Jul 2004
Posts: 78

PostPosted: Sat Jul 30, 2005 1:32 am    Post subject: Reply with quote

OK, demond, let me try it, thanks.
_________________
MM
Back to top
View user's profile Send private message
mm
Halfop


Joined: 01 Jul 2004
Posts: 78

PostPosted: Sat Jul 30, 2005 1:45 am    Post subject: Reply with quote

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
View user's profile Send private message
demond
Revered One


Joined: 12 Jun 2004
Posts: 3073
Location: San Francisco, CA

PostPosted: Sat Jul 30, 2005 1:59 am    Post subject: Reply with quote

so what does the log say? 0 or 1?
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    egghelp.org community Forum Index -> Archive All times are GMT - 4 Hours
Goto page 1, 2  Next
Page 1 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Forum hosting provided by Reverse.net

Powered by phpBB © 2001, 2005 phpBB Group
subGreen style by ktauber