::Autoq3stats v1.2

::Autoq3stats.bat uses several other programs and batch files to copy,
::process, rename and ftp the stats for Quake III Arena.
::It also restarts Quake based upon the config files that
::are setup and stored in the baseq3 or MOD folder or where ever you 
::point it to.

::The files needed with this batch file are

::AEstats
::AEstats parses and processes the information from the games.log file in 
::Quake and other games into html files, showing the statistics of the 
::game play for each player
::AEstats (http://www.planetquake.com/aeons/aestats/)
::copyright (c) 1998-2001 by christoph 'æon' loewe

::setdate.bat
::setdate.bat which is included with this archive, a version of timedate.bat 
::written by:(http://www.ericphelps.com), used to find the current date for 
::the purpose of verifying and renaming files for archiving.

::kill.exe
::kill.exe also included with this archive. Kill is used to shutdown quake
::(DO NOT CHANGE THE PARAMETERS BELOW in the section that shuts down Quake),
::unless kill does not shutdown quake. You may need to use tlist.exe to
::see the proper process name that Quake is using in order for kill to
::operate properly.

::autoq3stats.bat, along with setdate.bat and kill.exe must be placed in the
::root directory of AEstats in order for it to properly process directory
::changes. OPTIONAL - add it as a task in task scheduler to run daily
::(preferably at a time when no-one will be using the Quake server).


@echo off


::This section shuts down Quake so the games.log file can be copied,
::renamed and deleted.
kill Quake3.exe


::This section checks to see if there is a file with a current date
::already in the AEstats folder, if there is then Quake will restart without
::processing the log files. This will keep from reprocessing and over
::writting the last stats taken for the current date.
call setdate.bat
If Exist %date%.log goto restart


::This section will change to the Quake directory and copy games.log
::file to the AEstats directory. If the games.log file does not exist,
::then quake will restart with out processing any of the files. This will 
::speed up the process and keep from having blank html files from being 
::sent to the webserver
::NOTE - Change to where games.log file and AEstats directory are
::located if not correct.
::ie.. C:\Progra~1\QuakeI~1\Beryll~1 and C:\Progra~1\AEstats
cd C:\Progra~1\QuakeI~1\baseq3
copy C:\Progra~1\QuakeI~1\baseq3\games.log C:\Progra~1\aestats\games.log


::This section will change to the AEstats directory, parse the
::games.log file creating the meta file and will then process the
::meta file creating the html files. 
::This section will also get current date and rename games.type
::files to date.type format and delete the temp batch files created
::by the setdate batch file.
cd C:\Progra~1\aestats
preAEs.exe -q3a games.log
AEstats.exe games.mlg
call setdate.bat
ren games.log %date%.log
ren games.mlg %date%.mlg
del C:\Progra~1\aestats\c*t.bat


::This section deletes the old stat files from server and transfers
::the new stat files to the root folder.
::Change the directory information to whatever your root directory is.
echo open your.ip.on.server >tftp1
echo login>>tftp1
echo password>>tftp1
echo cd /your/directory/where/stat files/will go >>tftp1
echo delete /your/directory/where/stat files/will go/AEstats.html >>tftp1
echo delete /your/directory/where/stat files/will go/AEstatsBestOfs.html >>tftp1
echo delete /your/directory/where/stat files/will go/AEstatsDiffMatrix.html >>tftp1
echo delete /your/directory/where/stat files/will go/AEstatsFAQ.html >>tftp1
echo delete /your/directory/where/stat files/will go/AEstatsGlobal.html >>tftp1
echo delete /your/directory/where/stat files/will go/AEstatsHelp.html >>tftp1
echo delete /your/directory/where/stat files/will go/AEstatsRanking.html >>tftp1
echo delete /your/directory/where/stat files/will go/AEstatsRankMatrix.html >>tftp1
echo lcd C:\Progra~1\aestats\stats >>tftp1
echo prompt >>tftp1
echo ascii >>tftp1
echo mput C:\Progra~1\aestats\stats\*.htm* >>tftp1
echo bye >>tftp1
ftp -s:tftp1


::This section deletes the old stat files from the players folder
::on the server and transfers new stat files to players folder.
::If more than 15 players are logged, you will need to add lines
::to delete the rest of the files
echo open your.ip.on.server >tftp2
echo login>>tftp2
echo password>>tftp2
echo cd /your/directory/where/stat files/will go >>tftp2
echo delete /your/directory/where/stat files/will go/players/AEstatsPlayer0.html >>tftp2
echo delete /your/directory/where/stat files/will go/players/AEstatsPlayer1.html >>tftp2
echo delete /your/directory/where/stat files/will go/players/AEstatsPlayer2.html >>tftp2
echo delete /your/directory/where/stat files/will go/players/AEstatsPlayer3.html >>tftp2
echo delete /your/directory/where/stat files/will go/players/AEstatsPlayer4.html >>tftp2
echo delete /your/directory/where/stat files/will go/players/AEstatsPlayer5.html >>tftp2
echo delete /your/directory/where/stat files/will go/players/AEstatsPlayer6.html >>tftp2
echo delete /your/directory/where/stat files/will go/players/AEstatsPlayer7.html >>tftp2
echo delete /your/directory/where/stat files/will go/players/AEstatsPlayer8.html >>tftp2
echo delete /your/directory/where/stat files/will go/players/AEstatsPlayer9.html >>tftp2
echo delete /your/directory/where/stat files/will go/players/AEstatsPlayer10.html >>tftp2
echo delete /your/directory/where/stat files/will go/players/AEstatsPlayer11.html >>tftp2
echo delete /your/directory/where/stat files/will go/players/AEstatsPlayer12.html >>tftp2
echo delete /your/directory/where/stat files/will go/players/AEstatsPlayer13.html >>tftp2
echo delete /your/directory/where/stat files/will go/players/AEstatsPlayer14.html >>tftp2
echo delete /your/directory/where/stat files/will go/players/AEstatsPlayer15.html >>tftp2
echo lcd C:\Progra~1\aestats\stats\players >>tftp2
echo prompt >>tftp2
echo ascii >>tftp2
echo mput C:\Progra~1\aestats\stats\players\*.htm* >>tftp2
echo bye >>tftp2
ftp -s:tftp2


::This section will change to the Quake directory and delete 
::the old log file. If you want to keep adding to your existing
::log file just rem out this section of the batch file, but remember
::the bigger the log file gets the longer it takes to process.
cd C:\Progra~1\QuakeI~1\baseq3
del C:\Progra~1\QuakeI~1\baseq3\games.log


::This section will change to the Quake directory and restart Quake
::To start Quake in different mode create a batch file,
::put in Quake root directory and change the start line
::to - start C:\Progra~1\QuakeI~1\"name of batch file".bat
:restart
cd C:\Progra~1\QuakeI~1
start c:\progra~1\QuakeI~1\quake3.exe +set Dedicated 2 +set fs_game beryllium +set net_port 27960 +exec server.cfg


::This section clears the screen and closes
::this batch file
@echo off
cls
