# tribesserverstat

The latest version of this document can always be found at http://www.augustknights.com/tribesserverstat/.

Working Example

Download

tribesserverstat-1.1.zip (REQUIRES QStat 2.4e or greater)

Summary

tribesserverstat is a set of Perl scripts that generates server status web pages for both Tribes and Tribes 2 servers.

Features

• written in Perl, so it works under Windows (has been tested on Windows 2000/IIS5/ActivePerl 5.6.1.626) and *nix.
• your web server does not need to be on the same machine as your game server
• uses a totally customizable HTML template file so you can easily modify the look and feel
• shows current server map with picture
• shows current players and scores, organized conveniently by team
• shows current server settings
• optionally flag your admin's names in the player list display
• displays player names with html tags, showing color codes for aliases, bots, and tribe tags
• natively supports Tribes 1 servers
• built in support for monitoring multiple servers, T1 and T2 servers supported concurrently
• operating system detection code limiting the changes that are required for win32 support

Requirements

• Perl5 or ActivePerl. Perl5 comes with most popular *nix distributions. If you run a Windows web server, you will need to download and install ActivePerl.
• A web server capable of handling Perl scripts. Apache and Microsoft IIS are known to work. Just about any other web server should too.
• A Tribes2 (or any number of each) game server.
• QStat, available for both *nix and Windows.

Installation

• Copy everything from the images directory included with tribesserverstat into a directory on your web server that is accessible to users viewing your web page. For example, c:\wwwroot\images or /home/httpd/html/images.
• Copy tribesserverstat.pl and tribesserverstatindex.pl (latter required only when monitoring more than one server) into your web server's cgi-bin directory, or equivalent. For example, c:\wwwroot\cgi-bin or /home/httpd/cgi-bin.
• Copy tribesserverstat.conf and tribesserverstatindex.conf (latter required only when monitoring more than one server) into a directory on your web server. It does not need to be a directory users can access via a web page. For example, c:\wwwroot or /home/httpd.
• Copy tribesserverstat.template and tribesserverstatindex.template (latter required only when monitoring more than one server) into a directory on your web server. It does not need to be a directory users can access via a web page. For example, c:\wwwroot or /home/httpd.

Configuration of tribesserverstat.pl and tribesserverstatindex.pl (if applicable)

Edit tribesserverstat.pl and follow the directions in the comments (#).

• $settings{configfile} is the location of your tribesserverstat.conf (or tribesserverstatindex.conf if editing tribesserverstatindex.pl) file. For example, /home/httpd/tribesserverstat.conf. Note that you put the pathname to tribesserverstat.conf, not the URL.

Configuration of tribesserverstat.conf and tribesserverstatindex.conf (if applicable). tribeserverstatindex.conf has fewer options, but the ones that are there are essentially the same as the tribesserverstat.conf file. Both files are WELL documented.

Edit tribesserverstat.conf and follow the directions in the comments (#). I'll list the stuff you can change here as well:

• template is the full path to your template file. Make sure you use forward slashes, even if you are running Windows (i.e. c:/wwwroot/tribesserverstat.template).
• defrefresh is the default number of seconds the web browser should automatically reload this script. The lower the number, the higher the load on your web server.
• minrefresh is the minimum number of seconds in which the web browser can automatically reload this script. The lower the number, the higher the load on your web server. (Only REALLY useful if refresh is specified as a URL option. See URL Options Below.)
• maxplayername is the maximum number of characters in a players name that will be shown in the player list. For example, if set to 15 then player "ir0x0redyourm0mandshel0vedit" would display as "ir0x0redyourm0m...".
• serverip needs to be set to the IP address of your game server.
• serverport needs to be set to the port number of your game server.
• qstatpath is the directory where qstat or qstat.exe is located. Make sure you use forward slashes, even if you are running Windows (i.e. c:/qstat).Do not include the actual qstat executable in this setting, just the directory where it lives.
• imagepath is the full directory path to where your map and icon images are stored. Make sure you use forward slashes, even if you are running Windows (i.e. c:/wwwroot/images).
• imageurl is the URL to where your images are stored (i.e. http://www.yourdomain.com/images). Relative URLs are fine, too (i.e. /images).
• admins is a comma-delimited list of your admin's names. Any player in the player list whose name matches a name you configure here will have a small red dot after their name in the player list.
• timezone is the 3-letter abbreviation of your timezone WITHOUT daylight savings time (i.e. PST for Pacific Standard Time).
• dsttimezone is the 3-letter abbreviation of your timezone while in daylight savings time, or leave blank if you (or your geographic region) chooses not to observe daylight savings time (i.e. PDT for Pacific Daylight Time).
• *color is where you set the colors of the different player types generated by QStat's -htmlnames option. To avoid breaking things, don't set any of the values to the default of another (i.e. defaults of QStat are aliascolor=blue, playercolor=white, botcolor=green, tribecolor=yellow, so DON'T set aliascolor=white, for example).
• debug, if set to 1, will display additional debugging information on the web page. WARNING - this should generally be left off.

Configuration of tribesserverstat.template

You may optionally edit tribesserverstat.template to customize how tribesserverstat looks on your web site (the same goes for tribesserverstatindex.template, but it's MUCH less friendly as most of the page is generated inside the tribesserverstatindex.pl script). You need some basic knowledge of HTML to do this. Using a graphical web page editor such as Microsoft Word will probably break the template file, so make sure you save your original before editing.

There are several Cascading Style Sheet (CSS) elements referenced by tribesserverstat:

• body { background-color: #404040; padding: 0 0 0 0; margin: 2 2 2 2 } defines your page background and margins.
• a:link { text-decoration: none; color: #404040 } defines how hyperlinks are displayed.
• a:visited { text-decoration: none; color: #404040 } defines how visited hyperlinks are displayed.
• a:active { text-decoration: none; color: #E0E0E0 } defines how active (clicked) hyperlinks are diplayed.
• a:hover { text-decoration: none; color: #E0E0E0 } defines how hyperlinks pointed at by the mouse are displayed. As far as I know, this property only works for MSIE.
• .serverinfo { background-color: #707070 } is the background color for the server information section.
• .mapinfo { background-color: #707070 } is the background color for the map information section.
• .playerlist { background-color: #707070 } is the background color for the player score list.
• .teamlist { background-color: #505C9B; color: #C0C0C0 } is the background color and font color for the team score list.
• .ruleslist { background-color: #707070 } is the background color for the server rules and settings list.
• .ruleon { color: #303030 } is the color of the "on" rule bullet.
• .ruleoff { color: #009900 } is the color of the "off" rule bullet.
• .admin { color: #880000 } is the color of the bullet displayed after an admin's name in the player list.
• .map {border-style: solid solid solid solid; border-width: 3; border-color: #606060 } defines how the map image is displayed.

There are also several tribesserverstat variables you may reference:

• $settings{refresh} is the number of seconds until the web page will automatically refresh.
• $settings{imageurl} is the URL to your images directory.
• $settings{tssversion} is the version number of tribesserverstat.pl.
• $servername is the name of your game server.
• $curplayers is the number of currently active players on your game server.
• $maxplayers is the maximum allowed number of players on your game server.
• $mapname is the name of the map currently running on your game server.
• $mapimage is the image of the map currently running on your game server.
• $playerinfo is the player information table (player name, kills, and time on server).
• $rulesinfo is the server rule and settings information table.
• $debug will show a debug section listing set variables.

URL Options

tribesserverstat allows for the use of 3 options in the URL.

• server specifies the server IP address and port number.
• version specifies the version of Tribes running on the server. The value can ONLY be Tribes or Tribes2. Any other value will break things.
• refresh specifies the time (in seconds) between refreshes of the page. If this number is less than the minrefresh setting in the .conf file, the minrefresh value will be used instead.

The tribesserverstatindex.pl script allows only for the specifying of the refresh option. All others will be ignored.

Examples of use:

http://www.augustknights.com/cgi-bin/tribesserverstatindex.pl?refresh=240 will make the tribesserverstatindex.pl page refresh every 4 minutes (240 seconds).
http://www.augustknights.com/cgi-bin/tribesserverstat.pl?server=63.161.23.180:28000&version=Tribes2&refresh=60 will make the tribeserverstat.pl page monitor the Tribe2 server at 63.161.23.180:28000, refreshing the page once per minute (every 60 seconds).

Note that the version option must be specified with the server option in order for tribesserverstat.pl to function properly. tribesserverstat will NOT correctly detect the version of Tribes running on the target server. This is NOT a bug, this is the script operating as designed.

Frequently Asked Questions (FAQ)

Why when I run tribesserverstat on my Windoze...err, I mean Winblows...uhh... Windows-based web server do I receive the following error?

# CGI Error

The specified CGI application misbehaved by not returning a complete set of HTTP headers. The headers it did return are:

    Too late for "-T" option at c:\inetpub\scripts\tribesserverstat.pl line 1.

This is due to the fact that one minor modification needs to be made to tribesserverstat.pl in order for it to work on a Win32 platform (THANKS, ZIPPY!):

In the path to perl, remove the -T at the end or remove the entire line. This path is for Unix/Linux systems and is not needed on Win32 systems. ActivePerl doesn't work with the -T flag so the script will not even run with this there.

How do I add custom images for maps that aren't in the standard distribution?

This is a fairly easy thing to do. First, take a screenshot of the map that makes it more or less identifiable as the map in question whilst in observer mode. Then, crop/shrink the image so that its height is between 200 and 350 pixels and the width is EXACTLY 250 pixels. Make the name of the picture the EXACT same as the map name itself, or, in the case of Tribes 1, the name that tribesserverstat reports (queries of T1 servers produce results that are a bit different than the map name in-game) with a .jpg extension. This includes spaces and proper capitalization (i.e. an image for the map "Dust to Dust" should be called "Dust to Dust.jpg"). Lastly, drop the image into the directory that your <imagepath> directory. Feel free to email all images that you do to me and I'll be happy to include them in a subsequent release.

Why is it that there is one player in the playerlist that doesn't get color attributes with is name/clan tag?

There is a minor bug in QStat 2.4c that misses the first player in the list for some reason. This is due to be fixed in a later version of QStat.

UPDATE: This QStat bug is fixed in version 2.4d and later (though 2.4e is required if monitoring a patch level 24834 or later server).

Why doesn't the team score increment above 0 until it reaches 3? Oh, and, why do only 55 players show up in the player list?

These are apparently "features" of the Tribes2 server itself. I have no information on when/if they'll be resolved, but the resolution of each is definitel

y out of my control. Sorry for any hassle this might cause.

Why doesn't TSS work with Operating System X or Web Server Y?

The short answer is, "I haven't the faintest idea." TSS has been tested exhaustively with Linux + Apache 1.3.x + Perl and Windows 2000 + IIS5 + ActivePerl, but that doesn't mean that other combinations won't work. That said, 90% of all problems relating to TSS seem to revolve around file permissions, misplaced configuration and template files, and incorrect information in the configuration files (in that order, typically). If TSS doesn't work right away, first (and foremost) RTFM, then check that stuff, and THEN come looking for support for your platform. We'll do our best to help you out, but, as in life, nothing is guaranteed.

Support

As long as you've read through and understand this document, I'll support your installation as much as I can. Please limit your questions to tribesserverstat.pl. I can't support Perl, ActivePerl, QStat, Apache, Microsoft IIS or anything else, mostly due to lack of knowledge and otherwise due to lack of time. The tribesserverstat support forum can be found at the August Knights Forums. In addition, I'll do my best to respond to emails sent to me, but don't expect miracles and don't expect anything in the way of rapid response. Try the forums first! ;o)

History

1.1 | added Dr. Chmod's Tribes 1 screenshot pack to the standard distribution fixed a few cosmetic things that were bugging me tested to ensure compliance with T2 patch level 24834
1.01 | fixed all the stuff I broke for Windows users (sorry...)
1.0 | added support for multiple servers added support for Tribes 1 server queries added support for QStat's -htmlnames option (applies to T2 server queries only) added a bunch of silly graphics fixed a couple of minor typos in the code and the documentation removed a couple of bits of extraneous code added expiration META tags to the generated HTML changed the name due to the increased scope of the project felt brave enough to claim this stuff is non-BETA
0.52 | removed some unneeded code in t2serverstat.pl removed references to t2log.pl in t2serverstat.pl and t2serverstat.conf added missing screenshot for map Santuary to images replaced default.jpg with something less, well, dumb
0.51 | minor update to include support for QStat 2.4c
0.5 | initial release

To Do

There's tons of stuff I'd like to add to tribesserverstat, but, unfortunately, until Dynamix expands the amount of information available from the servers via server query and logging, there's not much I CAN do. However, I WILL be making a few changes in upcoming releases:

• better support for mission types other than CTF
• decoding of the "status" rule to give some useful information about the server
• (hmm...I'm sure there's more...suggestions are always welcome...)

Credits

tribesserverstat is based largely upon the work done by Kendokan and others (see below) in the csserverstat product. Modifications and adaptation to Tribes2 were performed by [AK]Zorro with tons of help from #perl over at irc.linux.com (these guys are TONS cooler than the #perl'ers over on EFNET). Thanks to [AK]Palooka for contributing to the code. Special thanks to [AK]NeverRetreat for his tireless efforts in snagging all those beautiful mission screen shots. Additional thanks to Zippy for providing his mad Win32 Perl coding skillz to make sure that all you Windows users were kept happy... Hardware brings to tribesserverstat the -htmlnames code and the inspiration for the META expire tags. Qui9 is the source of inspiration (and code) for the multiple server support. Dr. Chmod bugged me about Tribes 1 support (and then provided a lovely T1 map pack, so I guess I can't complain too much), so there...you happy!?

csserverstat was conceived and scripted by Kendokan. Thanks to [taCo]GrinGo and [GEX]MadMatt for contributing heavily to the creation of cslog.pl, and Unit for not only alpha-testing everything under Windows, but actually making it work. Additional thanks to Marco Grimm and Niklas Aldergren who turned cslog.pl into something that's actually useful, and Nathan Woodcock for testing it under FreeBSD. Thanks, guys.