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 map change notify

Old posts that have not been replied to for several years.
d
deadite66
Halfop
Posts: 74
Joined: Mon May 30, 2005 2:49 am
Location: Great Yarmouth, UK

qstat map change notify

Post by deadite66 »

hi, looking for a script that could run qstat, extract the map name then paste it in a irc chat room when the map changes

qstat output example below

Code: Select all

./qstat -ut2s 217.77.176.198:7777 

ADDRESS           PLAYERS      MAP   RESPONSE TIME    NAME
217.77.176.198:7777    0/32 ONS-Dinora-32p-     61 / 0  ONSOnslaughtGame Titan Internet 32-man Server - Custom Links, Maps + ECE
perhaps run qstat every 30 seconds then announce when the map changes.
only dealing with UT2004 onslaught maps so every map starts with ONS-


many thanks in advance.
User avatar
demond
Revered One
Posts: 3073
Joined: Sat Jun 12, 2004 9:58 am
Location: San Francisco, CA
Contact:

Post by demond »

this isn't quake, ut, cs, doom etc. forum

if you need an eggdrop script that interfaces those games/systems/servers/whatever, provide detailed interface protocol specifications and hope for the best (i.e. someone with nothing better to do to bother and write it for you)

or hope someone will have exactly what you want, chanses of which are slim to none
User avatar
demond
Revered One
Posts: 3073
Joined: Sat Jun 12, 2004 9:58 am
Location: San Francisco, CA
Contact:

Post by demond »

oh wait... you just want to capture some external program's output (I usually get slightly annoyed upon mentioning anything quake, cs, etc.)

here you go:

Code: Select all

bind time - * qstat ;# runs every minute
proc qstat {m h d mo y} {
   if ![catch {set res [exec /path/to/qstat -ut2s 217.77.176.198:7777]}] {
      foreach line [split $res \n] {
         puthelp "privmsg #channel :$line"
      }
   }
}
d
deadite66
Halfop
Posts: 74
Joined: Mon May 30, 2005 2:49 am
Location: Great Yarmouth, UK

Post by deadite66 »

hi thanks for the reply

is it possible to just have the map map name so in the channel it shows something like

eggdropbot: map has changed to ONS-Dinora-32p-

also the script prints the qstat output every minute as some rounds can last over an hour could it be changed to only print the map name when the map changes to a different one?

cheers.
d
deadite66
Halfop
Posts: 74
Joined: Mon May 30, 2005 2:49 am
Location: Great Yarmouth, UK

Post by deadite66 »

so close demond :'( any chance off add those bits?
d
deadite66
Halfop
Posts: 74
Joined: Mon May 30, 2005 2:49 am
Location: Great Yarmouth, UK

Post by deadite66 »

if it maked it any easier you can output to xml or add delimiters
./qstat -ut2s 217.77.176.198:7777 -xml
or
./qstat -ut2s 217.77.176.198:7777 -raw [delimiter]

<?xml version="1.0" encoding="iso-8859-1"?>
<qstat>
<server type="UT2S" address="217.77.176.198" status="UP">
<hostname>217.77.176.198</hostname>
<name>Titan Internet 32-man Server - Custom Links, Maps + ECE</name>
<gametype>ONSOnslaughtGame</gametype>
<map>ONS-DryIce-ECE-32p</map>
<numplayers>0</numplayers>
<maxplayers>32</maxplayers>
<ping>64</ping>
<retries>0</retries>
</server>
</qstat>
m
metroid
Owner
Posts: 771
Joined: Wed Jun 16, 2004 2:46 am

Post by metroid »

I suggest you use something else like the rcon module then, i'm sure that can detect map changes upon change. Having to do it with a timer is probably messy unless you make variables to even see if the map has changed.

Also, there is a script called Qstat4Eggdrop in the TCL Archive. You can use that script to query servers and get the stats/players.
d
deadite66
Halfop
Posts: 74
Joined: Mon May 30, 2005 2:49 am
Location: Great Yarmouth, UK

Post by deadite66 »

i wanted qstat as it'd likely to be updated when new game come out and i was hoping to reuse the script if i could.

but i'm willing to accept any way of doing it atm :(
d
deadite66
Halfop
Posts: 74
Joined: Mon May 30, 2005 2:49 am
Location: Great Yarmouth, UK

Post by deadite66 »

hmm
d
deadite66
Halfop
Posts: 74
Joined: Mon May 30, 2005 2:49 am
Location: Great Yarmouth, UK

Post by deadite66 »

is tcl a poor language?
even with my very basic understanding of (er) basic i managed this.
--------------------------------------------------------------------------------------
WHILE INKEY="" #loop until you hit a key
RUN "/usr/local/bin/qstat -ut2s 217.77.176.198:7777 -xml -of /home/lee/documents/qstat.output" #run qstat & output to a file
OPEN "/home/lee/documents/qstat.output" FOR INPUT as #1 #open the file
FOR a=1 to 6 : LINEINPUT #1, blank$ : NEXT a #skip the first 6 lines
LINEINPUT #1, mapline$ #read the map line
qstat$=MID(mapline$,8,LEN(mapline$)-13) #cut out the map name
IF qstat$<>map$ THEN map$=qstat$ : PRINT map$;" is starting on titan 32p Onslaught" #print the map name and extra text
CLOSE #1 #close the file

PAUSE 60 #wait for a minute
WEND

-------------------------------------------------------------------------------

yet seemingly no one on the net (at least the parts where i've asked this question) can answer it.
odd isn't it :/
d
deadite66
Halfop
Posts: 74
Joined: Mon May 30, 2005 2:49 am
Location: Great Yarmouth, UK

Post by deadite66 »

while i've got something that 1/2 working do you think it's possible to add something to telnet to the bot and use the say command?
User avatar
demond
Revered One
Posts: 3073
Joined: Sat Jun 12, 2004 9:58 am
Location: San Francisco, CA
Contact:

Post by demond »

au contraire, Tcl is a rich language

it's just that apparently nobody is interested in implementing the thing you need in Tcl

congratulations though for helping yourself in Basic :)
d
deadite66
Halfop
Posts: 74
Joined: Mon May 30, 2005 2:49 am
Location: Great Yarmouth, UK

Post by deadite66 »

not quite helping myself as i've no way to get the bot to say it
User avatar
demond
Revered One
Posts: 3073
Joined: Sat Jun 12, 2004 9:58 am
Location: San Francisco, CA
Contact:

Post by demond »

now that's a great occasion for you to learn some Tcl; apparently you already have some programming skills, so it wouldn't be that hard to give Tcl a try; there is hardly any use of Basic these days, but Tcl will enrich your programming experience and possibly help you with your school projects (or who knows, maybe even help you to get a job if you need one)
d
deadite66
Halfop
Posts: 74
Joined: Mon May 30, 2005 2:49 am
Location: Great Yarmouth, UK

Post by deadite66 »

well i've found a way to use the .say command from a script so it looks like i can use a modified version of my basic program :)
Locked