Hello, just wrote a small toy in case anyone's interested. It's a python script to help manage FBI files in case you need to do repetitive changes to large amount of them. Also practical for dumping information from the files.
EDIT: and ofcourse I screwed up the release, there was a minor bug .. and then I uploaded a version with debug code in it. Ohwell, here's the one that should be fine:
http://spring.unknown-files.net/file/30 ... 07-06-18c/
FBI batch editor
Moderator: Moderators
There are some other uses for my fbi batch editor. For example, we might want to know what's most profitable unit for producing energy. We assume energy gets converted into metal using MMMs, and want to know how long it takes for an unit to pay its own cost back. Units which take more than an hour for payback are excluded.
testfoo.py:
The fbiedit is then invoked with:
fbiedit.py ba\units\*.fbi -f testfoo.py -r
And the results should look like this:
testfoo.py:
Code: Select all
mmm_ratio = 12.0/600.0
if locals().has_key('energymake') and locals().has_key('energyuse'):
etotal = float(energymake)-float(energyuse)
if (etotal > 0):
cost_in_e = float(buildcostenergy) + float(buildcostmetal)/mmm_ratio
payback_time = cost_in_e / etotal
if payback_time < 3600:
print "%4s %25s: %+7.1f (pays itself in %d s)" % (side, name, etotal, payback_time)
fbiedit.py ba\units\*.fbi -f testfoo.py -r
And the results should look like this:
Code: Select all
ARM Advanced Fusion Reactor: +3000.0 (pays itself in 173 s)
ARM Advanced Solar Collector: +75.0 (pays itself in 291 s)
ARM Air Repair Pad: +40.0 (pays itself in 875 s)
ARM Colossus: +225.0 (pays itself in 666 s)
ARM Cloakable Fusion Reactor: +1000.0 (pays itself in 243 s)
ARM Fusion Reactor: +1000.0 (pays itself in 220 s)
ARM Scarab: +200.0 (pays itself in 799 s)
ARM Solar Collector: +20.0 (pays itself in 362 s)
CORE Bladewing: +2.0 (pays itself in 1950 s)
CORE Advanced Fusion Reactor: +3000.0 (pays itself in 166 s)
CORE Advanced Solar Collector: +75.0 (pays itself in 281 s)
CORE Air Repair Pad: +40.0 (pays itself in 892 s)
CORE Hive: +225.0 (pays itself in 682 s)
CORE Fusion Reactor: +1100.0 (pays itself in 214 s)
CORE Hedgehog: +200.0 (pays itself in 838 s)
CORE Solar Collector: +20.0 (pays itself in 352 s)
Generic TDF editor in the same spirit:
http://hack.fi/~muzzy/files/tdfedit_2007-06-20.zip
for example, to list crush strengths from moveinfo:
tdfedit.py moveinfo.tdf -e "for k in sorted(TDF.keys()): x=TDF[k]; print '%8s %s' % (x['name'], x['crushstrength'])" -r
or to double them and write to moveinfo.tdf.new:
tdfedit.py moveinfo.tdf -e "for x in TDF.values(): x['crushstrength'] = int(x['crushstrength'])*2" -s .new
http://hack.fi/~muzzy/files/tdfedit_2007-06-20.zip
for example, to list crush strengths from moveinfo:
tdfedit.py moveinfo.tdf -e "for k in sorted(TDF.keys()): x=TDF[k]; print '%8s %s' % (x['name'], x['crushstrength'])" -r
or to double them and write to moveinfo.tdf.new:
tdfedit.py moveinfo.tdf -e "for x in TDF.values(): x['crushstrength'] = int(x['crushstrength'])*2" -s .new