how to change 2 maps on the fly?

Designed a level that creates new, exciting, and challenging Armagetron game play? Or maybe just something funky. Put it right here.
Post Reply
Sniperiid
On Lightcycle Grid
Posts: 23
Joined: Thu Mar 17, 2005 6:16 pm
Location: Why should I tell?
Contact:

how to change 2 maps on the fly?

Post by Sniperiid »

How to change 2 maps on the fly? I got an server for my ISP clients, tho is not very populated. :)

I need to change between maze1 and maze2. How would I do this in PHP?
Q:Why PHP?
A:Because I learned it and liked it :)
User avatar
Lucifer
Project Developer
Posts: 8642
Joined: Sun Aug 15, 2004 3:32 pm
Location: Republic of Texas
Contact:

Post by Lucifer »

Check the wiki, where wrtlprnft put a nice little bash script to handle it.
Image

Be the devil's own, Lucifer's my name.
- Iron Maiden
Sniperiid
On Lightcycle Grid
Posts: 23
Joined: Thu Mar 17, 2005 6:16 pm
Location: Why should I tell?
Contact:

Post by Sniperiid »

I seen it, i dont know what exactly that NUM_FILE means
User avatar
wrtlprnft
Reverse Outside Corner Grinder
Posts: 1679
Joined: Wed Jan 04, 2006 4:42 am
Location: 0x08048000
Contact:

Post by wrtlprnft »

That script is intended for automatically generated maps, not for existing ones. You can basically use the same script, but instead of calling yet another script to generate the map it would have to select a random one, that's it ;)

Here's an untested version I just hacked together:

Code: Select all

#!/bin/sh

# URL for the webserver.
REMOTE_URI=http://example.com/arma/
# name for the map files. The number and the extension
# .xml get attached to it.
MAP_FILE_NAME=yourusername/fancymaze
# wow many maps you have, numbered from 0 to the number -1
NUMBER_OF_MAPS=4
# name of your everytime.cfg
EVERYTIME_CFG=$HOME/tronsrv/etc/games/armagetronad-dedicated/everytime.cfg

# In the above sample configuration you would have to make the maps
# reachable under the following adresses:
# - http://example.com/arma/yourusername/fancymaze0.xml
# - http://example.com/arma/yourusername/fancymaze1.xml
# - http://example.com/arma/yourusername/fancymaze2.xml
# - http://example.com/arma/yourusername/fancymaze3.xml

# test if the number file exist, if not, create it
while true
do
    # read the next line from STDIN
    read line
    # if it isn't the message we're hoping for wait for
    # the next one
    test "$line" == "New Round" || continue
    # increment our counter variable and store it
    r=$RANDOM
    num=`expr $r % $NUMBER_OF_MAPS`
    # Output a status message
    echo new map number $num
    # inform the arma server to load the script
    echo "MAP_FILE ""$MAP_FILE_NAME$num.xml ($REMOTE_URI$MAP_FILE_NAME$num.xml)" > "$EVERYTIME_CFG"
done
Sniperiid
On Lightcycle Grid
Posts: 23
Joined: Thu Mar 17, 2005 6:16 pm
Location: Why should I tell?
Contact:

Post by Sniperiid »

Wait a minute, I never seen 'New Round' in everytime.cfg

I am confused, explain me where it reads new round.
User avatar
Lucifer
Project Developer
Posts: 8642
Joined: Sun Aug 15, 2004 3:32 pm
Location: Republic of Texas
Contact:

Post by Lucifer »

from scorelog.txt. The wiki also gives the command you need to use to execute the script. :)
Image

Be the devil's own, Lucifer's my name.
- Iron Maiden
Sniperiid
On Lightcycle Grid
Posts: 23
Joined: Thu Mar 17, 2005 6:16 pm
Location: Why should I tell?
Contact:

Post by Sniperiid »

:lol: I did not pay attention to that command

Thanks
Post Reply