Jump to content

Recommended Posts

Posted

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"

  • 3 weeks later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...