Making Maps Switch Randomly (alternate)

This is a different way to go about Making Maps Switch Randomly, which requires no knowledge of Armagetron map-making. It cycles through a number of random maps every minute, and can even change settings accordingly or announce the map's name and creator.

This tutorial worked on an i686 Dell Dimension L933r running Fedora Core 5. Let me know if you have successes on different hardware/distros.

Requirements

 * A Linux system with Armagetron Advanced Server installed (possibly works on Mac OS X from a Terminal)
 * The  utility
 * PHP (possibly requires HTTPD)

Tutorial
$ su Password: _
 * Make sure you are root.


 * Make sure  is started.
 * 1) /etc/init.d/crond start


 * Make a directory for  to check every minute.
 * 1) mkdir /etc/cron.minutely


 * Let  know to check for that directory.
 * 1) echo "*  * * * root run-parts /etc/cron.minutely" >> /etc/crontab


 * Now comes the fun part. (If you are more comfortable with another editor or have not used Vi before, go ahead and use it.)
 * 1) vi rand.php

!/usr/bin/php <?php echo "INCLUDE settings_custom.cfg\n"; $rand = rand(1,5); if ( $rand == "1" ) { echo "MAP_FILE Blind/Beta/clanfun-1.1.aamap.xml\n"; echo "SAY Next Map: Clan Fun by Blind"; } elseif ( $rand == "2" ) { echo "MAP_FILE Your_mom/cockpit/classic_m-0.0.3.aacockpit.xml\n"; echo "SAY Next Map: Cockpit by Your mom"; } elseif ( $rand == "3" ) { echo "MAP_FILE manta/misc/nano_slingers-0.0.2.aamap.xml\n"; echo "SAY Next Map: Nano Slingers by Manta"; } elseif ( $rand == "4" ) { echo "MAP_FILE HIM/race/race_map-0.1.0.aamap.xml\n"; echo "SAY Next Map: Race Map by HIM"; } elseif ( $rand == "5" ) { echo "MAP_FILE Durka/nano/nano_sumo-0.0.2.aamap.xml\n"; echo "SAY Next Map: Nano Sumo by Durka"; } ?>
 * Here is the sample PHP file that I use for my server.

This PHP file generates a random number and chooses a map accordingly. (The "\n"s at the end are PHP newlines; they are essential. If you modify this sample, remember to keep them!) If you want more maps, change the line $rand = rand(1,5); to $rand = rand(1,x); where x is the number of maps you want. Then add another block of these: } elseif ( $rand == "5" ) { echo "MAP_FILE /path/to/map/file/in/repository\n"; echo "SAY Next Map: Map Name by Creator"; } for each extra map you have.


 * Make the PHP file executable.
 * 1) chmod a+x rand.php


 * The PHP file will output the map configuration onto the screen, but we need something to put it into a file. That is a shell script. Open another file for writing.
 * 1) vi rand.sh

/etc/cron.minutely/rand.php > /your/userconfig/directory/everytime.cfg
 * Here is the shell script. You should not need to modify this, except to specify your user config directory.
 * 1) !/bin/bash


 * Copy both files to the  directory.
 * 1) cp rand.php /etc/cron.minutely/rand.php
 * 2) cp rand.sh /etc/cron.minutely/rand.sh


 * Give  a good 3 minutes to recognize the new file.


 * Start the server. You're done!

The best part about this is that you can edit  to include more maps without shutting down the server;   will pick it up automatically in the next minute.

Please tell me if this tutorial did not work for you.

Warning
If the match lasts less than 1 minute, the map may not be updated.