Jump to content

Map's Dimensions Extractor


Recommended Posts


  • Group:  Members
  • Topic Count:  2
  • Topics Per Day:  0.00
  • Content Count:  3
  • Reputation:   0
  • Joined:  02/26/12
  • Last Seen:  

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"

Link to comment
Share on other sites

  • 3 weeks later...

  • Group:  Members
  • Topic Count:  0
  • Topics Per Day:  0
  • Content Count:  9
  • Reputation:   0
  • Joined:  05/04/12
  • Last Seen:  

Hi, could you specify a little bit? what's the purpose of this 'batch'

Thank you!

Link to comment
Share on other sites

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.

×
×
  • Create New...