Freedom Reborn Archive

Freedom Force Forums => Scripting Forum => Topic started by: Boalt92 on June 21, 2007, 11:05:56 PM

Title: .dat to .txt?
Post by: Boalt92 on June 21, 2007, 11:05:56 PM
Are there any commands or utilities that would read the .dat and print to a text file?

The FFedit window is small, and id like a list of characters, fx, objects etc that i can either print or squeeze into a single window.

Not a major issue, I was just wondering if there is an easy way to do it.

Thanks in advance.

B92
Title: Re: .dat to .txt?
Post by: stumpy on July 03, 2007, 02:10:56 PM
The datfiles module makes that pretty easily doable.

What specifically to you want to do?

If you just want a list of the names of something from a particular control panel, then you can do that easily enough from the game console. (See the tech FAQ (http://freedomreborn.net/archive/index.php?topic=41006.msg572256#msg572256) for how to open the console, etc.)

For example, to print out a list of the FFEdit character names, enter
import datfiles
itemnames = datfiles.Campaign_ReadCharacters().keys()
itemnames.sort()
for item in itemnames: print item


If you want to print the FX names
import datfiles
itemnames = datfiles.Campaign_ReadFX().keys()
itemnames.sort()
for item in itemnames: print item


If you want to print the object names
import datfiles
itemnames = datfiles.Campaign_ReadObjects().keys()
itemnames.sort()
for item in itemnames: print item


And so on. Each of those is the same except for which datfiles particular function is called in the second line.

All the stuff printed to the console will be available in the script.log (and you can cut and paste it into Word, etc. for whatever your purposes are).
Title: Re: .dat to .txt?
Post by: Boalt92 on July 05, 2007, 10:46:02 AM
that's it exactly.

sometimes i ez script on my palm device and it's helpful to have templates, powers, etc. on a text file.

thanks

B92