Author Topic: SHell script to start GAE and update list of Scenarios (Linux)  (Read 1282 times)

jda

  • Guest
Hi folks,

Someone asked a questions on the "0.2.13" thread about installing GAE and I remembered there is something specific to GAE that doesn't really seem to have gotten its own thread and I do think it deserves it. :P
It's something reallly very small and easy but usefull too. ;)

Here's the "problem":
EDIT: There is a detail about scenarios...
In Glest (and I think in MegaGlest too), they're saved in folder "scenarios". In GAE, they're saved in gae/scenarios/category .
So, not only will the scenarios be loaded from a different directory, you'll have to stick them in some further down subfolder which will be used as a category name when presented the "Choose scenario" dialog ingame.
Two such categories/folders are included in the default GAE installation: glest_classic and glest_tutorials. ;)
I have a script to update GAE's scenarios folders automatically (from the original Glest ones) but I can't post it now, have to run, will do it later. Cheers!

And here is my Glest Advanced Engine startup script (it's on my $PATH on my system ;) ):
Code: [Select]
#!/bin/sh

# glestadv - Edited by jda < jdalinux at yahoo dot com dot br > from Ubuntu packaged /usr/games/glest

MAINDIR=/usr/local/games/glest
DIR=$HOME/.glest
[ -d $DIR ] || mkdir $DIR
cd $DIR
#if [ -f glestadv.ini ]; then # I could NOT get this to work properly for GAE. Hence
#    # Update for Glest 3.2.1 # I just commented this out, which means that, if you
#    sed -i 's/\.lng//' glestadv.ini # happen to messup your language settings, this script
#    language=$(cat glestadv.ini | grep Lang | cut -d'=' -f2) # will not automatically fix it for you. You'll have to
#    [ -f $MAINDIR/data/lang/${language}.lng ] || \ # manually fix it yourself.
#        sed -i "s/${language}/english/" glestadv.ini
#else
#    cp $MAINDIR/glestadv.ini .
#fi # End of commented-out language-setting routine.
[ -h glestadv ] || ln -s $MAINDIR/glestadv .
[ -f servers.ini ] || cp $MAINDIR/servers.ini .
for i in data docs scenarios techs tilesets gae ; do
      [ -h $i ] || ln -s $MAINDIR/$i .
done

[ -d maps ] || mkdir maps
cd maps
for i in $MAINDIR/maps/* ; do
      [ -h `basename $i` ] || ln -s $i .
done

cd ..

# Copy all scenarios on vanilla Glest's scenarios directory to gae/scenarios/all
[ -d gae/scenarios/all ] || mkdir gae/scenarios/all
cd gae/scenarios/all
for i in $MAINDIR/scenarios/* ; do
      [ -h `basename $i` ] || ln -s $i .
done

cd ../../..

exec ./glestadv

The part concerning the "translation" of scenarios from the original Glest folder structure to GAE's folder structure is obviously that which starts with # Copy all scenarios on vanilla Glest's scenarios directory to gae/scenarios/all
That's easy to edit to make a new workable "just-copy-the-scenarios" script that will put all scenarios on the original Glest's scenarios folder to a folder that will be read as category "All" by GAE. ;)
Or... you can just use this script as your default start script to run GAE. ;)

If you just want the scenrios-folders translation and can't do it yourself, let me know and I'll do it for you. :)

EDIT: Oh, either way, you'll have to give exectuable permissions to your script. E.g. in a terminal:
Code: [Select]
chmod -c +x glestadv (or whatever you named the script instead of glestadv). ;D
« Last Edit: 4 May 2010, 23:08:18 by jda »

Dritominous

  • Guest
Excellent!  I LOVE YOU!