|
|
Yes, this site is VERY old, I have big plans to update it (I have my new site set up but I have yet to migrate all this old stuff over), I'm afraid my priorities are with the Dogsbody Hosting and Camberley Skaters sites at the moment. |
UT2k Query Script
Latest Version 3.00 (04 Jun 2003)
Introduction
This is only the second script that I have actually published so I hope you like
it. This script came about due to the huge interest in the script I wrote for my
website that queried my UT2003 server and returned as much
information as possible about the game to a page. Lots of people e-mailed me asking
for the source so I tidied it up and that is what you see here.
This script works fine with UT2004 I just haven't removed all the references to UT2003 yet :-)
I never claimed to be a professional Perl programmer and as such I would class
this script as perminantly in BETA. I am always looking for comments on my work
so if you see an improvement that can be made to the code, have an idea for another
project or just like the script then please take a moment to
contact me.
|
What it does
This script queries the game server on the GameSpy query port (usually +10
from the base port), the results are then parsed and cleaned up to make
them easier to understand (e.g. True/False is turned into Yes/No) before being
output to an HTML page. The resulting page also includes the meta tag to
refresh and so the browser window can be kept open and the page will
automatically update itself. There are a number of configuration settings
that allow you to tweak the timeout, refresh & title as well as page colour
settings and as an optional setting you can include your own HTML before and
after the query which allows you to keep the same look and feel of your site.
An example of the query script
|
Dependancies
This script requires the following things...
- Perl
- It's a perl script!! You will require v5.003 or above.
- A webserver
- Anything that can cope with with CGI scripts written in Perl.
|
Installation
The setup should be pretty easy...
- Download the script from this site.
- Put the download where you want it.
- Uncompress the file using 'gunzip ut2003-query.tar.gz'.
- Extract the tar using 'tar xvf ut2003-query.tar'.
- Run 'chmod 755 ut2003-query.cgi'
- Edit the path to perl in the first line of ut2003-query.cgi.
- Try running the script without changing any of the configuration, by
default it should query my UT2003 server as long a your webserver can
'see' my UT2003 server 'gamer.dogsbody.org' e.g. your not on a LAN.
- Edit the configuration lines at the top of ut2003-query.cgi for your details...
- $server
- Server hostname or IP address.
- $port
- $queryport
- The Gamespy query port offset, this should be "+10".
- $timeout
- How many seconds to wait for a response from the server.
- $refresh
- How often to refresh the results page in seconds.
- $title
- The title of the page returned which will be used in the
header and at the top of the page.
- $bgcolour
- The background colour of the page returned.
- $fgcolour
- The text colour for the page returned.
- $lncolour
- The colour of hyperlinks on the page returned.
- $headerfile
- Optional: You can leave this field blank which will return
the results in a generic page however you can set this to
the path of an HTML file that can be included before the
results page, this allows you to include whatever else you
like on the results page to fit in with the rest of your site.
Be warned the "<HTML><HEAD><META HTTP-EQUIV=REFRESH...>" tags
are returned at the top of all pages so your HTML should carry
on from there. If you use this $bgcolour, $fgcolour &
$lncolour will not be used as you can specify your own <BODY>
tag and $title will only be used for the text at the top of
the page.
- $footerfile
- Optional: As with the headerfile, this is the path to an HTML
file that can be used to close off any tables used in the
headerfile. This file SHOULD include the </BODY> & </HTML>
tags.
- $pictureurl
- Enter a URL or relational path to images of maps that this
query should use. The text "MATCHTHIS" will be replaced with
the map filename in lowercase. The default for this links to
the images in my site which you are welcome to use,
more details.
- $script
- This should be set to the filename of the script (yes the file
you are editing), this is used to call the script back and
refresh the HTML page. If you set this to "$ENV{SCRIPT_URI}"
it will automatically be set to the correct name on most web
servers (tested on Apache, iPlanet & Netscape Web servers).
- And hopefully it will all work :-) Happy Fragging
|
Notes / Known Bugs
The numbers of players on the server is returned twice, once as a player
count which is reported in the bottom left table and also as each individual
player statistic. Sometimes these two counts don't tally up with the player
count reporting a higher number. As far as I can tell this is correct as
the player count reports on the number of connections to the server which does
not necessarily mean they are playing the game (e.g. they are downloading the
map or haven't pressed fire to join the game)
The translocator field doesn't work, data should be returned to show is the
translocator can be used on the server however the data is empty each time.
This seems to be a bug in UT2003, If anyone sees that this is fixed in a
patch or something I will see if I can query that and turn this back on.
|
Changelog
- 3.00 - 04 Jun 2003
- First public release of code - removed all site specific stuff and tidied up.
- 2.xx - Various Dates
- Complete re-write of code using own UDP query to UT2003 server.
- 1.xx - Various Dates
- First write of a query script that used qstat to get details from server.
|
|
|