Jump to content

DarkSideRO

Members
  • Posts

    3
  • Joined

  • Last visited

Posts posted by DarkSideRO

  1. Hi all,

    recently i had some problem with maps and I need know the Gravity map that best fit my custom map. This is a simple bash script that generate a txt file with maps sorted by width and height.

    I hope is usefull for someone :D

    #!/bin/bash
    svn co https://openkore.svn.sourceforge.net/svnroot/openkore/fieldpack/trunk/fields/
    echo -e Width \\t Height \\t Map > "Maps Dimensions.tmp"
    for m in $(ls fields | grep fld);
     do
    name=$(basename $m ".fld")
    w=$(cat "fields/$m" | head -c  2 | od -d -An | tr -dc '[:alnum:],\n')
    h=$(cat "fields/$m" | head -c  4 | tail -c 2| od -d -An | tr -dc '[:alnum:],\n')
    echo -e $w \\t $h \\t $name >> "Maps Dimensions.tmp"
    done
    rm -rf fields
    sort -t $'\t' -k 1n -k 2n "Maps Dimensions.tmp" > "Maps Dimensions.txt"
    rm "Maps Dimensions.tmp"
    

×
×
  • Create New...