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 

problem with setuser

 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help
View previous topic :: View next topic  
Author Message
nANDu
Voice


Joined: 22 May 2005
Posts: 15

PostPosted: Thu Dec 22, 2005 12:16 am    Post subject: problem with setuser Reply with quote

I get Tcl error [pubm:counter]: No such user. even though i've setuser. Can't understand, tell me wht the problem is?

Code:

bind pubm -|- * pubm:counter

proc pubm:counter {nick uhost hand chan args} {

  if {[matchattr $hand b]} {
    chattr $hand -|-T $chan
    return 1
  }

  if {([isop $nick $chan]) || ([isvoice $nick $chan])} {
 
    putlog "pubm counter hand is $hand for XTRA sc$chan - [getuser $hand XTRA sc$chan]"

    if {$hand == "*"} {
      setuser $nick XTRA sc$chan 1
      setuser $nick XTRA st$chan [unixtime]
      chattr $hand -|+T $chan
      putlog "pubm counter setting user $nick st$chan for the first time"
      return
    }

    set cc [getuser $hand XTRA sc$chan]
    set ct [getuser $hand XTRA st$chan]

    if {$cc == ""} {set cc 0}
    if {$ct == ""} {set ct 0}

    if {[expr [unixtime] - $ct] < 2} {
      return 0
    }

    incr cc

    putlog "pubm counter incremented user: $nick $hand $cc"

    setuser $hand XTRA sc$chan $cc
    setuser $hand XTRA st$chan [unixtime]
  }
}

Quote:

<Testb0t> [09:00] pubm counter hand is * -
<Testb0t> [09:00] Tcl error [pubm:counter]: No such user.
<Testb0t> [09:00] pubm counter hand is * -
<Testb0t> [09:00] Tcl error [pubm_counter]: No such user.
<Testb0t> [09:00] <test-counter> hello
--
<Testb0t> [09:03] #nANDu# set errorInfo
<Testb0t> Currently: No such user.
<Testb0t> Currently: while executing
<Testb0t> Currently: "setuser $nick XTRA sc$chan 0"
<Testb0t> Currently: (procedure "pubm:counter" line 12)
<Testb0t> Currently: invoked from within
<Testb0t> Currently: "pubm:counter $_pubm1 $_pubm2 $_pubm3 $_pubm4 $_pubm5"
Back to top
View user's profile Send private message
caesar
Mint Rubber


Joined: 14 Oct 2001
Posts: 3741
Location: Mint Factory

PostPosted: Thu Dec 22, 2005 2:14 am    Post subject: Reply with quote

If it's not a user tham has 'b' flag then the proc continues normaly, so you will have to add a 'validuser $hand' statement in or before the ' if {([isop $nick $chan]) || ([isvoice $nick $chan])} { ' line.
_________________
Once the game is over, the king and the pawn go back in the same box.
Back to top
View user's profile Send private message
nANDu
Voice


Joined: 22 May 2005
Posts: 15

PostPosted: Thu Dec 22, 2005 8:08 am    Post subject: Reply with quote

Code:

bind pubm -|- * pubm:counter

proc pubm:counter {nick uhost hand chan args} {

   if {![validuser $nick]} {
      setuser $nick XTRA sc$chan
            putlog "set user $nick - [getuser $nick XTRA sc$chan]"
   }

   if {([isop $nick $chan]) || ([isvoice $nick $chan])} {

            putlog "pubm counter hand is $hand for XTRA sc$chan = [getuser $hand XTRA sc$chan]"

      set cc [getuser $hand XTRA sc$chan]
      set ct [getuser $hand XTRA st$chan]

      if {$cc == ""} {set cc 0}
      if {$ct == ""} {set ct 0}
      if {[expr [unixtime] - $ct] < 2} {return 0}

      incrchanactivity $chan
      incr cc
         putlog "pubm counter incremented user: $nick $hand $cc"
      setuser $nick XTRA sc$chan $cc
      setuser $nick XTRA st$chan [unixtime]
      chattr $nick -|+T $chan

   }
}

Quote:
Still the same error:
<Testb0t> [17:06] Tcl error [pubm:counter]: No such user
.
Back to top
View user's profile Send private message
Sir_Fz
Revered One


Joined: 27 Apr 2003
Posts: 3793
Location: Lebanon

PostPosted: Thu Dec 22, 2005 12:49 pm    Post subject: Reply with quote

Code:
if {![validuser $nick]} {
      setuser $nick XTRA sc$chan
      putlog "set user $nick - [getuser $nick XTRA sc$chan]"
}

This means, if the user does not exist then setuser....etc Does that make any sense to you?

You need to do it vise-versa, if the user exists then setuser ...etc If you want to add the user if it doesn't exist then check out the adduser command in Tcl-commands.doc.
_________________
Follow me on GitHub

- Opposing

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


Joined: 22 May 2005
Posts: 15

PostPosted: Fri Dec 23, 2005 12:29 am    Post subject: Reply with quote

Laughs @ me, Sir fz, i fixed it long back and never bothered to change it here. Ty anyways Wink
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help All times are GMT - 4 Hours
Page 1 of 1

 
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