Complete.Org: Mailing Lists: Archives: freeciv: January 2002:
[Freeciv] script to start server and client for beginners
Home

[Freeciv] script to start server and client for beginners

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: freeciv@xxxxxxxxxxx
Subject: [Freeciv] script to start server and client for beginners
From: "Sam Halliday" <plendily@xxxxxxxxxxx>
Date: Thu, 03 Jan 2002 17:23:50 +0000

hello everybody.

i just started playing freeciv yesterday, and i was annoyed at all the 
typing i had to do to get it started when i just want to play the AI... so i 
wrote this simple script which loads the server and client, and allows me to 
choose the tiles, saved games and server options file... all i need to do is 
type start to begin play,

i just posted it here incase anybody fancied using it also, it think it is 
very good for beginnners.

all you need to do is edit your freeciv path in the script, and if you have 
any server options files lying around, if you place them in this path with 
*.opt suffix, you will be able to choose them easily.

it cant load additional tiles files you may have, unless you edit the 
script, but this is easily done. if anyone knows how to strip the ending 
*.tilespec from a variable name, i would very much like to hear how... im 
new to script writing.

cheers
Sam, Ireland

_________________________________________________________________
Join the world?s largest e-mail service with MSN Hotmail. 
http://www.hotmail.com


-- Attached file included as plaintext by Listar --
-- File: script.txt

#!/bin/bash

# by Sam Halliday
# Script to start freeciv for single player
# features:
#       - start server and client
#       - detect and prompt to load saves in home directory
#       - choose tiles from distro defaults
#       - choose options from installed in freeciv install directory (files 
ending 
*.opt)
#       - detect additional tiles from those in freeciv directory (NOT 
IMPLEMENTED 
YET)

FREECIV_INSTALLDIR="/usr/games/share/freeciv"
TILEOPTIONS="engels engels_shields trident_shields trident hires"

#---
# this is where the tiles finder goes, it currently finds tiles but needs to 
strip .tilespec
#clear
#cd $FREECIV_INSTALLDIR
#for TILES in *.tilespec; do
#echo $TILES
# Put -.tilespec transform here
#echo $TILEOPTIONS
#done
#---

#---
#DETECT SAVE HERE
cd $HOME
for SAVEGAME in civgame*; do
SAVEOPTIONS="$SAVEOPTIONS $SAVEGAME"
done
#---

#---
#DETECT OPTIONS FILES HERE
for SERVEROPTIONSFILE in $FREECIV_INSTALLDIR/*.opt; do
OPTSOPTIONS="$OPTSOPTIONS $SERVEROPTIONSFILE"
#echo $OPTSOPTIONS
done

#---

SERVEROPTIONSFILE=/usr/games/share/freeciv/sam.opt
TILES=hires
clear
echo "FreeCiv Server and Client Loader
by Sam Halliday
"

echo "Choose what kind of game you want:"
OPTIONS="New Load Tiles Server_Options Quit"
           select opt in $OPTIONS; do
               if [ "$opt" = "New" ]; then
                clear
                echo Starting new game...
                echo "To start play; Log on in the client (the other 
window), then type start here
save to save
quit to exit

"
                civclient --tiles $TILES &
                echo loading server
                civserver -r $SERVEROPTIONSFILE
                echo loading client
                exit
               elif [ "$opt" = "Load" ]; then
                clear
                        clear
                        echo "Which Savegame do you want?"
                                select saveopt in $SAVEOPTIONS; do
                                        SAVEGAME="$saveopt"
                                        break
                                        done
                echo Loading old game... $SAVEGAME
                echo "To start play; Log on in the client (the other 
window), then type start here
save to save
quit to exit

"
                civclient --tiles $TILES &
                echo loading server
                civserver -r $SERVEROPTIONSFILE -f $SAVEGAME
                echo loading client
                exit

               elif [ "$opt" = "Server_Options" ]; then
                clear
                echo "Which Options file do you want? Currently" 
$SERVEROPTIONSFILE
                        select serveroptionsopt in $OPTSOPTIONS; do
                                SERVEROPTIONSFILE="$serveroptionsopt"
                                break
                                done

               elif [ "$opt" = "Tiles" ]; then
                clear
                echo "Which Tiles do you want? Currently" $TILES
                        select tileopt in $TILEOPTIONS; do
                                TILES="$tileopt"
                                break
                                done

               elif [ "$opt" = "Quit" ]; then
                echo exiting
                exit
               else
                clear
                echo bad option
               fi
           done






[Prev in Thread] Current Thread [Next in Thread]