This wiki is archived and useful information is being migrated to the main bzflag.org website

Difference between revisions of "Rotating Maps"

From BZFlagWiki
Jump to: navigation, search
(formatting)
m (add category)
 
(10 intermediate revisions by 3 users not shown)
Line 1: Line 1:
 +
The scripts below can be used to have a server that rotates through specified maps every time it is restarted. Only use the scripts for your OS or they will not work. More information about map rotation scripts can be found [http://my.bzflag.org/bb/viewtopic.php?t=4252 here] on the BZBB.
 +
 
== Windows ==
 
== Windows ==
@ECHO OFF
+
Copy and the script below into notepad and save it as '''start-server.bat'''.
  
BREAK ON
+
All paths should be in 8.3 notation e.g. progra~1 not program files
  
 +
Don't forget to add -g and -time <secs> to your config files.
  
REM Batch file for rotating maps
+
Press CTRL-C twice and "y" to answer "Terminate Batch Job (y/n)?" to exit.
 +
 
 +
You will probably need to edit the paths to the bzfs binary and your configuration files.
 +
 
 +
You should have all your config files in the same directory as you specified in the script.
 +
 
 +
To run the server, you just need to double-click on '''start-server.bat'''.
 +
 
 +
@ECHO OFF
 
   
 
   
  REM All paths should be in 8.3 notation e.g. progra~1 not program files
+
  BREAK ON
 
   
 
   
REM Don't forget to add -g and -time <secs> to your conf files
+
  SET BZFSPATH=c:\progra~1\bzflag~1.2\bzfs.exe
REM Press CTRL-C twice and "y" to answer "Terminate Batch Job (y/n)?" to exit
+
+
REM Batch language is darn ugly, ain't it?
+
+
+
REM This is set to the default install path of 2.0.2...you might have to change it
+
+
  SET BZFSPATH=c:\progra~1\bzflag~1.2\bzfs.exe  
+
+
+
REM This is the default conf path.  If you supply an argument on the commandline it will override this.
+
 
   
 
   
 
  IF "%1" == "" SET CONFDIR=c:\your\path\to\conf\files
 
  IF "%1" == "" SET CONFDIR=c:\your\path\to\conf\files
Line 37: Line 37:
 
   
 
   
 
  GOTO loop_top
 
  GOTO loop_top
 +
 +
 +
== POSIX Shell (Mac OS X, Linux, BSD, IRIX, etc) ==
 +
 +
Save the script below as '''rotate.sh'''
 +
 +
Put all your config files in the CONFIGPATH directory.
 +
 +
After editing the CONFIGPATH and path to bzfs, type '''chmod a+x rotate.sh''' and then '''./rotate.sh''' to run the script.
 +
 +
<pre>
 +
#!/bin/sh
 +
 +
if [ $1 ] ; then
 +
  CONFIGPATH=$1 
 +
else
 +
  CONFIGPATH="/your/path/to/configfiles"
 +
fi
 +
cd $CONFIGPATH || echo "$CONFIGPATH not found"
 +
 +
BZFSPATH=/usr/local/bin/bzfs
 +
 +
abort=0
 +
while [ $abort -eq 0 ]; do
 +
  for b in *.conf ; do
 +
    $BZFSPATH -conf $b
 +
    if [ $? -ne 0 ] ; then
 +
      abort=1
 +
      break
 +
    fi
 +
  done
 +
  echo "Reached end of rotation, starting over."
 +
done
 +
</pre>
 +
 +
[[Category:Server]]

Latest revision as of 23:21, 21 February 2007

The scripts below can be used to have a server that rotates through specified maps every time it is restarted. Only use the scripts for your OS or they will not work. More information about map rotation scripts can be found here on the BZBB.

Windows[edit]

Copy and the script below into notepad and save it as start-server.bat.

All paths should be in 8.3 notation e.g. progra~1 not program files

Don't forget to add -g and -time <secs> to your config files.

Press CTRL-C twice and "y" to answer "Terminate Batch Job (y/n)?" to exit.

You will probably need to edit the paths to the bzfs binary and your configuration files.

You should have all your config files in the same directory as you specified in the script.

To run the server, you just need to double-click on start-server.bat.

@ECHO OFF

BREAK ON

SET BZFSPATH=c:\progra~1\bzflag~1.2\bzfs.exe

IF "%1" == "" SET CONFDIR=c:\your\path\to\conf\files

IF NOT "%1" == "" SET CONFDIR=%1


:loop_top

ECHO.

FOR %%b IN (%CONFDIR%\*.conf) DO %BZFSPATH% -conf %%b

ECHO "Reached end of rotation, starting over.


GOTO loop_top


POSIX Shell (Mac OS X, Linux, BSD, IRIX, etc)[edit]

Save the script below as rotate.sh

Put all your config files in the CONFIGPATH directory.

After editing the CONFIGPATH and path to bzfs, type chmod a+x rotate.sh and then ./rotate.sh to run the script.

#!/bin/sh

if [ $1 ] ; then
  CONFIGPATH=$1   
else
  CONFIGPATH="/your/path/to/configfiles"
fi
cd $CONFIGPATH || echo "$CONFIGPATH not found"

BZFSPATH=/usr/local/bin/bzfs

abort=0
while [ $abort -eq 0 ]; do
  for b in *.conf ; do
    $BZFSPATH -conf $b
    if [ $? -ne 0 ] ; then
      abort=1
      break
    fi
  done
  echo "Reached end of rotation, starting over."
done