| View previous topic :: View next topic |
| Author |
Message |
L0g1c Voice
Joined: 01 Nov 2005 Posts: 1
|
Posted: Tue Nov 01, 2005 4:58 pm Post subject: Qstat |
|
|
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 |
|
 |
Sir_Fz Revered One

Joined: 27 Apr 2003 Posts: 3793 Location: Lebanon
|
Posted: Tue Nov 01, 2005 6:01 pm Post subject: |
|
|
Try replacing
| Code: | | append string $query |
with | Code: | | append string "$query " |
_________________ Follow me on GitHub
- Opposing
Public Tcl scripts |
|
| Back to top |
|
 |
|