Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  
Pages: 1 [2] 3

Author Topic: Python Utilities for DF now with Modding with Excel! (v2.3)  (Read 8472 times)

Roses

  • Bay Watcher
    • View Profile
Re: Python Utilities for DF now with Modding with Excel! (v2.2)
« Reply #15 on: December 05, 2013, 11:38:27 am »

If you make a sublist like {Attack1,Attack2,Attack3} and then join the sublist with new line commands (i.e. \n) then in a pure data format they will look like Attack1\nAttack2\nAttack3 but in a visualizer like Excel or Open Office they will look like;

Attack1
Attack2
Attack3

The only down side to this method is that it can sometimes cause the default width of a column to be large (but just re-sizing it in Excel fixes that problem)
Logged

Maklak

  • Bay Watcher
    • View Profile
Re: Python Utilities for DF now with Modding with Excel! (v2.2)
« Reply #16 on: December 05, 2013, 11:55:27 am »

I just tried a CSV file with

Code: [Select]
ID, name, Attack
AXE, Axe, Att1\nAtt2\nAtt3
HAMMER, Hammer, Att4\nAtt5


And it didn't work the way I wanted it to in Open Office. Would you please paste a few sample lines from your csv weapon files? It may be just a problem with my Opern Office being old.

EDIT: Never mind, I found it. I run OO, copied a "\n" from an open text document into a spreadsheet cell by selecting end of line and beginning of next line, saved it as a CSV and it now works.

Code: [Select]
"ID","Name","Att"
"AXE","Axe","Att1
Att2
Att3"
"HAMMER","Hammer","Att4
Att5"

It looks stupid and I'd rather have a more elegant way to do it, but this is definitely something I want to patch into my scripts. It needs those quotation marks too.
« Last Edit: December 05, 2013, 12:49:53 pm by Maklak »
Logged
Quote from: Omnicega
Since you seem to criticize most things harsher than concentrated acid, I'll take that as a compliment.
On mining Organics
Military guide for FoE mod.
Research: Crossbow with axe and shield.
Dropbox referral

Roses

  • Bay Watcher
    • View Profile
Re: Python Utilities for DF now with Modding with Excel! (v2.2)
« Reply #17 on: December 05, 2013, 12:12:22 pm »

I believe you need to put quotes around the attacks, I'm not at my computer right now, but I will paste when I get there.
Logged

Roses

  • Bay Watcher
    • View Profile
Re: Python Utilities for DF now with Modding with Excel! (v2.2)
« Reply #18 on: December 05, 2013, 02:56:56 pm »

EDIT: Never mind, I found it. I run OO, copied a "\n" from an open text document into a spreadsheet cell by selecting end of line and beginning of next line, saved it as a CSV and it now works.

Code: [Select]
"ID","Name","Att"
"AXE","Axe","Att1
Att2
Att3"
"HAMMER","Hammer","Att4
Att5"

It looks stupid and I'd rather have a more elegant way to do it, but this is definitely something I want to patch into my scripts. It needs those quotation marks too.

Yeah, that's how it will look when you open it up in notepad or something like that. If you open it in OO though it should look just like mine does.
Logged

Maklak

  • Bay Watcher
    • View Profile
Re: Python Utilities for DF now with Modding with Excel! (v2.2)
« Reply #19 on: December 05, 2013, 04:03:43 pm »

> Yeah, that's how it will look when you open it up in notepad or something like that. If you open it in OO though it should look just like mine does.
It does work in OO, but I needed to know how it looks in notepad to be able to write output text like that. I now have another reason to treat txt and csv tables differently.
Even if your set of scripts is better for the ability to put changes back into RAWs, I still want to write my own RAW2table scripts and improve the output in any sensible way I can. For example I add explanations and comments under the tables for most output formats, but they just don't work out for CSV.

> Please let me know if you have any ideas for new scripts.
Well, I did plants, creatures and weapons for my scripts. What remains are (at least) armour, materials, reactions (sorted by buildings), buildings (with items required) and interactions / syndromes. Then the idea is to refactor and merge everything and have a big, modular script that has all kinds of complicated hash tables to store all this (plus entities and whatever else seems like a good idea), then print a whole bunch of html files with tables with links, so that for example walking along a chain of interactions is easy. It shouldn't be that hard to always put an anchor or a link on any ID anywhere.
If you do any of those with editing, more power to you.

BTW, this is in some ways similar to what you or I are doing, but targeted at players, not modders: http://www.bay12forums.com/smf/index.php?topic=131301

So well, thanks for making me realise, multiline cells in a spreadsheet from a CSV are possible and that quotations are crucial. Sorry for just stealing some spotlight in this thread and not being of help.
Logged
Quote from: Omnicega
Since you seem to criticize most things harsher than concentrated acid, I'll take that as a compliment.
On mining Organics
Military guide for FoE mod.
Research: Crossbow with axe and shield.
Dropbox referral

Roses

  • Bay Watcher
    • View Profile
Re: Python Utilities for DF now with Modding with Excel! (v2.2)
« Reply #20 on: December 05, 2013, 04:22:35 pm »

No problem, glad to be of help. Sounds like what you are doing is pretty different from what I intended. Definitely sounds useful though, especially the html files with links and such.

 I mostly just made these scripts because I like working in spreadsheets, and I think it makes adding in new items and such easier than parsing through the raws and finding things of similarity (also decreases the chance that I will somehow screw up the raws with copying and pasting).
Logged

Meph

  • Bay Watcher
    • View Profile
    • worldbicyclist
Re: Python Utilities for DF now with Modding with Excel! (v2.2)
« Reply #21 on: December 07, 2013, 05:37:26 am »

Watching with interest :)
Logged
::: ☼Meph Tileset☼☼Map Tileset☼- 32x graphic sets with TWBT :::
::: ☼MASTERWORK DF☼ - A comprehensive mod pack now on Patreon - 250.000+ downloads and counting :::
::: WorldBicyclist.com - Follow my bike tours around the world - 148 countries visited :::

Roses

  • Bay Watcher
    • View Profile
Re: Python Utilities for DF now with Modding with Excel! (v2.3)
« Reply #22 on: December 09, 2013, 11:23:44 pm »

Modding with Excel now includes Creatures!

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: [Select]
[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)
Logged

milo christiansen

  • Bay Watcher
  • Something generic here
    • View Profile
Re: Python Utilities for DF now with Modding with Excel! (v2.3)
« Reply #23 on: December 12, 2013, 11:54:19 am »

Just a suggestion: If you were to use Rubble as a backend (by generating your raws with Rubble template calls embedded, then calling Rubble to finish the job) you could get a powerful template system, a module system, and compatibility with a broad assortment of raw tweaks and libraries, for basically "free".

It wouldn't even be hard to do, for the bite example:
Code: [Select]
{!TEMPLATE;ATTACK_BITE;bp;contact;penetrate;priority;
[ATTACK:BITE:BODYPART:BY_CATEGORY:%bp]
[ATTACK_SKILL:BITE]
[ATTACK_VERB:bite:bites]
[ATTACK_CONTACT_PERC:%contact]
[ATTACK_PENETRATION_PERC:%penatrate]
[ATTACK_FLAG_EDGE]
[ATTACK_PRIORITY:%priority]
[ATTACK_FLAG_CANLATCH]
}
Then insert calls to ATTACK_BITE like so: {ATTACK_BITE;BEAK;100;100;MAIN} and let Rubble do the work :)
Logged
Rubble 8 - The most powerful modding suite in existence!
After all, coke is for furnaces, not for snorting.
You're not true dwarven royalty unless you own the complete 'Signature Collection' baby-bone bedroom set from NOKEAS

Roses

  • Bay Watcher
    • View Profile
Re: Python Utilities for DF now with Modding with Excel! (v2.3)
« Reply #24 on: December 12, 2013, 04:03:19 pm »

It's already compatible with Rubble in a way, but I don't want to require another program since It already required Python. Also, I am planning some new features that won't really fit with Rubble.

One thing I have always been interested in is a method for making raws more readable (indenting child tags automatically and such). Is that a feature you have thought about for Rubble? I was planning on doing it in Python, but if you already have a system in place theres no reason for me to reinvent the wheel.
Logged

milo christiansen

  • Bay Watcher
  • Something generic here
    • View Profile
Re: Python Utilities for DF now with Modding with Excel! (v2.3)
« Reply #25 on: December 13, 2013, 11:12:06 am »

Nope, no pretty printer.
My philosophy about pretty printers is that if you need one, something is wrong with your generation. Of course if you are generating EVERYTHING instead of just sections some kind of pretty printer is a must I guess.

I did have one (for another project), but it was VERY basic and only supported two levels of indentation. It would be trivial to write a better one than what I had.

I understand that Blast had one, it's written in perl but you should be able to port it to python without too many problems :)
(The thread for Blast is near the end of the second page of this board)
Logged
Rubble 8 - The most powerful modding suite in existence!
After all, coke is for furnaces, not for snorting.
You're not true dwarven royalty unless you own the complete 'Signature Collection' baby-bone bedroom set from NOKEAS

Roses

  • Bay Watcher
    • View Profile
Re: Python Utilities for DF now with Modding with Excel! (v2.3)
« Reply #26 on: July 15, 2014, 12:57:32 pm »

Note sure if anyone besides me uses any of these scripts, but in the lull between the release and DF once again being playable, I have begun updating them for the new version.
Logged

Urist McGoombaBrother

  • Bay Watcher
  • Trust the plump helmet! ♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠
    • View Profile
Re: Python Utilities for DF now with Modding with Excel! (v2.3)
« Reply #27 on: January 19, 2015, 02:26:52 pm »

That project sounds plain awesome. But I have never worked with python and you said the update to DF v40.x isn't ready so far anyway.

However, you also stated something about testing. Just in case you exported already the RAWs of following files in Excel during testing, do you mind uploading those excel-files somewhere? That would be a tremendous help. Thx.

plant_crops.txt
plant_garden.txt
plant_grasses.txt
plant_new_trees.txt
plant_standard.txt

Roses

  • Bay Watcher
    • View Profile
Re: Python Utilities for DF now with Modding with Excel! (v2.3)
« Reply #28 on: January 19, 2015, 03:50:27 pm »

Oh man, I'm going to be perfectly honest, I had completely forgotten about this project. But it is one I want to start up again. I think I left it in a decent state, but I know I haven't added all of the new 40x stuff. Luckily all the other scripts should still work, its just the MWE scripts that I will need to look through again. Consider it added to my todo list.
Logged

jason0320

  • Bay Watcher
    • View Profile
Re: Python Utilities for DF now with Modding with Excel! (v2.3)
« Reply #29 on: July 17, 2015, 10:13:16 am »

Hello? Is this going to be continued?
Logged
Pages: 1 [2] 3