That would be helpful, I think, if it's not too much trouble. I ran the code with the the '\' in front of the bracket symbols, and it seems to have worked fine this time. Board should be ready for alpha testing soon!
I'm trying to use the "Add continents based on neighbors" feature to create basic continents (i.e. that yield a normal bonus rather than a factory bonus) that each have as a member territory a single territory. Those base territories are defined by a comma-separated list, like this:
Skull Mountain [H],Arborlon [F],Tyrsis [P],Culhaven [FH],Arishag [G]
I thought that this code should work:
ContinentsByNeighbors;;Skull Mountain [H],Arborlon [F],Tyrsis [P],Culhaven [FH],Arishag [G];;.*;;;5;;Capital Bonus;0;base;
But it instead made 5 continents named Capital BonusSkull Mountain [H], CapitalBonusArborlon [F],... that all had as their single base territory the upper-left-most territory on the board, which is not defined at all in the command. This territory also has the lowest territory ID as well, so I'm thinking maybe it got defaulted to when there was an error somewhere?
Anyhow, I tried another code line like this:
ContinentsByNeighbors;;Skull Mountain [H],Arborlon [F],Tyrsis [P],Culhaven [FH],Arishag [G];;\[Z\];;;5;;Capital Bonus;1;;
Which avoided the 0 for the range of neighbors to include, which I thought might be breaking it. I figured that by including a regex that wouldn't match any neighbors on the board, this would be a work-around that would still limit the continents to a single member territory. Instead, what I got was a set of five continents consisting of a ring of all the territories directly connected to the base territory, but not including the base territory! I don't know how the regex didn't filter them out, or why it refuses to include the base territory in the final continent!
I'm thoroughly stumped as to what to do and why none of the things I've tried are working. I suppose I could try the define a continent and delete it later option, but that seems like it might cause problems if I need to run this script over and over again (during the process of play-testing and adjusting parameters).
probably my bug. I rewrote lots of little bits recently. Thanks for helping me find these bugs. I'll try and fix this one tonight.
Ok. I think I fixed it. I *may* have broken other things in the process, please let me know.
Some details:
In XML, the various territory IDs (i.e., tid, fromid, toid, member) are strings, and in python when I get them from the XML they are strings. This causes various problems, most often when I try to add them to a set or list, it adds the individual characters (i.e. Instead of adding "12" for territory 12, it adds "1" and "2". This bug has bitten me in the ass in various places many many times, and I finally bit the bullet and added tons of checks/conversions. Hopefully I now turn these strings into integers everywhere I can, and then turn them back into strings before writing them to the XML.
It's entirely possible I missed some of these checks/conversions in the code, but I went over it a couple times. Hopefully this will reduce the incidence of these bugs in the future.
The "Define set of Neighbor territories" part of the hordes tool is not working. I tried it with regex, continents, and list of names (if the name has a comma can you just put "\,"?). Defining the base territories seems to be working correctly.
Also, it includes view only borders in determining neighbor territories. These should probably not be counted in the process.
I should have some time tomorrow night to look into those problems.
What should count for neighbor territories, just default borders?
Default and attack make the most sense to me. Artillery and view borders don't seem like they fit with the spirit of hordifying something. One way borders also seem a little problematic.
I think I fixed it. Stupid typo. I had: "neigbhorIDs" instead of "neighborIDs" in one spot.
I did not change the type of borders affected yet.
>list of names (if the name has a comma can you just put "\,"?).
I use the csv.reader functionality in python. I believe with commas, you enclose the entire name in quotes i.e:
"Atlanta, GA", "Albany, NY", "Denver, CO"
I haven't test this.
Ok - I think it should now only include "Default" and "Attack Only". I only did some basic testing, so let me know if you see any problems.
Another question. Say I have a board with a number of village territories and also a set of resource territories, in this example timber, ore, fish, and wheat. What I want to happen is that if a player controls a territory with a given resource type, then each village territory the player controls will get a +X standard factory bonus. Multiple resources owned simply adds new factory bonuses.
So, for example, say a player has two villages and takes over a timber-producing territory. Each village will now get a +2 factory bonus from the timber. The next turn, the player gains a wheat-producing territory. Now each village, in addition to the +2 from timber, also produces a +1 from the wheat. The player takes another village the following turn, which then also produces +2 from timber plus +1 from wheat.
Is there any way to use your XML editor to automate making all these pairs of factories? Basically, my problem is that I have several dozen village and several dozen resource territories, which makes for a boatload of possible combinations... It's pretty much impossible without automating the continent creation!
Here is the board in question: http://www.wargear.net/boards/view/5338
I think that should be possible. To late here for me to think out the details, but I can probably come up with it in the next day or two.
Kjeld, When I did this - for that other map, I did it in excel. The xml is pretty easy to edit and the factories aren't too hard to create if you have a good handle on vlookup.
You just have to figure out which territory id's are wheat, and which are villages and make a set of factories that produce to the cities. Use the autofill and bobs your uncle. Repeat for other resources.
Mind you, if it can be done with a filter... that'd be way more awesome.
Well, I can't figure out a way to do it with current WGAME functionality, but it does seems like it would be a commonly desired feature. Unfortunately I can't imagine when I'll have time to work on it in the near future, so you may be better off with ratsy's method, if that seems doable to you.
- I'm totally shooting in the dark here -
There is no way to input a set of territory numbers (in this case the resources) - or even better the "names" of the territories (wheatx, oilx, etc.)
And then input a list for the towns - and just have python layout all the permutation and create the xml lines?
-That's all I got for being helpful with something I know nothing about....
There probably is a way to do it, IF I knew any Python... The bigger pain, really, is going in andmanually finding all the right territory IDs. Right now, I've tagged them with labels in the territory name (e.g. [FI] for fish). Maybe I could grab all the matching territory IDs quickly with a manual search through the XML...
In any case, thanks for looking into it Ozy. I was pretty sure the existing advanced editor didn't quite have the right functions for this, but wanted to make sure before I launch into a time-consuming manual process.
Well, it took me a couple hours and some fancy Excel work-arounds, but I finally got it all to work. Just shy of 1000 factory continents!
Oh Excel. Is there anything you can't do?
ratsy wrote:Oh Excel. Is there anything you can't do?
Transform the values in a table into a single stacked column (without a macro)?