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.
i
infos
Post
by infos » Mon May 12, 2003 2:25 pm
Yeah, i'm here again
What is this code problem?
[15:11:53] <infos> !shardstatus
[15:11:54] <AoW_Shard> [15:11] Tcl error [shard_status]: wrong # args: extra words after "else" clause in "if" command
Code: Select all
bind pub - "!shard" shard
proc shard {user uhost hand chan arg} {
global shard status
putlog "$user: !Shard. Sending msg..."
putserv "NOTICE $user :Shard status: $shard - $status"
}
bind pub o|o "!shardstatus" shard_status
proc shard_status {user uhost hand chan arg} {
global shard status
set ok [join [lindex [split $arg] 0]]
if {![lindex $arg 1]} {
putserv "NOTICE $user :Sintax: !ShardStatus On/Off adtional_information"
return
}
if {$ok != "on"} && {$ok != "off"} {
putserv "NOTICE $user :Sintax: !ShardStatus On/Off adtional_information"
return
}
if {$ok == "on"} {
set shard "Online"
}
if {$ok == "off"} {
set shard "Offline"
}
set status [join [lrange [split $arg] 1 end]]
putserv "NOTICE $user :Status do Shard: $shard - $status"
}
i tried to find but i cant see the problem.
thanks
ppslim
Revered One
Posts: 3914 Joined: Sun Sep 23, 2001 8:00 pm
Location: Liverpool, England
Post
by ppslim » Mon May 12, 2003 2:41 pm
Code: Select all
if {$ok != "on"} && {$ok != "off"} {
This is missing some grouping brakets. You are telling the IF to match "$ok != on", and the body is &&.
You should be using
Code: Select all
if {{$ok != "on"} && {$ok != "off"}} {
This is not allways valid, and will return a error, if "[lindex $arg 1]" every return text.
i
infos
Post
by infos » Mon May 12, 2003 3:01 pm
sure. i fixed (think)
but now gives other errormsg
*edit*
¬ my msg: [16:05:48] <infos> !shardstatus on some users with lag.
[15:57:25] <AoW_Shard> [15:57] Tcl error [shard_status]: expected boolean value but got "$ok != "on""
i changed:
and the { } in the other if.
thanks
user
Posts: 1452 Joined: Tue Mar 18, 2003 9:58 pm
Location: Norway
Post
by user » Mon May 12, 2003 3:45 pm
Where did you get the idea of using {}'s as ()'s
make it
Code: Select all
if {($ok != "on") && ($ok != "off")} {...
i
infos
Post
by infos » Mon May 12, 2003 4:17 pm
user wrote: Where did you get the idea of using {}'s as ()'s
make it
Code: Select all
if {($ok != "on") && ($ok != "off")} {...
thanks user