Register  |  Home  |  Chat   |  ArmaBrowser  |  HowTo  |  Wiki  |  ServerStats  |  Donate  |  Forum  |  MapTools  |  Servers  |  Log in 
Forums
Information Desk
Latest News
Round Table
Servers
Trainees
Challenge us!
Off Topic

Clan Information
Public Clan Information
Active CTers+Trainees
All CTers+Trainees
Inactive CTers
CTers Earth Map
CT Groups
CT Medals
Armahacktron Wiki
Forum Ranks
Won/Lost Battles

Servers and Maps
ArmaBrowser
BFC New Ladder
CT Server Ladders
CT Mayhem Ladder
CTWF New Ladder
CT Server Maps
Flower Power Sumo Assault
Map Tools
Want to help? Donate

Jumble
HomeForum
CalendarChatMessengerIRC
Forum Members
LinksFAQ
NewsView Online

Search

Advanced Search

User Block
Username:

Password:

 Remember me



I forgot my password

Don't have an account yet?
You can register for FREE


Reply to topic
 Map Rotation Script. 
Jedi
Crazy Tronner
Server Tech
Honorary Member
Ladle, 1x (Amount: 1) Map Maker (Amount: 1)
CT Rank: Not Ranked
Field's place: sweeper
Grid Name: ct-eddie
GID: ed@ct/jedi
CT Wild Fort Rank: na
Joined: 22 Mar 2006
Posts: 1X9362493 Posts
Location: Wales, UK
Reply with quote
For those that are interested, here is the script that runs to rotate the maps:
It is a modified version of a script by wrtlprnft (thanks wrtlprnft).
I am no programmer, it is down right dirty.
If anyone has suggestion, etc, let me know.
you'll see it says "range=6"
this makes map selection like a roll of the dice. I can specify the likelyhood of a map being played.
It's very easy to add new maps.

it is called with:
Code:

tail -n1 -f /usr/local/var/games/armagetronad-dedicated/log/armagetronad.log | /etc/armagetronad-dedicated/eddie.sh


it is called eddie.sh and looks like this:

Code:
#!/bin/bash

while true
 do
 admin_note_1=""
 admin_note_2=""
 line=""
 read line

 echo $line

## Round 1
 if [ "$line" == '[0] Go (round 10 of 10)!' ]
  then
   range=6
   num=$RANDOM
   let "num %= $range"
   let "map = $num + 1 "
   if [ $map -le 3 ]
    then
     echo "MAP_FILE ed/fortress/pillar-0.0.6.aamap.xml" > /usr/local/var/games/armagetronad-dedicated/var/everytime.cfg
     echo "ROUND_CENTER_MESSAGE Round 1 - Pillar" >> /usr/local/var/games/armagetronad-dedicated/var/everytime.cfg
     echo "$admin_note_1" >> /usr/local/var/games/armagetronad-dedicated/var/everytime.cfg
     echo "$admin_note_2" >> /usr/local/var/games/armagetronad-dedicated/var/everytime.cfg
   elif [ $map -ge 4 ]
    then
     echo "MAP_FILE ed/fortress/lookout-0.0.5.aamap.xml" > /usr/local/var/games/armagetronad-dedicated/var/everytime.cfg
     echo "ROUND_CENTER_MESSAGE Round 1 - Look Out!" >> /usr/local/var/games/armagetronad-dedicated/var/everytime.cfg
     echo "$admin_note_1" >> /usr/local/var/games/armagetronad-dedicated/var/everytime.cfg
     echo "$admin_note_2" >> /usr/local/var/games/armagetronad-dedicated/var/everytime.cfg
   fi
 fi

## Round 2
 if [ "$line" == '[0] Go (round 1 of 10)!' ]
  then
   range=6
   num=$RANDOM
   let "num %= $range"
   let "map = $num + 1 "
   if [ $map -le 2 ]
    then
     echo "MAP_FILE ed/fortress/minefield-0.0.6.aamap.xml" > /usr/local/var/games/armagetronad-dedicated/var/everytime.cfg
     echo "ROUND_CENTER_MESSAGE Round 2 - Minefield" >> /usr/local/var/games/armagetronad-dedicated/var/everytime.cfg
     echo "$admin_note_1" >> /usr/local/var/games/armagetronad-dedicated/var/everytime.cfg
     echo "$admin_note_2" >> /usr/local/var/games/armagetronad-dedicated/var/everytime.cfg
   elif [ $map -ge 3 ]
    then
     echo "MAP_FILE ed/fortress/minepillars-0.0.2.aamap.xml" > /usr/local/var/games/armagetronad-dedicated/var/everytime.cfg
     echo "ROUND_CENTER_MESSAGE Round 2 - Mine Pillars" >> /usr/local/var/games/armagetronad-dedicated/var/everytime.cfg
     echo "$admin_note_1" >> /usr/local/var/games/armagetronad-dedicated/var/everytime.cfg
     echo "$admin_note_2" >> /usr/local/var/games/armagetronad-dedicated/var/everytime.cfg
   fi
 fi

## Round 3
 if [ "$line" == '[0] Go (round 2 of 10 )!' ]
  then
   range=6
   num=$RANDOM
   let "num %= $range"
   let "map = $num + 1 "
   if [ $map -le 2 ]
    then
     echo "MAP_FILE ed/fortress/octagon-0.0.2.aamap.xml" > /usr/local/var/games/armagetronad-dedicated/var/everytime.cfg
     echo "ROUND_CENTER_MESSAGE Round 3 - Octagon!" >> /usr/local/var/games/armagetronad-dedicated/var/everytime.cfg
     echo "$admin_note_1" >> /usr/local/var/games/armagetronad-dedicated/var/everytime.cfg
     echo "$admin_note_2" >> /usr/local/var/games/armagetronad-dedicated/var/everytime.cfg
   elif [ $map -ge 3 ]
    then
     echo "MAP_FILE ed/fortress/octazigzag-0.0.2.aamap.xml" > /usr/local/var/games/armagetronad-dedicated/var/everytime.cfg
     echo "ROUND_CENTER_MESSAGE Round 3 - Octagon Wiggle!" >> /usr/local/var/games/armagetronad-dedicated/var/everytime.cfg
     echo "$admin_note_1" >> /usr/local/var/games/armagetronad-dedicated/var/everytime.cfg
     echo "$admin_note_2" >> /usr/local/var/games/armagetronad-dedicated/var/everytime.cfg
   fi
 fi

## Round 4
 if [ "$line" == '[0] Go (round 3 of 10)!' ]
  then
   range=6
   num=$RANDOM
   let "num %= $range"
   let "map = $num + 1 "
   if [ $map -le 3 ]
    then
     echo "MAP_FILE ed/fortress/arcanoid-0.0.6.aamap.xml" > /usr/local/var/games/armagetronad-dedicated/var/everytime.cfg
     echo "ROUND_CENTER_MESSAGE Round 4 - Arcanoid" >> /usr/local/var/games/armagetronad-dedicated/var/everytime.cfg
     echo "$admin_note_1" >> /usr/local/var/games/armagetronad-dedicated/var/everytime.cfg
     echo "$admin_note_2" >> /usr/local/var/games/armagetronad-dedicated/var/everytime.cfg
   elif [ $map -ge 4 ]
    then
     echo "MAP_FILE ed/fortress/behind_you-0.0.9.aamap.xml" > /usr/local/var/games/armagetronad-dedicated/var/everytime.cfg
     echo "ROUND_CENTER_MESSAGE Round 4 - Behind You" >> /usr/local/var/games/armagetronad-dedicated/var/everytime.cfg
     echo "$admin_note_1" >> /usr/local/var/games/armagetronad-dedicated/var/everytime.cfg
     echo "$admin_note_2" >> /usr/local/var/games/armagetronad-dedicated/var/everytime.cfg
    fi
  fi

## Round 5
 if [ "$line" == '[0] Go (round 4 of 10)!' ]
  then
   range=6
   num=$RANDOM
   let "num %= $range"
   let "map = $num + 1 "
   if [ $map -le 3 ]
    then
     echo "MAP_FILE ed/fortress/speed_dome-0.0.7.aamap.xml" > /usr/local/var/games/armagetronad-dedicated/var/everytime.cfg
     echo "ROUND_CENTER_MESSAGE Round 5 - Speed Kills" >> /usr/local/var/games/armagetronad-dedicated/var/everytime.cfg
     echo "$admin_note_1" >> /usr/local/var/games/armagetronad-dedicated/var/everytime.cfg
     echo "$admin_note_2" >> /usr/local/var/games/armagetronad-dedicated/var/everytime.cfg
   elif [ $map -ge 4 ]
    then
     echo "MAP_FILE ed/fortress/speed_city-0.0.2.aamap.xml" > /usr/local/var/games/armagetronad-dedicated/var/everytime.cfg
     echo "ROUND_CENTER_MESSAGE Round 5 - Speed City" >> /usr/local/var/games/armagetronad-dedicated/var/everytime.cfg
     echo "$admin_note_1" >> /usr/local/var/games/armagetronad-dedicated/var/everytime.cfg
     echo "$admin_note_2" >> /usr/local/var/games/armagetronad-dedicated/var/everytime.cfg
   fi
 fi

## Round 6
 if [ "$line" == '[0] Go (round 5 of 10)!' ]
  then
   range=6
   num=$RANDOM
   let "num %= $range"
   let "map = $num + 1 "
   if [ $map -le 3 ]
    then
     echo "MAP_FILE ed/fortress/chico_time-0.1.3.aamap.xml" > /usr/local/var/games/armagetronad-dedicated/var/everytime.cfg
     echo "ROUND_CENTER_MESSAGE Round 6 - It's Chico Time" >> /usr/local/var/games/armagetronad-dedicated/var/everytime.cfg
     echo "$admin_note_1" >> /usr/local/var/games/armagetronad-dedicated/var/everytime.cfg
     echo "$admin_note_2" >> /usr/local/var/games/armagetronad-dedicated/var/everytime.cfg
   elif [ $map -ge 4 ]
    then
     echo "MAP_FILE ed/fortress/chico_teamsumo-0.0.3.aamap.xml" > /usr/local/var/games/armagetronad-dedicated/var/everytime.cfg
     echo "ROUND_CENTER_MESSAGE Round 6 - It's Chico Sumo" >> /usr/local/var/games/armagetronad-dedicated/var/everytime.cfg
     echo "$admin_note_1" >> /usr/local/var/games/armagetronad-dedicated/var/everytime.cfg
     echo "$admin_note_2" >> /usr/local/var/games/armagetronad-dedicated/var/everytime.cfg
   fi
 fi

## Round 7
 if [ "$line" == '[0] Go (round 6 of 10)!' ]
  then
   range=6
   num=$RANDOM
   let "num %= $range"
   let "map = $num + 1 "
   if [ $map -le 2 ]
    then
     echo "MAP_FILE ed/fortress/boxes-0.0.6.aamap.xml" > /usr/local/var/games/armagetronad-dedicated/var/everytime.cfg
     echo "ROUND_CENTER_MESSAGE Round 7 - Little Boxes" >> /usr/local/var/games/armagetronad-dedicated/var/everytime.cfg
     echo "$admin_note_1" >> /usr/local/var/games/armagetronad-dedicated/var/everytime.cfg
     echo "$admin_note_2" >> /usr/local/var/games/armagetronad-dedicated/var/everytime.cfg
   elif [ $map -ge 3 ]
    then
     echo "MAP_FILE ed/fortress/circles-0.0.3.aamap.xml" > /usr/local/var/games/armagetronad-dedicated/var/everytime.cfg
     echo "ROUND_CENTER_MESSAGE Round 7 - Little Circles" >> /usr/local/var/games/armagetronad-dedicated/var/everytime.cfg
     echo "$admin_note_1" >> /usr/local/var/games/armagetronad-dedicated/var/everytime.cfg
     echo "$admin_note_2" >> /usr/local/var/games/armagetronad-dedicated/var/everytime.cfg
    fi
  fi

## Round 8
 if [ "$line" == '[0] Go (round 7 of 10)!' ]
  then
   range=6
   num=$RANDOM
   let "num %= $range"
   let "map = $num + 1 "
   if [ $map -le 3 ]
    then
     echo "MAP_FILE ed/fortress/mini-0.0.6.aamap.xml" > /usr/local/var/games/armagetronad-dedicated/var/everytime.cfg
     echo "ROUND_CENTER_MESSAGE Round 8 - Mini" >> /usr/local/var/games/armagetronad-dedicated/var/everytime.cfg
     echo "$admin_note_1" >> /usr/local/var/games/armagetronad-dedicated/var/everytime.cfg
     echo "$admin_note_2" >> /usr/local/var/games/armagetronad-dedicated/var/everytime.cfg
   elif [ $map -ge 4 ]
    then
     echo "MAP_FILE ed/fortress/nano-0.0.4.aamap.xml" > /usr/local/var/games/armagetronad-dedicated/var/everytime.cfg
     echo "ROUND_CENTER_MESSAGE Round 8 - Nano" >> /usr/local/var/games/armagetronad-dedicated/var/everytime.cfg
     echo "$admin_note_1" >> /usr/local/var/games/armagetronad-dedicated/var/everytime.cfg
     echo "$admin_note_2" >> /usr/local/var/games/armagetronad-dedicated/var/everytime.cfg
   fi
 fi

## Round 9
 if [ "$line" == '[0] Go (round 8 of 10)!' ]
  then
   range=6
   num=$RANDOM
   let "num %= $range"
   let "map = $num + 1 "
   if [ $map -le 3 ]
    then
     echo "MAP_FILE ed/fortress/hourglass-0.0.3.aamap.xml" > /usr/local/var/games/armagetronad-dedicated/var/everytime.cfg
     echo "ROUND_CENTER_MESSAGE Round 9 - Chico's Hourglass" >> /usr/local/var/games/armagetronad-dedicated/var/everytime.cfg
     echo "$admin_note_1" >> /usr/local/var/games/armagetronad-dedicated/var/everytime.cfg
     echo "$admin_note_2" >> /usr/local/var/games/armagetronad-dedicated/var/everytime.cfg
   elif [ $map -ge 4 ]
    then
   echo "MAP_FILE ed/fortress/chicoeye-0.0.2.aamap.xml" > /usr/local/var/games/armagetronad-dedicated/var/everytime.cfg
   echo "ROUND_CENTER_MESSAGE Round 9 - Chico's Eye - Brake!" >> /usr/local/var/games/armagetronad-dedicated/var/everytime.cfg
     echo "$admin_note_1" >> /usr/local/var/games/armagetronad-dedicated/var/everytime.cfg
     echo "$admin_note_2" >> /usr/local/var/games/armagetronad-dedicated/var/everytime.cfg
   fi
 fi

## Round 10
 if [ "$line" == '[0] Go (round 9 of 10)!' ]
  then
   range=6
   num=$RANDOM
   let "num %= $range"
   let "map = $num + 1 "
   if [ $map -le 3 ]
    then
     echo "MAP_FILE ed/fortress/diamond_death-0.0.7.aamap.xml" > /usr/local/var/games/armagetronad-dedicated/var/everytime.cfg
     echo "ROUND_CENTER_MESSAGE Final Round - Diamond Death" >> /usr/local/var/games/armagetronad-dedicated/var/everytime.cfg
     echo "$admin_note_1" >> /usr/local/var/games/armagetronad-dedicated/var/everytime.cfg
     echo "$admin_note_2" >> /usr/local/var/games/armagetronad-dedicated/var/everytime.cfg
   elif [ $map -ge 4 ]
    then
     echo "MAP_FILE ed/fortress/diamond_sumo-0.0.3.aamap.xml" > /usr/local/var/games/armagetronad-dedicated/var/everytime.cfg
     echo "ROUND_CENTER_MESSAGE Final Round - Diamond Sumo" >> /usr/local/var/games/armagetronad-dedicated/var/everytime.cfg
     echo "$admin_note_1" >> /usr/local/var/games/armagetronad-dedicated/var/everytime.cfg
     echo "$admin_note_2" >> /usr/local/var/games/armagetronad-dedicated/var/everytime.cfg
   fi
 fi
done


EDIT: did 1 miner change which still allows this to work no (20 April 2011)
View user's profile Find all posts by ed Send private message
  
Ex-CTer
CT Rank: Not a CTer
Field's place:
Grid Name:
GID: Not working
CT Wild Fort Rank:
Joined: 05 Apr 2006
Posts: 2W36104 Posts
Location: Ottawa, ON, Canada
Reply with quote
I was thinking, for random dz's, walls, etc... map_file ed/fortress/map.cgi?round=9&mode=1&etc...
Then could use cgi to generate each map

Problem is, the map HAS TO BE $mapname$ + '-' + $version$ + '.aamap.xml'

It can't have anything after the '.aamap.xml'

Also, FAT file systems, and Windoze shell (even XP on a NTFS partion) both have trouble with oddly named files, so question marks and qual signs are out.

I'll have to think more about this rotating, randomly generated maps (or walls, or what not). Probably will have to be done through the tail command :/

Unless you want to get hacky and set your /resources/ed/fortress/ 404 page to a cgi script that returns a text/xml document, based on the requested name. <-- this is probably the easiest way to return randomly generated maps, with the least amount of effort.

Code:

#!/bin/bash

# default initial sub_sub_ver
SUB_SUB_VER=0;

while true
 do
 line=""
 read line

 echo $line

 # get the latest sub_sub_ver
 if [ -f /tmp/sub_sub_ver.atrond ]
  then
   let "SUB_SUB_VER=$(cat /tmp/sub_sub_ver.atrond)+1"
 fi
 echo -n $SUB_SUB_VER > /tmp/sub_sub_ver.atrond

 # Now just test for '[0] Go (round '
 if [ "$line" == '[0] Go (round ' ]
  then
   # sed out the round number (regardless of the number of rounds)
   ROUND=$(echo $line | sed -rn 's/\[0\] Go \(round ([0-9]+) of [0-9]+ \)\!/\1/;p')

   # Set the map file to a 404 error page that will use the round information to decide on what map to generate.
   echo "MAP_FILE ed/fortress/random_maps_${ROUND}-0.2.0_${SUB_SUB_VER}.aamap.xml" > /usr/local/var/games/armagetronad-dedicated/var/everytime.cfg
 fi
done


In the cgi 'error page hack' script you simply grab the appropriate ENV{} parameter to pick out 'random_maps_${ROUND}-0.2.0_${SUB_SUB_VER}.aamap.xml' in the request. s/// out the round number and generate the xml file. do a print "Content-Type: text/xml; charset=UTF-8\n\n"; and then start printing out the generated map.

Ofcourse the problem with ~any~ randomly generated map, is the amount of 5 to 10k files that will be permanently stored on the clients computer. (I'm up to 1.2MB in my resource directory, and I don't play randomly generated maps! Imagine how big that could get if I played wild with this script, for one day straight! almost noticable, lol, but still, some people don't even have 20 Gig HDs).

_________________
echo "Robed"; fortune;
View user's profile Find all posts by Robed Send private message Visit poster's website
  
Ex-CTer
CT Rank: Not a CTer
Field's place:
Grid Name:
GID: Not working
CT Wild Fort Rank:
Joined: 05 Apr 2006
Posts: 2W36104 Posts
Location: Ottawa, ON, Canada
Reply with quote
if [ "$line" == '[0] Go (round ' ]

Won't work, but I don't fell like doing a man bash right now Razz

You get the idea though, right ed? Very Happy

_________________
echo "Robed"; fortune;
View user's profile Find all posts by Robed Send private message Visit poster's website
  
Jedi
Crazy Tronner
Server Tech
Honorary Member
Ladle, 1x (Amount: 1) Map Maker (Amount: 1)
CT Rank: Not Ranked
Field's place: sweeper
Grid Name: ct-eddie
GID: ed@ct/jedi
CT Wild Fort Rank: na
Joined: 22 Mar 2006
Posts: 1X9362493 Posts
Location: Wales, UK
Reply with quote
I get the idea. But I'm not sold on the idea of randomly generated maps.

Race to win zone is very clever and fun, but how long have you stayed there in one sitting?

I think well designed maps work much better, and I think people like the familiarity of knowing a map and it's tactics.

I don't know if you've seen wrtlprnft's post here on how he did it:
http://forums.armagetronad.net/viewtopic.php?t=2855

It's a bit out of my depth (the php map gen script), but you may get it.
View user's profile Find all posts by ed Send private message
  
Newbie
CT Rank: Not a CTer
Field's place:
Grid Name:
GID: Not working
CT Wild Fort Rank:
Joined: 03 Jul 2006
Posts: 3363 Posts

Reply with quote
I try to make this for windows but I dont. Can you help me??
View user's profile Find all posts by Drashia =[CF]= Send private message
  
Jedi
Crazy Tronner
Server Tech
Honorary Member
Ladle, 1x (Amount: 1) Map Maker (Amount: 1)
CT Rank: Not Ranked
Field's place: sweeper
Grid Name: ct-eddie
GID: ed@ct/jedi
CT Wild Fort Rank: na
Joined: 22 Mar 2006
Posts: 1X9362493 Posts
Location: Wales, UK
Reply with quote
The script was designed for Linux. As that's what our server runs on.

You might want to try Cygwin http://www.cygwin.com/

That allows you to run *nix tools on windows.
It may work, dunno, never used it.
View user's profile Find all posts by ed Send private message
  
Crazy Tronner
Honorary Member
Donator (Amount: 1)
CT Rank: Not Ranked
Field's place: support
Grid Name: CT×X3V1
GID: xevic@ct/jedi
CT Wild Fort Rank: na
Joined: 22 Mar 2006
Posts: 26B362819 Posts
Location: Barcelona
Reply with quote
i used it, it can work, but it means it will need to run arma server there 2, and perhaps it will get problems with performance, it's a emulator and it's slow.

_________________
Visca el Barça! CUIG (See you in game) and don't forget to sing with us: lalalalala Sing
View user's profile Find all posts by xevic Send private message Send e-mail Visit poster's website Yahoo Messenger MSN Messenger ICQ Number
  
Jedi
Crazy Tronner
Server Tech
Honorary Member
Ladle, 1x (Amount: 1) Map Maker (Amount: 1)
CT Rank: Not Ranked
Field's place: sweeper
Grid Name: ct-eddie
GID: ed@ct/jedi
CT Wild Fort Rank: na
Joined: 22 Mar 2006
Posts: 1X9362493 Posts
Location: Wales, UK
Reply with quote
You wouldn't need to run arma under cygwin.

As long as the script has access to the arma log files and is able to write to the file everytime.cfg, that should be enough, theorically.
Armagetron-dedicated should be able to run under Windows.
View user's profile Find all posts by ed Send private message
  
Crazy Tronner
Honorary Member
Donator (Amount: 1)
CT Rank: Not Ranked
Field's place: support
Grid Name: CT×X3V1
GID: xevic@ct/jedi
CT Wild Fort Rank: na
Joined: 22 Mar 2006
Posts: 26B362819 Posts
Location: Barcelona
Reply with quote
yes and not, cygwin just can get access into files are located in its instalation, u will ahve to install into its path or make a mount, and i'm not sure about mount capacilities.

i suggest u translate it into a vbscript in won't take u a lot of time.

_________________
Visca el Barça! CUIG (See you in game) and don't forget to sing with us: lalalalala Sing
View user's profile Find all posts by xevic Send private message Send e-mail Visit poster's website Yahoo Messenger MSN Messenger ICQ Number
  
Crazy Tronner
Honorary Member
CT Rank: Not Ranked
Field's place:
Grid Name: Racer
GID: PTA@ct/jedi
CT Wild Fort Rank: na
Joined: 12 Apr 2006
Posts: 8T36317 Posts
Location: Stuttgart, Germany
Reply with quote
cygwin just can get access into files are located in its instalation

Mounting is no problem, just edit the config.

it's a emulator and it's slow

Tztztztztz...don't say that loud, cygwin is not a Full-Virtualization app, it's a bit like Xen and you don't have much performance performance problems

_________________
Think different. But think!
View user's profile Find all posts by PTA Send private message ICQ Number
  
Crazy Tronner
Honorary Member
Donator (Amount: 1)
CT Rank: Not Ranked
Field's place: support
Grid Name: CT×X3V1
GID: xevic@ct/jedi
CT Wild Fort Rank: na
Joined: 22 Mar 2006
Posts: 26B362819 Posts
Location: Barcelona
Reply with quote
okis, as u want Wink i remember when i mounted x-windows up to it, lol, was really far away from a native linux Wink

_________________
Visca el Barça! CUIG (See you in game) and don't forget to sing with us: lalalalala Sing
View user's profile Find all posts by xevic Send private message Send e-mail Visit poster's website Yahoo Messenger MSN Messenger ICQ Number
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
All times are GMT  
Page 1 of 1  

  
  
 Reply to topic  Post a reply  

free counters