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.

Need some help "Gameserver_Query"

Help for those learning Tcl or writing their own scripts.
Post Reply
B
BloodyAngel
Voice
Posts: 3
Joined: Tue Jan 02, 2007 4:54 pm

Need some help "Gameserver_Query"

Post by BloodyAngel »

I am new and have a problem :P

Ok i will write a script wich gets some informations about a gameserver.
The informations can be read via a webbrowser tool named "webspectatort"

here the script:
proc shrink { calc number string start bl} { return [expr [string first "$string" $bl $start] $calc $number] }

proc pub:serverinfo {nick uhost hand chan arg} {
global ip port
set temp [open "ip" r]
set ip [gets $temp]
close $temp
set temp [open "port" r]
set port [gets $temp]
close $temp
if {[catch {set sock [socket www.project-weltherrschaft.de 80] } sockerror]} {
putlog "error: $sockerror"
return 0 } else {
puts $sock "GET http://www.project-weltherrschaft.de/~j ... /index.php HTTP/1.0"
puts $sock "User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:0.9.9)"
puts $sock "Host: www.project-weltherrschaft.de"
puts $sock "Connection: close"
puts $sock ""
flush $sock
while {[eof $sock] != 1} {
set bl [gets $sock]
set player [string range $bl [shrink + 12 "<playername>" 0 $bl] [shrink - 1 "</playername>" 0 $bl]]
set honor [string range $bl [shrink + 13 "<playerhonor>" 0 $bl] [shrink - 1 "</playerhonor>" 0 $bl]]
set bold "\002\00315,1"
set bold2 "\002\0037,1"
putchan $chan "$bold Playerliste:"
putchan $chan "$bold Name: $bold2 $player; $honor"
}}
close $socks
}
So the problem is, that the bot post it line by line

«21:25:54» «+e`On][MusicBox» Playerliste:
«21:25:56» «+e`On][MusicBox» Name: Honor:
«21:25:58» «+e`On][MusicBox» Name: oldboys]Kampf_Sani Honor:
«21:26:00» «+e`On][MusicBox» Name: Honor: 47
«21:26:02» «+e`On][MusicBox» Name: theFAB.clobystar Honor:
«21:26:04» «+e`On][MusicBox» Name: Honor: 81
«21:26:06» «+e`On][MusicBox» Name: [-OMA-]H!t]-[M@n Honor:
«21:26:08» «+e`On][MusicBox» Name: Honor: 95

How can i script it, that he wrote it like this:
Name: oldboys]Kampf_Sani Honor: 85

And why is the first line empty?
r
r0t3n
Owner
Posts: 507
Joined: Tue May 31, 2005 6:56 pm
Location: UK

Post by r0t3n »

Try changing:

Code: Select all

putchan $chan "$bold Name: $bold2 $player; $honor"
to

Code: Select all

putchan $chan "$bold Name: $bold2 $player $honor"
r0t3n @ #r0t3n @ Quakenet
B
BloodyAngel
Voice
Posts: 3
Joined: Tue Jan 02, 2007 4:54 pm

Post by BloodyAngel »

thx for help :)

But this is what i tried before, and it was the same :(

He write it one below the other

Name: Blablabla
Honor: 34

Maybe it could be a fault of the html code?
<td> </td>
<td align="left"><playername>FFC.ZWER</playername></td>
<td align="center"><playerhonor>76</playerhonor></td>
<td align="right"><playerkills>4</playerkills></td>
<td align="right"><playerkia>3</playerkia></td>
<td align="right"><playerscore>50</playerscore></td>
<td align="right"><playergoals>40</playergoals></td>
<td align="right"><playerleader></playerkills></td>
<td align="right"><playerroe>0</playerroe></td>
<td align="right"><playerping>22</playerping></td>
<td> </td>
Hmmm i try it with a hidde line :)
B
BloodyAngel
Voice
Posts: 3
Joined: Tue Jan 02, 2007 4:54 pm

Post by BloodyAngel »

Ok this problems are cleared...

but i got another one :P

hope anybody could help me ;)

This ist the text of the "quellcode"

<!-- <serverinfo> <serverip> 213.19.130.126:1716 </serverip><servername>[Noway-Clan] -Viking Berserkers- </servername><mapname> SF Pipeline </mapname> <spieler> 20/20 </spieler> <runde> 55/7 </runde> <zeit> 6:42 </zeit> -->

But if i will get "zeit" (time) he dont write it correct.

He write it without ":" and without the first number like this:

«14:15:55» «+e`On][MusicBox» Zeit: 42
Post Reply