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.

Shard status

Old posts that have not been replied to for several years.
Locked
i
infos

Shard status

Post by infos »

Yeah, i'm here again :P
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
p
ppslim
Revered One
Posts: 3914
Joined: Sun Sep 23, 2001 8:00 pm
Location: Liverpool, England

Post by ppslim »

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"}} {

Code: Select all

if {![lindex $arg 1]} {
This is not allways valid, and will return a error, if "[lindex $arg 1]" every return text.
i
infos

Post by infos »

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:

Code: Select all

  if {[lindex $arg 1] == ""} {
and the { } in the other if.
thanks
User avatar
user
&nbsp;
Posts: 1452
Joined: Tue Mar 18, 2003 9:58 pm
Location: Norway

Post by user »

Where did you get the idea of using {}'s as ()'s :P

make it

Code: Select all

if {($ok != "on") && ($ok != "off")} {... 
i
infos

Post by infos »

user wrote:Where did you get the idea of using {}'s as ()'s :P

make it

Code: Select all

if {($ok != "on") && ($ok != "off")} {... 
thanks user :)
Locked