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.
Old posts that have not been replied to for several years.
daltonc
Voice
Posts: 29 Joined: Wed Apr 27, 2005 8:50 pm
Post
by daltonc » Sun May 08, 2005 9:49 pm
how come this isnt working? Its saying.. can't set "user(blah)": variable isn't array
Code: Select all
set get_users [mysql_query "SELECT * FROM bot_users"]
foreach user_info $get_users {
set user_name [lindex $user_info 2]
set user($user_name) [lindex $user_info 3]
set user_email($user_name) [lindex $user_info 4]
}
Galadhrim
Op
Posts: 123 Joined: Fri Apr 11, 2003 8:38 am
Location: Netherlands, Enschede
Post
by Galadhrim » Mon May 09, 2005 2:57 am
seems you are trying to append/prepend array entries to a non-array variable. I dont recognize this syntax:
set user($user_name) I'm no TCL wizkid but if that doesn't mean anythng you have your bug
De Kus
Revered One
Posts: 1361 Joined: Sun Dec 15, 2002 11:41 am
Location: Germany
Post
by De Kus » Mon May 09, 2005 3:45 am
you probably initialized the var like 'set user ""' or something like that, but you musn't. you can use 'set user() ""', but however it redudant. each element needs to be initialized to not cause an error, so you need to check 'info exists user(element)' anyway, if you want to read and not sure about the existens.
De Kus
StarZ|De_Kus, De_Kus or DeKus on IRC
Copyright © 2005-2009 by De Kus - published under
The MIT License
Love hurts, love strengthens...
daltonc
Voice
Posts: 29 Joined: Wed Apr 27, 2005 8:50 pm
Post
by daltonc » Mon May 09, 2005 3:35 pm
mmmm, nope. That little piece of code isnt in a proc. Its like an on startup event. Its not working though
'dalton' is in my database as a name. Its saying cant set user(dalton): variable isnt array.
As this is an on start event it is the first time I Set the variable.
stdragon
Owner
Posts: 959 Joined: Sun Sep 23, 2001 8:00 pm
Contact:
Post
by stdragon » Mon May 09, 2005 6:08 pm
Maybe it's an argument to your proc? What De Kus said is really the only way this error could be happening.. you already have a variable called user and it's not an array.
daltonc
Voice
Posts: 29 Joined: Wed Apr 27, 2005 8:50 pm
Post
by daltonc » Mon May 09, 2005 9:29 pm
Yea, I got it working, I just chaned user to user_account ..
Now this is saying:
missing close-brace: possible unbalanced brace in comment
Code: Select all
proc command:lookup {nick uhost hand chan arg} {
if {[isop $nick $chan]} {
set command [lindex $arg 0]
switch -- $command {
case "chaninfo" {
set chan_name [lindex $arg 1]
putnotc $nick "Looking up channel information for [lindex $arg 1]"
set get_chaninfo [mysql_query "SELECT * FROM bot_channels WHERE chan_name='$chan_name'"]
if {[info exist get_chaninfo]} {
foreach chan_info $get_chaninfo {
set channel_bot [lindex $chan_info 3]
set channel_trigger [lindex $chan_info 4]
set channel_greeting [lindex $chan_info 5]
set channel_owner_host [lindex $chan_info 2]
set channel_id [lindex $chan_info 0]
}
set get_chanowner [mysql_query "SELECT * FROM bot_users WHERE user_host='$channel_owner_host'"]
foreach owner_info $get_chanowner {
set channel_owner_account [lindex $owner_info 1]
}
putnotc $nick "[lindex $arg 1] Information"
putnotc $nick "Bot: $channel_bot"
putnotc $nick "Trigger: $channel_trigger"
putnotc $nick "Greeting: $channel_greeting"
putnotc $nick "Owner: $channel_owner_account"
putnotc $nick "ID# $channel_id"
} else {
putnotc $nick "There is not database entry for [lindex $arg 1]"
}
}
} else {
putnotc $nick "Error(1): You lack access to use botnet commands"
}
}
Sir_Fz
Revered One
Posts: 3794 Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:
Post
by Sir_Fz » Tue May 10, 2005 4:05 am
Try changing $arg to [split $arg]
De Kus
Revered One
Posts: 1361 Joined: Sun Dec 15, 2002 11:41 am
Location: Germany
Post
by De Kus » Tue May 10, 2005 4:33 am
you are missing a close bracet at the end of the proc, and your switch expression will most like cause this:
tcl: evaluate (.tcl): switch -- hello {case "hello" {return 2}}
Tcl error: extra switch pattern with no body
De Kus
StarZ|De_Kus, De_Kus or DeKus on IRC
Copyright © 2005-2009 by De Kus - published under
The MIT License
Love hurts, love strengthens...
greenbear
Owner
Posts: 733 Joined: Mon Sep 24, 2001 8:00 pm
Location: Norway
Post
by greenbear » Tue May 10, 2005 10:15 am
daltonc wrote: missing close-brace: possible unbalanced brace in comment
Most likely you have a commented line (one of those with a # in front
) somewhere else in the script, that you didnt paste here.