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.

Qstat

Help for those learning Tcl or writing their own scripts.
Post Reply
L
L0g1c
Voice
Posts: 1
Joined: Tue Nov 01, 2005 4:48 pm

Qstat

Post by L0g1c »

Hi! I want to split the message in to serveral notices if the message is too big and it can't be displayed in one notice. The problem is that it deletes all the spaces (skip the beggining and look at the text below "set msg [split $line]")

Code: Select all

proc qstat:results {chan nick pf} {
   while {[gets $pf line] >= 0} {
      if {[string match "DOWN*" $line]} {
         putquick "NOTICE $nick :Connection refused while querying server."
         break
      } elseif {[string match "HOSTNOTFOUND*" $line]} {
         putquick "NOTICE $nick :Host not found."
         break
      } elseif {[string match "TIMEOUT*" $line]} {
         putquick "NOTICE $nick :Timeout while querying server."
         break
      }
      set msg [split $line]
      set string ""
      foreach query $msg {
         if {[string length $string] + [string length $query] < 458} {
            append string $query
         } else {
            putquick "NOTICE $nick :$string"
            set string ""
         }
      }
      if {$string != ""} {
         putquick "NOTICE $nick :$string"
      }
   }
}
The result I get:

Code: Select all

[Server:TestServer¤IP:cs.gather.lt[212.122.68.248:27015]¤Players:18/19¤ Map:de_dust2¤Password:No¤NextMap:cs_estate¤TimeLeft:08:21¤Cheating-Death:4.21.0]
Should be:

Code: Select all

[ Server: Test Server ¤ IP: cs.gather.lt [212.122.68.248:27015] ¤ Players: 18/19 ¤ Map : de_dust2 ¤ Password : No ¤ Next Map: cs_estate ¤ Time Left : 08:21 ¤ Cheating-Death: 4.21.0 ]
Any ideas how to solve this ?

P.S.

There is one more problem:

Code: Select all

[22:52] -Bot- [Player:Nick-Frags:16][Player:
[22:52] -Bot- -Frags:5]
As you can see, the second player's name was ignored. I'd like to solve this problem too. Thanks for you help!
User avatar
Sir_Fz
Revered One
Posts: 3793
Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:

Post by Sir_Fz »

Try replacing

Code: Select all

append string $query
with

Code: Select all

append string "$query "
Post Reply