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.
Help for those learning Tcl or writing their own scripts.
nANDu
Voice
Posts: 15 Joined: Sun May 22, 2005 1:05 am
Post
by nANDu » Thu Dec 22, 2005 12:16 am
I get
Tcl error [pubm:counter]: No such user. even though i've setuser. Can't understand, tell me wht the problem is?
Code: Select all
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]
}
}
<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"
caesar
Mint Rubber
Posts: 3778 Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory
Post
by caesar » Thu Dec 22, 2005 2:14 am
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.
nANDu
Voice
Posts: 15 Joined: Sun May 22, 2005 1:05 am
Post
by nANDu » Thu Dec 22, 2005 8:08 am
Code: Select all
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
}
}
Still the same error:
<Testb0t> [17:06] Tcl error [pubm:counter]: No such user
.
Sir_Fz
Revered One
Posts: 3794 Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:
Post
by Sir_Fz » Thu Dec 22, 2005 12:49 pm
Code: Select all
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.
nANDu
Voice
Posts: 15 Joined: Sun May 22, 2005 1:05 am
Post
by nANDu » Fri Dec 23, 2005 12:29 am
Laughs @ me, Sir fz, i fixed it long back and never bothered to change it here. Ty anyways