.com.unity Forums

.com.unity Forums (http://forum.shrapnelgames.com/index.php)
-   Scenarios, Maps and Mods (http://forum.shrapnelgames.com/forumdisplay.php?f=146)
-   -   mass poptype set script (http://forum.shrapnelgames.com/showthread.php?t=42068)

Omnirizon January 24th, 2009 10:29 PM

mass poptype set script
 
1 Attachment(s)
this is a poptype set script written in Python. at the moment, it will only do a mass set of all lands to one poptype. I really only wrote it because I wanted to make a map No Indies, but didn't want to go through by hand.

the script works like a python module. many systems already have Python installed (just type 'python' at a command line). if not, you will need to install it from python.org. you should have it anyway in this day and age; DIY scripting will be the wave of the future in an age of information anarchy and (un)interoperability.

Code:

usage:

setpop(file, type)
iterates over all '#landname' entries of file and creates a set of all province numbers.
iterates over this set and appends a sequence of:
#setland x
#poptype type
to the end of file, where x is a number popped from the set


example:

import poptypes

f = '/users/myname/mymap.map'
t = 99
poptypes.setpop(f, t)

NOTE: poptypes.py will need to be on your PYTHONPATH in order to import it. alternatively, you can just add the commands, like those shown in the example, into the file itself and launch it with the python interpreter (this is actually very easy. after adding the commands into the file just right-click it and select 'open with' then 'python'). if there's really demand for it, I will make this into a python egg, then it can be automatically added to your python's site-packages folder, and you will be able to import it with no special steps needed.

i may add to this python module, and rename it 'pydommaps' or something equally asinine. i could add scripts that automatically generate neighbor entries, or that add random poptypes.

i sorted through the mod tools list, and didn't see anything like this. is there something already? if not I can build this up if people would use it.

Sombre January 25th, 2009 06:28 AM

Re: mass poptype set script
 
Someone had already done this. I forget who but you can doubtless find it by searching for something like 'No indy script'.

I can't really get on with these scripts where I need to install modules and they're all a bit fiddly.

llamabeast January 25th, 2009 12:04 PM

Re: mass poptype set script
 
Only because you're using Windows! :)

Gandalf Parker January 25th, 2009 01:21 PM

Re: mass poptype set script
 
Pros and Cons.
We could make them EXE executables but that tends to (and really should) make people nervous about downloading them and running it on their machine. But if people wish it I could exe this.

Omnirizon January 25th, 2009 01:42 PM

Re: mass poptype set script
 
this doesn't have any kind of UI. it's all done at the interactive interpreter. I could give it a UI, it wouldn't take much. then it could be usefully made into a .exe and/or an app

Gandalf Parker January 25th, 2009 02:00 PM

Re: mass poptype set script
 
I also meant to add that one of the advantages of raw script is the public domain-ness of the program. Its good to see so many of our community willing to post raw code.

Many users dont know how to use a pipe or command line utility.
And if you can .exe it then yes you might want to add an input for the paramters.

For me to exe it Id probably rewrite it into a language I know and then compile it. Altho I do see there are applications on the net for compiling python to exe.

Aezeal January 25th, 2009 03:29 PM

Re: mass poptype set script
 
I'd love a script where I could set certain poptypes for each landtype and then ti would randomly pick for each land from the appropriate list (this becuase dom3 K maps need defenders and poptype (I've got 5-7 or something) set manually for each province and it's a really nasty job do to.

If I could set certain poptypes for forest provinces (space) and others for all other provinces then that would be sweet.. if you could then make the defenders of the province the same as the poptype (and give a number of each defenders) it would be even better.

I'n not really asking cus it's probably a ****load more work but that is what I could use :D

Gandalf Parker January 25th, 2009 03:48 PM

Re: mass poptype set script
 
A lot of that is in the SemiRand code now. Either Ballbarian or I could probably cut that part out and modify it to your needs (him better than I actually)

Aezeal January 25th, 2009 03:50 PM

Re: mass poptype set script
 
that would be nice, I;ve not used the semirand yet, as it is it can't do what I need?

Gandalf Parker January 25th, 2009 04:08 PM

Re: mass poptype set script
 
Maybe. IIRC it does support having your own directory of your own files for it to fill in from


All times are GMT -4. The time now is 11:13 AM.

Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©1999 - 2025, Shrapnel Games, Inc. - All Rights Reserved.