egghelp.org community Forum Index
[ egghelp.org home | forum home ]
egghelp.org community
Discussion of eggdrop bots, shell accounts and tcl scripts.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Qstat

 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help
View previous topic :: View next topic  
Author Message
L0g1c
Voice


Joined: 01 Nov 2005
Posts: 1

PostPosted: Tue Nov 01, 2005 4:58 pm    Post subject: Qstat Reply with quote

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:
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:
[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:
[ 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:
[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!
Back to top
View user's profile Send private message
Sir_Fz
Revered One


Joined: 27 Apr 2003
Posts: 3793
Location: Lebanon

PostPosted: Tue Nov 01, 2005 6:01 pm    Post subject: Reply with quote

Try replacing
Code:
append string $query

with
Code:
append string "$query "

_________________
Follow me on GitHub

- Opposing

Public Tcl scripts
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help All times are GMT - 4 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Forum hosting provided by Reverse.net

Powered by phpBB © 2001, 2005 phpBB Group
subGreen style by ktauber