| View previous topic :: View next topic |
| Author |
Message |
nANDu Voice
Joined: 22 May 2005 Posts: 15
|
Posted: Thu Dec 22, 2005 12:16 am Post subject: problem with setuser |
|
|
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 |
|
 |
caesar Mint Rubber

Joined: 14 Oct 2001 Posts: 3741 Location: Mint Factory
|
Posted: Thu Dec 22, 2005 2:14 am Post subject: |
|
|
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 |
|
 |
nANDu Voice
Joined: 22 May 2005 Posts: 15
|
Posted: Thu Dec 22, 2005 8:08 am Post subject: |
|
|
| 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 |
|
 |
Sir_Fz Revered One

Joined: 27 Apr 2003 Posts: 3793 Location: Lebanon
|
Posted: Thu Dec 22, 2005 12:49 pm Post subject: |
|
|
| 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 |
|
 |
nANDu Voice
Joined: 22 May 2005 Posts: 15
|
Posted: Fri Dec 23, 2005 12:29 am Post subject: |
|
|
Laughs @ me, Sir fz, i fixed it long back and never bothered to change it here. Ty anyways  |
|
| Back to top |
|
 |
|