preload button hover image:
HomeSearchRankingsStatisticsAboutContact
Current Time: Aug 13, 2022, 11:32:14 pm
 Dwarf Fortress File Depot » Utilities » Python Utilities
      
Registration is not required to download. However, it will allow you to vote, comment, and upload. Forgot your password?
File Listing: Python Utilities
Last Updated: Dec 09, 2013, 10:22:16 pm
First Created: Aug 19, 2013, 06:29:09 pm
File version: 2.3
For DF version: Multiple
Downloads: 116 (147) Size: 65.7 KB
Views: 1,347 (1,634) Type: RAR
Rating (1 votes): 5.0 / 5.0
Description
More utilities will be added to this package as them become public worthy

Modding with Excel!

Modding with Excel is a new set of python scripts I have been working on that allows you to move data between .txt and .csv (comma separated value) files. This allows you to add entries via Excel (or your favorite CSV reader) easily and cleanly, allowing for sorting and quick analysis of entries. Now working for items and inorganics. There are included csv files so you can see how to set them up.

PLEASE NOTE: In the columns with more than one entry the python program is expecting enters between the entries (i.e. \n). If people feel this is too limiting I can have it acknowledge the entries in a different way.

MWE_ITEMS: This utility will handle all item types (Weapons, Ammo, Armor, Gloves, Helm, Pants, Shoes, Food, Instruments, Tools, Toys, Siege Ammo, and Trap comps) by making separate files for each. To use, simply place the python script in your raws folder and run. It will prompt you if you wish to copy from Raw to CSV or CSV to Raw, choose by entering 1 or -1.

MWE_INORGANICS: This is a preliminary utility. It has all the function you need to create inorganics in Excel, but it doesn't break up the inorganic tokens by what they are commonly used for (i.e. there is a column for MEAT_NAME for all them). I am planning on adding some more logic to the program so that the csv files aren't so large, but currently it works fine (also supports syndromes in your inorganics). Functions the same as MWE_ITEMS.

MWE_PLANTS: Another preliminary utility that suffers from the same drawbacks as MWE_INORGANICS (although it does successfully parse the plants into trees, grasses, and crops) which makes the csv files more manageable.

Both MWE_INORGANICS and MWE_PLANTS works better to generate raws from then as a means for sorting data. More work needs to go into making the csv files generated useful.

MWE_CREATURES: This utility differs from the others in that it only works in one direction (namely to go from CSV files to RAW files). Because of the complexity of creatures I have also introduced a new feature, Templates! (I will be adding this feature into the other MWE scripts as well). Templates allow you to group your creatures with similar bodies, attacks, castes, and traits, while still giving you the ability to modify them. A sample attack template is provided below;
Code:
[TEMPLATE:BITE] [ATTACK:BITE:BODYPART:BY_CATEGORY:#ARG1] [ATTACK_SKILL:BITE] [ATTACK_VERB:bite:bites] [ATTACK_CONTACT_PERC:#ARG2] [ATTACK_PENETRATION_PERC:#ARG3] [ATTACK_FLAG_EDGE] [ATTACK_PRIORITY:#ARG4] [ATTACK_FLAG_CANLATCH]

you can reference this template by providing a line in the CSV file under the attack column BITE:BEAK:100:100:MAIN. Templates are able to handle an infinite number of arguments, but for ease of use it is best to keep your arguments limited in number. An example CSV file (creatures.csv) is included to show case the use of this script. In addition four template files are included (templates_ATTACK.txt, templates_BODY.txt, templates_CASTE.txt, templates_TYPE.txt) each with example templates that are referenced in the CSV file. This script allows fast an easy creation of new creatures. (NOTE: Currently only the ATTACK and CASTE templates support variable arguments, the BODY template uses specific arguments for materials and tissues, and the TYPE template has no argument support. This will be fixed in a later version)

Misc Scripts

ADD_CASTES: This utility adds caste information to creatures raws. It only modifies files specified and adds castes that are user specified to the creatures in those files (UPDATE: There is now an external file named creature_iist.txt that lets the user specify which creatures are actually modified). This allows adding things like giant variations directly to the creature instead of having them as a separate creature. This script requires input from the user. To use open the script with some text editor (I personally use VIM) and modify the required fields (there is short comments that explain what to do). Because of the extra level of complication with this script files in the objects folder will not be overwritten, instead a new file will be created in the raws folder which can then be checked to make sure it did what you wanted, and then put into the objects folder.

ADD_SIZE: This utility reads all of the creature raws and puts the max size of the creature (as listed in the creature raws) in the creatures description. This utility currently has several limitations. It does not add a size to any creature that doesn't have a size listed in the raws (most creatures that use the creature variation templates, like GIANT and ANIMAL_PERSON, don't have their own size listed), and it only lists the largest size in the raws. Also, subsequent runs will not change the values in the description, even if the values in the raws are changed. To run, simply put the python file in the raws folder and run it, it will modify all creature files in the objects folder. As always, it is a good idea to back up your files before running any utility that directly modifies files.

ORGANIZE_ENTITY: This utility reads the entity files and separates each entity into their own files. In addition it organizes the file into different components (e.g. Equipment, Items, Behavior, Ethics, Flavor, etc...) This allows for easier navigation of the entity files. To run, simply put the python file in the raws folder and run it, it will modify all creature files in the objects folder. As always, it is a good idea to back up your files before running any utility that directly modifies files.

SPLIT_CVARIATIONS: This utility reads through all of the creatures raws and seperates out the ANIMAL_PERSON and GIANT creature variations into their own files. This allows for easy deletion of these creatures for those that don't like having them in the game, or for easy manipulation. To run, simply put the python file in the raws folder and run it, it will modify all creature files in the objects folder. As always, it is a good idea to back up your files before running any utility that directly modifies files. (UPDATE: Fixed a bug that was brought to my attention by CryptoCactus)

SPLIT_REACTIONS: This utility reads through all of the reaction raws, and separates them into individual reaction files. I use this for taking apart mods where I just want to use one specific building. To run it all you need to do is place the python file in the raws folder and it will spit out an individual file for each building mentioned in the raws. I have personally used it with Masterwork and Genesis Reborn with no issues. Please note that some mods make use of hundreds of buildings, so it will generate hundreds of text files. Only use if you are wanting a specific buildings reactions separated out.

SPLIT_VERMIN: Same as SPLIT_CVARIATIONS except it pulls out vermin.
Raw Data: JSON / Text
Checksum / Hash
SHA-256: 8582497ffb0c47fe5f0eb7ed478d02570a39aa42f7c5457a1a80d1b3aba8e9c9
IP: logged
Commands
More From This Author
Comments
No comments have been posted for this file yet.
HomeSearchRankingsStatisticsAboutContact

Website © 2022 FenriSoft. The core site script is PHCDownload (© 2005-2022).
Hosted by Linode.