View Single Post
  #2  
Old March 18th, 2007, 03:07 PM
DrPraetorious's Avatar

DrPraetorious DrPraetorious is offline
Major General
 
Join Date: Feb 2005
Location: Lake of Hali, Aldebaran, OH
Posts: 2,474
Thanks: 51
Thanked 67 Times in 27 Posts
DrPraetorious is on a distinguished road
Default Re: tool request (terrain math)

Linux *or* windows or linux *and* windows?

I've touched this up for legibility. First, copy these scripts into textfiles (hence, "scriptfile").

Code:

BEGIN{low=ARGV[2]; high=ARGV[3]; mask=ARGV[4]; ARGC-=3;}
{pmode = 1;}
/#terrain/ && ($2 >= low && $2 <= high){print $1 " " $2 " " or($3,mask); pmode = 0;}
(pmode == 1){print;}



usage: awk -f <scriptfile> <mapfilename> <min> <max> <mask>

ex: awk -f makemask.awk 390_mp.map 1 12 1

The output will be a version of 390_mp.map where provinces 1-12 are now large.

You can use this to set any province mask you want on any range of provinces you want - I forget what the bitmask is for nostarts but you can use this to add ocean, for example.

If you want to strip out a bitmask, use this:
Code:

BEGIN{low=ARGV[2]; high=ARGV[3]; mask=ARGV[4]; ARGC-=3;}
{pmode = 1;}
/#terrain/ && ($2 >= low && $2 <= high){print $1 " " $2 " " and($3,compl(mask)); pmode = 0;}
(pmode == 1){print;}



Identical usage.
__________________
If you read his speech at Rice, all his arguments for going to the moon work equally well as arguments for blowing up the moon, sending cloned dinosaurs into space, or constructing a towering *****-shaped obelisk on Mars. --Randall Munroe
Reply With Quote