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.

getuser error

Old posts that have not been replied to for several years.
r
r0t3n
Owner
Posts: 507
Joined: Tue May 31, 2005 6:56 pm
Location: UK

getuser error

Post by r0t3n »

error in my userlist:

Tcl error [user_list]: list element in quotes followed by "HOSTS"]" instead of space

The script:


Code:

Code: Select all

bind pub o|f !userlist user_list 

proc user_list {nick uhost hand chan text} { 
if {[userlist |amnovf $chan] == ""} { 
putserv "NOTICE $nick :No users found in my userlist for $chan " 
return 0 
} 
putquick "NOTICE $nick :Userlist for $chan " 
foreach user [userlist |amnovf $chan] { 
if {[set usersnick [hand2nick $user]] == ""}  
putquick "NOTICE $nick :(( Handle: $user || Nickname: Offline, or not in any of the bots channels. || Host(s): [getuser $user "HOSTS"] || Channel Flags: +[lindex [split [chattr $user $chan] |] 1] ))" 
} else { 
if {[set usersnick [hand2nick $user]] != ""}  
putquick "NOTICE $nick :(( Handle: $user || Nickname: $usersnick || Host(s): [getuser $user "hosts"] || Channel Flags: +[lindex [split [chattr $user $chan] |] 1] ))" 
} 
putquick "NOTICE $nick :End of list." 
} 

putlog "Userlist.tcl By Tosser^^ Loaded" 
I dont know whats wrong, i tried [join [getuser $user "hosts"]" ","] but that dont work, please help ;p

Thanks in advance!![/code]
r0t3n @ #r0t3n @ Quakenet
User avatar
Sir_Fz
Revered One
Posts: 3794
Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:

Post by Sir_Fz »

Code: Select all

getuser $user HOSTS
or

Code: Select all

getuser $user "HOSTS"
should work fine.

PS: Make sure you don't have the line split with some enter by mistake after copy paste.
r
r0t3n
Owner
Posts: 507
Joined: Tue May 31, 2005 6:56 pm
Location: UK

Post by r0t3n »

ok, thanks Sir_fz
r0t3n @ #r0t3n @ Quakenet
User avatar
demond
Revered One
Posts: 3073
Joined: Sat Jun 12, 2004 9:58 am
Location: San Francisco, CA
Contact:

Post by demond »

nope, it's not that

Code: Select all

getuser $user "HOSTS"
is 100% equivalent to

Code: Select all

getuser $user HOSTS
the bug is most likely in the usage of [hand2nick], which may return a list - and you incorrectly assume it always returns a single nick
r
r0t3n
Owner
Posts: 507
Joined: Tue May 31, 2005 6:56 pm
Location: UK

Post by r0t3n »

Hmm, im not using the $usersnick var, im using $user so i should think thats not causing the error ...
r0t3n @ #r0t3n @ Quakenet
User avatar
demond
Revered One
Posts: 3073
Joined: Sat Jun 12, 2004 9:58 am
Location: San Francisco, CA
Contact:

Post by demond »

move those [getuser] and [chattr] out of the notice and use .set errorInfo to obtain full backtrace of the error
User avatar
demond
Revered One
Posts: 3073
Joined: Sat Jun 12, 2004 9:58 am
Location: San Francisco, CA
Contact:

Post by demond »

Tosser^^ wrote:Hmm, im not using the $usersnick var, im using $user so i should think thats not causing the error ...
you don't even know your code ;)

Code: Select all

if {[set usersnick [hand2nick $user]] != ""} 
putquick "NOTICE $nick :(( Handle: $user || Nickname: $usersnick || Host(s): [getuser $user "hosts"] || Channel Flags: +[lindex [split [chattr $user $chan] |] 1] ))"
r
r0t3n
Owner
Posts: 507
Joined: Tue May 31, 2005 6:56 pm
Location: UK

Post by r0t3n »

Hmm, i got past that error now, something else is wrong, i cant seem to find the error because the eggdrop crashes before i have a chance

Code: Select all

bind pub o|f !userlist user_list 

proc user_list {nick uhost hand chan text} { 
if {[userlist |amnovf $chan] == ""} { 
putserv "NOTICE $nick :No users found in my userlist for $chan " 
return 0 
} 
putquick "NOTICE $nick :Userlist for $chan " 
foreach user [userlist |amnovf $chan] {
set usersnick [hand2nick $user]
if {[$usersnick == ""} {
putquick "NOTICE $nick :(( Handle: $user || Nickname: Offline, or not in any of the bots channels. || Host(s): [getuser $user HOSTS] || Channel Flags: +[lindex [split [chattr $user $chan] |] 1] ))"
}
} else {
if {[$usersnick != ""} {  
putquick "NOTICE $nick :(( Handle: $user || Nickname: $usersnick || Host(s): [getuser $user HOSTS] || Channel Flags: +[lindex [split [chattr $user $chan] |] 1] ))"
}
}
putquick "NOTICE $nick :End of list." 
}
}

putlog "Userlist.tcl By Tosser^^ Loaded"
I think it maybe a bracket error, please help ;p
r0t3n @ #r0t3n @ Quakenet
User avatar
demond
Revered One
Posts: 3073
Joined: Sat Jun 12, 2004 9:58 am
Location: San Francisco, CA
Contact:

Post by demond »

crashes? care to post a log and DEBUG file?
r
r0t3n
Owner
Posts: 507
Joined: Tue May 31, 2005 6:56 pm
Location: UK

Post by r0t3n »

[19:25] Tcl error in file 'eggdrop.conf':
[19:25] invalid command name "}"
while executing
"}"
(file "scripts/userlist.tcl" line 21)
invoked from within
"source scripts/userlist.tcl"
(file "eggdrop.conf" line 1348)
[19:25] * CONFIG FILE NOT LOADED (NOT FOUND, OR ERROR)
r0t3n @ #r0t3n @ Quakenet
User avatar
demond
Revered One
Posts: 3073
Joined: Sat Jun 12, 2004 9:58 am
Location: San Francisco, CA
Contact:

Post by demond »

that's not a crash dude

remove your script from bot's config, start your bot, log in on party-line, load your script (.tcl source scripts/yourscript.tcl), obtain error traceback (.set errorInfo)
r
r0t3n
Owner
Posts: 507
Joined: Tue May 31, 2005 6:56 pm
Location: UK

Post by r0t3n »

<[-Guard-]> [19:35] Tcl error in file 'eggdrop.conf':
<[-Guard-]> [19:35] invalid command name "}"
<[-Guard-]> while executing
<[-Guard-]> "}"
<[-Guard-]> (file "scripts/userlist.tcl" line 21)
<[-Guard-]> invoked from within
<[-Guard-]> "source scripts/userlist.tcl"
<[-Guard-]> (file "eggdrop.conf" line 1353)
<[-Guard-]> [19:35] * CONFIG FILE NOT LOADED (NOT FOUND, OR ERROR)
-
DCC session closed

Thats the error i get
r0t3n @ #r0t3n @ Quakenet
User avatar
^DooM^
Owner
Posts: 772
Joined: Tue Aug 26, 2003 5:40 pm
Location: IronForge
Contact:

Post by ^DooM^ »

Err your script was a complete and utter mess. My 1 year old could do a better job.

If you use indentations properly you would see where you have gone wrong and you aren't using else properly.

I didn't check your putquick lines but the script should not crash now.

try this.

Code: Select all

bind pub o|f !userlist user_list

proc user_list {nick uhost hand chan text} {
    if { [userlist |amnovf $chan] == "" } {
        putserv "NOTICE $nick :No users found in my userlist for $chan"
    } else {
        putquick "NOTICE $nick :Userlist for $chan"
        foreach user [userlist |amnovf $chan] {
            set usersnick [hand2nick $user]
            if { $usersnick == "" } {
                putquick "NOTICE $nick :(( Handle: $user || Nickname: Offline, or not in any of the bots channels. || Host(s): [getuser $user HOSTS] || Channel Flags: +[lindex [split [chattr $user $chan] |] 1] ))"
            } else {  
                putquick "NOTICE $nick :(( Handle: $user || Nickname: $usersnick || Host(s): [getuser $user HOSTS] || Channel Flags: +[lindex [split [chattr $user $chan] |] 1] ))"
            }
        }
        putquick "NOTICE $nick :End of list."
    }
}
The lifecycle of a noob is complex. Fledgling noobs gestate inside biometric pods. Once a budding noob has matured thru gestation they climb out of their pod, sit down at a PC, ask a bunch of questions that are clearly in the FAQ, The Noob is born
User avatar
demond
Revered One
Posts: 3073
Joined: Sat Jun 12, 2004 9:58 am
Location: San Francisco, CA
Contact:

Post by demond »

balance your braces, make sure you use [hand2nick] correctly, use proper indentation throughout your code
r
r0t3n
Owner
Posts: 507
Joined: Tue May 31, 2005 6:56 pm
Location: UK

Post by r0t3n »

Thanks dude, it works great, thanks again ;p !!
r0t3n @ #r0t3n @ Quakenet
Locked