Opened 11 years ago

Last modified 11 years ago

#1757 new enhancement

[PATCH] Script to automatically change unit stats — at Version 2

Reported by: alpha123 Owned by:
Priority: Nice to Have Milestone: Backlog
Component: Non-game systems Keywords: patch
Cc: Patch:

Description (last modified by leper)

I wrote a command-line script to automatically bulk-adjust unit stats.

Synopsis:

./changestats.pl --key Armour/Pierce --change 1 Melee Cavalry

Options:

--key, -k: This is the XML element to modify. Can be arbitrarily deep, i.e. Cost/Resources/food works as expected.

--change, -c: How much to modify the key by. For negative numbers, you'll need an equals sign: ./changestats.pl --Key Cost/BuildTime -c=-10 Domestic

--mod, -m: The mod to use. Defaults to "public".

--print, -p: If this is specified, changestats will only print matching templates and not do any modification.

Warnings: USE WITH CAUTION! THIS THING IS EXPERIMENTAL AND HASN'T BEEN THOROUGHLY TESTED! You probably ought to double-check that it made all the modifications correctly. That said, it has worked quite well for me so far.
It's also kind of slow. There's probably a much more efficient way to do what it does. Now, before you complain too much, it searches through hundreds of templates... anyway it is still much faster than adjusting stats by hand. I'm just warning you in case it seems like it's taking a while. That's normal.

Change History (3)

comment:1 by alpha123, 11 years ago

Oh, and it requires the XML::DOM module. I've since learned this might be somewhat outdated, though it works perfectly well. Anyway, it came with my installation, but I don't think it's standard. Sorry about that.

comment:2 by leper, 11 years ago

Description: modified (diff)
Keywords: patch added
Milestone: BacklogAlpha 13
Summary: Script to automatically change unit stats[PATCH] Script to automatically change unit stats

by alpha123, 11 years ago

Attachment: changestats.pl added
Note: See TracTickets for help on using tickets.