Bay 12 Games Forum

Please login or register.

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

Author Topic: Perl scripts that read RAWs and present tables of data (plants, creatures)  (Read 11905 times)

Maklak

  • Bay Watcher
    • View Profile

I looked at the script output for Masterwork, namely ITEM_WEAPON_BOOBY_TRAP and TOTEM. There is nothing unusual about them. I could highlight 1H and 2H values above a certain threshold, but someone could mod in a race with SIZE 25M, so I wouldn't even know what to use for a threshold. Maybe that's material for another script parameter. Or reading entities for fort / adventure mode controllable, reading creatures for their SIZE and variations of it, then highlighting items that can't be worn by anyone, but that's an overkill for such a small feature.

There is nothing unusual about the TOTEM ammo either. It is only the material that has a syndrome. At the level my script operates that's too deep to crawl. Well, with a name like TOTEM or SPELLWRAITH one might expect something special, but the script just treats them normally and ignores materials completely.

I mean for the civilisations, I read ENTITY, then store their permitted items and reactions in hash tables. That is, I have an array of entities and each entry is a Hash with keys such as ITEMS and REACTIONS. Then under those keys I store hashes with keys being permitted item or reaction IDs. So when for an entity (defined $ent->{"ITEMS"}{$ID}), that item is available at embark. If not, I have to get (keys %{$ent->{"REACTIONS"}}), that is all reaction IDs for that entity, then cross-reference them with all reactions and their products. 
I read reactions separately and store just their products in a Hash of Hashes, so if an entity has a permitted reaction and for that reaction (defined $react{$r}{$itemID}), then that item can be made in a custom reaction. To also keep things like reagents, I'd need to make it a hash of hashes of hasehes.

I know this must sound like technobabble to a non-programmer, but let me get to the point. Entities were more tricky than they look, but only took me a few hours to implement and test. To display syndromes for ammo and melee weapons, I would have to:
0) Read melee weapons and ammo as I already do.
1) Read reactions, paying attention to product materials, not just IDs. This includes both GET_MATERIAL_FROM_REAGENT and specifying material directly. This is doable and I'll need to do that for reactions script anyway. Well, except when it is GET_MATERIAL_FROM_REAGENT and that reagent has a REACTION_CLASS or something and no specified material. Or when a reagent has no specified material, but it is only obtainable through other reactions and then it is always made out of a few materials. I would also have to watch out for loops of assemble / disassemble if I cascade.
2) Read inorganic RAWs, paying attention to IDs, names and (dfhack) syndromes.
3) For all weapons and ammunition check all the reactions that have it, possibly using recurrence on GET_MATERIAL_FROM_REAGENT with no single / specified material. Once I have all possible materials, I need to check them for syndromes, then print their names. Oh, and I'm sure there are some gotchas with reactions classes, weapon-grade metals and leather.

All in all, I don't want to go that deeply and (for now) the modders may use "--extra=<text>" option to get an extra column and fill it with whatever they want. The weapons script has well over a thousand lines as it is.

I welcome new feature requests, but some of them may be so hard or tedious to implement that I simply won't bother. Listing (some?) materials might be considered eventually, but not for this version of weapons script. So while the suggestion is useful and would also work for things like Power Armour for the next script, it is difficult to implement properly. On the other hand, some suggestions that may seem difficult, may be actually pretty easy to add on top of what I have.

> Glad to see that you are working on this.
Well, even when I am working on this, I don't see enough of a reason to write daily or weekly reports on how I added features and fixed bugs. I only post previews when I have something new to show or some questions.

If all goes well, I should publish the script tomorrow and also upload a new version of plants.pl where I added the --nocolour option and backported a few minor fixes.
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

Meph

  • Bay Watcher
    • View Profile
    • worldbicyclist

Oh no, it wasnt a feature request. While not a programmer, I can understand how difficult this is, I just remarked upon those, as an example for something that the script cant do. Just wanted to let you know about it, in case you wondered about the odd names and values.
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 :::

Maklak

  • Bay Watcher
    • View Profile

Uploaded a slightly improved version of plants.pl and published weapons.pl

BTW, I'm impressed by Regen mod's use of "bow and long sword" and similar ranged weapons with attacks of melee weapons. The normal approach to better melee weapons is "something with bayonet", like "rifle with under-barrel chainsaw", but to just take bow and a sword and combine them into a set (in fluff) works too :)

As usual you can leave me comments, bug reports and feature requests. I guess armour script is next.

EDIT: On second thought when creating special items with itemsyndromes, the material is usually listed in the PRODUCT line and reading inorganic RAWs for syndromes isn't that difficult, so it is only listing all the materials that's challenging. I might do it eventually, but am not working on it now.
« Last Edit: August 09, 2013, 11:50:04 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

Hugo_The_Dwarf

  • Bay Watcher
  • Modding Mentor
    • View Profile
    • Regeneration: Forced Evolution

Do your scripts go through every file? or does it only search files that have a certain target in them?

Like:
Look through files
-does file have "Item_Weapon" in filename?
--Yes open file, extract targets, save values
--No skip and move on

or does it just look in every file and look for [ITEM:ITEM_WEAPON_*]
Logged

Maklak

  • Bay Watcher
    • View Profile

> Do your scripts go through every file? or does it only search files that have a certain target in them?

I guess, I'll have to write a manual someday, including the basics of using a shell.

My scripts read every file you tell them to and the shell conveniently expands globs for you, so for example *.txt will be expanded to a list of text files in current directory (which inside raw/objects happen to be DF RAWs). If you want to only read the files with *Item_Weapon*.* then just use the glob I've just written, but add --nocivs because there will be no entity and reaction data if you only read weapons and you'll get an empty column otherwise. You can test globs using ls.
$ ls *Item_Weapon*.*
$ ls *.txt
The scripts saying things like "read 0 items" is a dead give-away they didn't get the right files to process.

My scripts generally work like this:
0) Look through @ARGV, the list of command line parameters and recognize script options. Set global variables (so if some options are mutually exclusive, only the last one is used, with no warning).
1) Treat the rest of script parameters as a list of files. It doesn't care about filenames. Nor should it. The options always must come before filenames. (This is a necessary convention, because some idiot might begin a file name with a minus sign and the admin must be able to  $ rm -f -- -stupid_file_name).
2) Read everything in specified files and look for [<token>], matching every token to a series of regexps. Note that this is context-sensitive and things like reactions, weapons and so on should be in separate files. This is because while reading something complex, I didn't bother to list all permitted tokens and just skip those I'm not interested in. That is, I have a master-function for looking for what to read (weapons, ammo, entities, reactions) and helper functions for reading specific data, but those functions generally just skip unknown tokens and only return on end of file or next item of similar type.
3) While reading token after token, the global data for things like weapons are constructed. Those usually consist of arrays of hashes. For example there is an array of weapons, where each entry has keys like "ID" or "NAME" or "MIN_SIZE".
4) Once all the files are processed, print the tables in specified format to standard output.
5) Discard all read data and end.
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

Hugo_The_Dwarf

  • Bay Watcher
  • Modding Mentor
    • View Profile
    • Regeneration: Forced Evolution


Quote
1) Treat the rest of script parameters as a list of files. It doesn't care about filenames. Nor should it. The options always must come before filenames. (This is a necessary convention, because some idiot might begin a file name with a minus sign and the admin must be able to  $ rm -f -- -stupid_file_name).

Can't you have the script place a filename in a contained value? or at least something where a filename is read only as a string with no commands?
Would be cool if could just punch in "Look in all creature_ files, and get me information on NAME (ID token would be background CREATURE:DOG), Description, Child, Baby, Intelligent/can_learn/Slow_learner, etc. And have a list of all the info I want, from every creature in my mod (without saying, use file1,file2,file3,file4,file5) because I have 48 separate creature files, would be nice just to say "Look in these things, thanks"

But how yours works, works. Might use it sometime, or I might make my own since I have some IO code kicking about that pretty much does that, just need to modify it more lol

Oh also another thing is they anyway to tell the output to have certain values? like NAME header column is "width=150px" and Descripton column is "Width=15%" and the rest can fight for the remainder of the HTML screen (I assume and from the looks your script outputs usable HTML tables)
Logged

Maklak

  • Bay Watcher
    • View Profile

> Listing all creature files.
Yeh, I'll include that in the manual... that I'm kinda writing now. Basically, the shell does this for you with globs. If you want all creature_ files, use *creature_*.* (don't put it in quotation marks or it won't work) and the shell will expand it into a list of files matching that pattern in the current directory (where * is any character string). You can test it with
$ ls *creature_*.*
$ dir *creature_*.*
Personally I just use *.txt which makes the scripts read all the RAW files (skimming most of them) and takes only a few seconds anyway.

Quote
Oh also another thing is there anyway to tell the output to have certain values? like NAME header column is "width=150px" and Descripton column is "Width=15%" and the rest can fight for the remainder of the HTML screen (I assume and from the looks your script outputs usable HTML tables)
Well, it just outputs minimal html code that works in Firefox, so the tables look OK, but for example the html header is just <content-type: text/html> and there isn't even a head or body, which works, but I don't think is standard compliant. Heck, the tables have no "title row", I just bold the column names and don't use even use <th> tags, just <tr>. The browser seems to make the width of columns sensible, especially on a wide screen, so I didn't fiddle with it.
To do what you ask, I'd have to add a lot of options for columns or maybe do something smart. Then try to support that for other output formats. My current take on it is that you can edit the html file manually and add things like column width, which is easier and faster for you (on an existing table) than for me (adding column width options to the scripts). I don't plan to polish these scripts to perfection, just make them produce reasonably usable tables, do all the tedious work and don't crash. Editing the tables before making them a part of some manual or something is a good idea. My time to work on this project is limited and I'd like to finish it sometime, so I'm willing to cut some features that might be useful.

If you have any working suggestions for what you want or even some working code, feel free to post it, but I reserve the right to not merge or support any patches. Just remember to play around with the options first, because maybe you'll get the tables to look OK without writing any code.

If you want to modify column names or add some width tags to them, search for "print $btb", the columns are named right below it.

> NAME (ID token would be background CREATURE:DOG), Description, Child, Baby, Intelligent/can_learn/Slow_learner, etc.
This is the actual information from modders that is relevant to me for deciding which parts of creature RAWs to read. RAW tags that you people want to see are especially useful.
Id, name, description are in.
Child / Baby - well, I guess with --verbose_size you can deduce that information from the Size column, because it will print when size changes, which I think marks transitions from baby to child to adult. Is that good enough? Or do you mean the number of children and multiple litter rare?
Intelligent/can_learn/Slow_learner - all of those and more (too many?) show up in the Misc tokens column.
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

Hugo_The_Dwarf

  • Bay Watcher
  • Modding Mentor
    • View Profile
    • Regeneration: Forced Evolution

By Child/Baby I mean [BABY:1][CHILD:12]
See by most BODY_SIZE shows how what size they are at what age, But a modder could have many BODY_SIZE calls (maybe the creature matures at age 3 [CHILD:3] but is not fully grown until age 21)

It's nice to assume that BODY_SIZEs final call is the mature age, but I know I have [BABY:1][CHILD:6] but have [BODY_SIZE:12:0:70000] on humans, they mature and work before they are fully grown.

And a Misc column with those tags that are important but not very unique I guess works

NameDescriptionetcetcetc
Misc Tags
Toddsome guy.........[INTELLIGENT][SWIMS_LEARNED][CARNIVORE/BONECARN][UTTERANCES]
Logged

Maklak

  • Bay Watcher
    • View Profile

Here is an example for Regen mod: https://dl.dropboxusercontent.com/u/71287918/Scripts/regen.html

$ ../creatures.pl --html --misc --desc --all --compact --nobiome *.txt >../out.html

It lacks biome information, but otherwise prints everything that my creature script can print. At this moment not all the misc tags you listed are read and I think, I'll be adding BABY and CHILD to misc tags.

Hm, mysteriously some of my scripts work without the perl -w at the beginning and some don't, even though the first line in them is #!/usr/bin/perl -w and they are marked executable. Oh well.
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

Meph

  • Bay Watcher
    • View Profile
    • worldbicyclist
Re: Perl scripts that read RAWs and present tables of data (plants, creatures)
« Reply #39 on: September 02, 2013, 07:24:08 am »

Downloaded all of them (plants, creatures, weapons) and will see how far I can improve the manual with them. Will keep you updated.

Are you still working on more items-scripts, or reactions/buildings?

I'm sorry to be so short-handed atm, I only got 1h of internet here. Running out of time.

EDIT: Got around to it and extracted all the info. Yet again, the '$' is "an unsupported command", and '*' are not recognized, so I had to put all raws manually into a file called "creature_all.txt" and "weapons_all.txt", but thats not a big deal. The readout is fine, although I couldnt quite figure out how to extract the maximum info on creatures... for example the "misc" for no stun and no eat and so on is missing in my case.

I packed all of them into some nice-ish html files and will include them a quick-guides in the next download.

As a feature request I can only come up with:
 - Armor Script for armors, gloves, helms, pants, shoes, shields.
 - Info on creatures: Has Poison/Venom, Is Megabeast (includes Semimegabeasts), Is Webber.
 - Milk only yes/no. instead of a number.
 - Size instead of 60000 should be 60kg, is easier to read for users.
 - Speed: Normal, Fast, Slow. instead of numbers.
 - Biome: instead of SAVANNA_TROPICAL, FOREST_TROPICAL write: Savanna, Tropical Forest. Easier on the eyes.

These probably go against everything you hold dear, like correct, absolute numbers, but I use the scripts to make tables for a manual. I assume that people that read the manual cant read raws (otherwise they would be reading the raws, not the manual), so hard, cold numbers are bad. Easy, simple texts are good. ;)
 
 - Inorganic Script for metals. Stones and so on are not so interesting, but people often ask about what metal they should use for what. That one would be a lot easier to write then weapons/armor, since the values are easy to interpret.

If I'd have to put them in a most wanted list it would be:
#1 Inorganics/Metals, because its easier to write then the armor.
#2 Armors
#3 More creature info

Thank you again for the scripts. :) With your perl scripts and roses python scripts the process of upgrading the MasterworkDF Manual has really become a bit easier. :)

EDIT: Actually.. I just found this:  http://dwarffortresswiki.org/index.php/Masterwork:Armor
Has been made today, and now the armor script is a lot less of a priority all of a sudden. :)
« Last Edit: September 08, 2013, 04:59:56 am by Meph »
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 :::

Maklak

  • Bay Watcher
    • View Profile

@Meph: Thanks for feedback, I missed your update to it. I shoud implement most suggestions soon, because the motivation to make a few changes is nowhere near "Do I want to spend a few days wrting another script?". 

===  Testing Armour script - this post is subject to edits ===
$ perl -w ../armour.pl --bbcode --sort=LAYER *.txt > ../armour_bb.txt

EDIT: This is all the edits for now. I'm rather happy with the results. Now I can backport a few things to other scripts and perform most of Meph's fixes to creature script.



Table of helmets and headgear: (count: 8)
 
Name
 ID
Mat. SizeArm. Lvl.SizePermitLayerCoverStr. El.MaterialsCivs
ITEM_HELM_VEIL_FACE
 face veil
2010100Under50THREADLe SoPLAINS(A)
ITEM_HELM_MASK
 mask
20 2010Under50THREADBa Ha Le Me Sc SoPLAINS(A) EVIL
ITEM_HELM_CAP
 cap
10+ 1015Over50THREADHa Le Me SoMOUNTAIN(F, A) FOREST(A) PLAINS(A) EVIL
ITEM_HELM_VEIL_HEAD
 head veil
2010100Over50THREADLe SoFOREST(A) PLAINS(A)
ITEM_HELM_SCARF_HEAD
 headscarf
2010100Over50THREADLe SoFOREST(A) PLAINS(A)
ITEM_HELM_TURBAN
 turban
2020100Over50THREADLe SoFOREST(A) PLAINS(A)
ITEM_HELM_HELM
 helm
21+ 3020Armor100--Ba Ha Le Me ScMOUNTAIN(F, A) FOREST(A) PLAINS(A) EVIL
ITEM_HELM_HOOD
 hood
2010100Cover100THREADLe SoMOUNTAIN(F, A) FOREST(A) PLAINS(A) EVIL



Table of upper body armour and clothes: (count: 12)
 
Name
 ID
Mat. SizeArm. Lvl.UBSTEPLBSTEPSizePermitLayerCoverStr. El.MaterialsCivs
ITEM_ARMOR_DRESS
 dress
50MAXMAX1050Under100THREADLe SoMOUNTAIN(F, A) FOREST(A) PLAINS(A)
ITEM_ARMOR_SHIRT
 shirt
30MAX01050Under100THREADLe SoMOUNTAIN(F, A) FOREST(A) PLAINS(A)
ITEM_ARMOR_TUNIC
 tunic
30011050Under100THREADLe SoMOUNTAIN(F, A) FOREST(A) PLAINS(A) EVIL SKULKING
ITEM_ARMOR_COAT
 coat
50MAX12050Over100THREADLe SoMOUNTAIN(F, A) FOREST(A) PLAINS(A)
ITEM_ARMOR_MAIL_SHIRT
 mail shirt
62111550Over100CH_ALLHa MeMOUNTAIN(F, A) FOREST(A) PLAINS(A) EVIL
ITEM_ARMOR_ROBE
 robe
60MAXMAX20100Over100THREADLe SoMOUNTAIN(F, A) FOREST(A) PLAINS(A) EVIL
ITEM_ARMOR_TOGA
 toga
501130100Over100THREADLe SoMOUNTAIN(F, A) FOREST(A) PLAINS(A)
ITEM_ARMOR_VEST
 vest
20001050Over50THREADLe SoMOUNTAIN(F, A) FOREST(A) PLAINS(A)
ITEM_ARMOR_BREASTPLATE
 breastplate
93 002050Armor100--Ha MeMOUNTAIN(F, A) FOREST(A) PLAINS(A) EVIL
ITEM_ARMOR_LEATHER
 leather suits of armor
61 112050Armor100--LeMOUNTAIN(F, A) PLAINS(A) EVIL
ITEM_ARMOR_CAPE
 cape
300010300Cover50THREADLe SoFOREST(A) PLAINS(A)
ITEM_ARMOR_CLOAK
 cloak
50MAX115150Cover100THREADLe SoMOUNTAIN(F, A) FOREST(A) PLAINS(A) EVIL



Table of pants and lower body grab: (count: 9)
 
Name
 ID
Mat. SizeArm. Lvl.LBSTEPSizePermitLayerCoverStr. El.MaterialsCivs
ITEM_PANTS_LOINCLOTH
 loincloth
10--1030Under50THREADLe SoFOREST(A) PLAINS(A) EVIL SKULKING
ITEM_PANTS_BRAIES
 pairs of  braies
3011030Under100THREADLe SoFOREST(A) PLAINS(A)
ITEM_PANTS_THONG
 thong
10--1030Under25THREADLe SoFOREST(A) PLAINS(A)
ITEM_PANTS_SKIRT_LONG
 long skirt
20MAX10100Over100THREADLe SoFOREST(A) PLAINS(A)
ITEM_PANTS_PANTS
 pairs of  trousers
40MAX1530Over100THREADLe SoMOUNTAIN(F, A) FOREST(A) PLAINS(A) EVIL
ITEM_PANTS_SKIRT_SHORT
 short skirt
20--10100Over100THREADLe SoFOREST(A) PLAINS(A)
ITEM_PANTS_SKIRT
 skirt
20110100Over100THREADLe SoFOREST(A) PLAINS(A)
ITEM_PANTS_LEGGINGS
 chain leggings
51+ MAX1530Armor100CH_METALBa Le Me ScMOUNTAIN(F, A) FOREST(A) PLAINS(A) EVIL
ITEM_PANTS_GREAVES
 greaves
63 MAX1530Armor100--Ba Ha MeMOUNTAIN(F, A) FOREST(A) PLAINS(A) EVIL



Table of gloves: (count: 3)
 
Name
 ID
Mat. SizeArm. Lvl.UPSTEPSizePermitLayerCoverStr. El.MaterialsCivs
ITEM_GLOVES_GLOVES
 gloves
10--1010Under100THREADLe SoMOUNTAIN(F, A) FOREST(A) PLAINS(A) EVIL
ITEM_GLOVES_GAUNTLETS
 gauntlets
22 12015Armor100--Ba Ha Me ScMOUNTAIN(F, A) FOREST(A) PLAINS(A) EVIL
ITEM_GLOVES_MITTENS
 mittens
10--1520Cover150THREADLe SoMOUNTAIN(F, A) FOREST(A) PLAINS(A)



Table of shoes and boots: (count: 6)
 
Name
 ID
Mat. SizeArm. Lvl.UPSTEPSizePermitLayerCoverStr. El.MaterialsCivs
ITEM_SHOES_CHAUSSE
 chausses
30MAX1015Under100THREADLe SoFOREST(A) PLAINS(A)
ITEM_SHOES_SOCKS
 socks
10--1015Under100THREADSoMOUNTAIN(F, A) FOREST(A) PLAINS(A) EVIL
ITEM_SHOES_BOOTS
 high boots
21+12515Over100--Ha Le MeMOUNTAIN(F, A) FOREST(A) PLAINS(A) EVIL
ITEM_SHOES_BOOTS_LOW
 low boots
11+--2515Over100--Ha Le MeMOUNTAIN(F, A) FOREST(A) PLAINS(A) EVIL
ITEM_SHOES_SANDAL
 sandals
10--2515Over100THREADLe SoFOREST(A) PLAINS(A) EVIL
ITEM_SHOES_SHOES
 shoes
10--2015Over100THREADLe SoMOUNTAIN(F, A) FOREST(A) PLAINS(A) EVIL



Table of shields: (count: 2)
 
Name
 ID
Mat. SizeBlock ChanceArmor LevelUPSTEPCivs
buckler
 ITEM_SHIELD_BUCKLER
21011MOUNTAIN(F, A) FOREST(A) PLAINS(A) EVIL SUBTERRANEAN_ANIMAL_PEOPLES
shield
 ITEM_SHIELD_SHIELD
42022MOUNTAIN(F, A) FOREST(A) PLAINS(A) EVIL SUBTERRANEAN_ANIMAL_PEOPLES



NOTES:
Each table only displays the tokens valid for that type of equipment, so for example a shield doesn't have a Materials column. For more info see https://dwarffortresswiki.org/index.php/DF2012:Armor_token or https://dwarffortresswiki.org/index.php/DF2012:Armor

Gloves are made in pairs, with one left and one right. They often have different quality levels. Footwear also comes in pairs of varrying quality, but is interchangeable.

Please note that this info was taken from magmawiki and some of it may be wrong or change in post-2012 versions of Dwarf Fortress.

Column descriptions:
* Mat. Size MATERIAL_SIZE describes how many bars an item takes to make and how many it produces when melted. To make an item at a forge, it must be available to that civilisation, and needs max{1, floor(MATERIAL_SIZE/3)} bars of weapons-grade or armour-grade metal (Tokens: ITEMS_... in material RAWs). Therefore an item with MS of 1-5 needs 1 bar, 6-8 needs 2 and 9+ needs 3. Melting an item yields 0.3 * MATERIAL_SIZE bars, to the minimum of 0.1 for single bolts, goblets and other small items. This means that for MS of 5 or 4 more bars are produced from melting than were used to make the item. Of course a practical use of this bug requires access to magma and a highly efficient metal industry. Some items can only be made by custom reactions and aren't affected by MS. The number of adamantine wafers or stacks of cloth required to create armor is equal to the material size.
* Arm. Lvl. ARMORLEVEL is the garment's general purpose (0 - clothing, 1 - leather, 2 - chain 3 - plate). It defaults to 1 for shields and 0 for everything else. Class 0 items are claimed and used by civilians as ordinary clothing and are subject to wear. A + after tne number means METAL_ARMOR_LEVELS token was present, which bumps ARMORLEVEL by 1 when the item is made of metal, which prevents civilians from claiming it. Finally S in square braces means the item is shaped. Only one shaped item can be worn per body slot at any time.
* UPSTEP Length of gloves or footwear, counted in [LIMB] body parts towards the torso. A value of 1 lets gloves cover the lower arms, a value of 2 stretches a boot all the way over the upper leg and so on. Regardless of the value, none of these items can ever extend to cover the upper or lower body. Shields also have this token, but it only seems to affect weight.
* UBSTEP Length of the sleeves of upper body arour, counted in [LIMB] body parts towards the hands. A value of 0 only protects both halves of the torso, 1 extends over the upper arms and so on. Regardless of UBSTEP, body armor can never extend to cover the hands or head. Currently bugged, as high values of UBSTEP will result in the item protecting facial features, fingers, and toes, while leaving those parts that it can't protect exposed (but still counting them as steps).
* LBSTEP Length of the legs/hem of upper or lower body armour, counted in [LIMB] body parts towards the feet. A value of 0 only covers the lower body, 1 extends over the upper legs and so on. Regardless of the value, body armor or pants can never extend to cover the feet. All STEPs can be either a 0+ value or "MAX", which makes it cover as much as possible.
* Block Chance BLOCKCHANCE Affects the block chance of the shield. Defaults to 10.
* Size LAYER_SIZE: The item's bulkiness when worn. Aside from the layer limitations, it's a big contributor to the thickness and weight (and therefore price) of the garment. Defaults to 10.
* Permit LAYER_PERMIT: The maximum sum of garment sizes that can fit underneath this one. Defaults to 10. Quiver and Backpack, worn on upper body, may count towards layer permit size.
* Layer LAYER: Where the item goes in relation to other clothes. Each layer checks Sizes and Permit for the same and lower layers. UNDER < OVER < ARMOR < COVER.
* Cover COVERAGE: How often the garment gets in the way of a contaminant or an attack. Armor with a 5% coverage value, for example, will be near useless because 95% of attacks will bypass it completely. Temperature effects and armor thickness are also influenced. Defaults to 100. It is unknown if values above 100 provide better protection.
* Str. El. STRUCTURAL_ELASTICITY_...: These three optional and mutually exclusive tokens change the properties of material this item is made of:
+ CH_ALL Increases the *_STRAIN_AT_YIELD properties of the armor's material to 50000, if lower. This makes the garment flex and give way instead of shattering under force. Strong materials that resist cutting will blunt edged attacks into bone-crushing hits instead.
+ CH_METAL Increases the *_STRAIN_AT_YIELD properties of the armor's material to 50000, but only if the garment is made from metal.
+ THREAD Reduces the armor material's SHEAR_YIELD to 20000, SHEAR_FRACTURE to 30000 and increases the *_STRAIN_AT_YIELD properties to 50000, but only if the garment is made from cloth. This makes the item very weak against edged attacks, even if the thread material is normally very strong.
* Materials is the first two letters of what type of materials this item can be made from by hardcoded reactions. This can be misleading as many mods use "foreign" items with specific reactions to make them, which will ignore these materials. Items generated as artifacts will adhere to the material list.
+ Ba BARRED: Craftsmen can make this item from bones. Randomly generated outfits don't include bone armor.
+ Ha HARD: Default state in the absence of a [SOFT] token. Actual effects unknown.
+ Le LEATHER: Leatherworkers can make this item from leather. If paired with [SOFT], this item has an equal chance of being either in randomly generated outfits.
+ Me METAL: Item can be made from metal. Overrides [SOFT] and [LEATHER] in randomly generated outfits, if the ARMORLEVEL permits. Civilizations with [WOOD_ARMOR] will make this item out of wood instead.
+ Sc SCALED: Craftsmen can make this item from shells. Randomly generated outfits don't include shell armor.
+ So SOFT: Clothiers can make this item from all kinds of cloth. If paired with [LEATHER], the item has an equal chance of being either in randomly generated outfits.
* Civs Which civilisations get that item. This information is taken from entity and reaction data. The first row is for which entities have direct access to that item (so they will have it as non-foreign). (F) means access to it in Fort Mode, (A) is access in Adventure Mode. The Civilisations after "R:" (usually listedin the second row) have access to that item through custom reaction(s). Finally (+A+) means that this item has a reaction usable by any race in adventure mode.

Known bugs:
* Item craftability by civilisations does not take into account available materials or if the produced item gains quality.
* Syndromes from special materials are out of scope for this script.
* There is an unspoken assumption that entities, items and reactions are in separate files. If they aren't, some may be skipped by this script.
* You can give feedback or request features here: http://www.bay12forums.com/smf/index.php?topic=126953.0
« Last Edit: May 11, 2014, 02:16:03 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

Meph

  • Bay Watcher
    • View Profile
    • worldbicyclist

Impressive. :)

I only have access to a phone over the next month, but I will certainly make good use of your new script in June. I will write you again then. :)
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 :::

Maklak

  • Bay Watcher
    • View Profile

I haven't run into any major problems with armour script, so I uploaded it. https://dl.dropboxusercontent.com/u/71287918/Scripts/armour.pl Usage is pretty much the same as for the rest of my scripts.

Maybe I should add sorting by multiple columns and optional removal of unnecessary column "Materials".

This time I have 3 items to backport to other scripts, but that's for another day.
* Centering html tables that works.
* Civilisation scheme without green and bold.
* Set output function in init_args.

Now back to Meph's feedback. I didn't apply the changes at this time, I'm just answering.
> Yet again, the '$' is "an unsupported command", and '*' are not recognized, so I had to put all raws manually
> into a file called "creature_all.txt" and "weapons_all.txt", but thats not a big deal.
Sigh. Apparently '$' for console is not as widespread a convention as I have though. I think I added a mini-gude to console to one of the first posts here or was writing one anyway.
Wildcard *.txt should list all text files. Try it out with "$ dir" or "$ ls" or whatever you're using to list files. My scripts basically read a bunch of options and filenames from command line, so it SHOULD work. Obviously don't put any quotes around the *.

> The readout is fine, although I couldn't quite figure out how to extract the maximum info on creatures...
> for example the "misc" for no stun and no eat and so on is missing in my case.
For maximum info use --all It should have some sensible defaults.
Looking at the code, misc includes NOSTUN and NO_EAT.

> I packed all of them into some nice-ish html files and will include them a quick-guides in the next download.
Good. That's the point of my scripts. They do the tedious work, so people can just add some final touches to the tables and publish them. Feedback on what transformations you had to do would be appreciated, because maybe I can move more of that work into my scripts.

> Info on creatures: Has Poison/Venom, Is Megabeast (includes Semimegabeasts), Is Webber.
Has Poison/Venom: Already there and it even says so in online help. Option --syn
Is Megabeast: How do I check for that?
Webber: Ah, so just add [WEBBER] to the list of misc tokens, I guess. Then you can <Ctrl+F> for it. I had [WEBIMMUNE] though :)

In general the list of MISC tokens in creatures could use some work. I have a list of like 30, but am unsure which ones are important.
INTELLIGENT, CANOPENDOORS, NOT_BUTCHERABLE, NOT_LIVING, OPPOSED_TO_LIFE, CAN_LEARN, CAN_SPEAK, SLOW_LEARNER, TRAPAVOID, WEBIMMUNE, IMMOBILE, NO_DIZZINESS, NOBREATHE, NOSTUN, PARALYZEIMMUNE, NOFEAR, NOPAIN, NO_DRINK, NO_EAT, NO_SLEEP, FIREIMMUNE_SUPER, FIREIMMUNE, MAGMA_VISION, NO_PHYS_ATT_RUST

> Milk only yes/no. instead of a number.
Hm. That number means how long between milkings or something. Probably best to default to "Yes" / "--" and provide number as a --milknumber option.

> Size instead of 60000 should be 60kg, is easier to read for users.
Actually, that's volume, so 60l. Yeah, I should format this to be more human-readable and was just too lazy to do it.

> Speed: Normal, Fast, Slow. instead of numbers.
That's a no. I think the numbers are clearer here. I could colour them, though. What would be sensible thresholds? 700- for Fast and 1500+ for Slow?

> Biome: instead of SAVANNA_TROPICAL, FOREST_TROPICAL write: Savanna, Tropical Forest. Easier on the eyes.
I can lowercase everything except first letter with this one liner: s/(\w)(\w*)/$1\L$2/ I thought the tokens were useful verbatim, but modders will figure it out anyway.


> Inorganic Script for metals. Stones and so on are not so interesting, but people often ask about what metal
> they should use for what. That one would be a lot easier to write then weapons/armor,
> since the values are easy to interpret.
This is planned, but not as easy to write as you say. Sure, if I want to just print a table of INORGANIC that's rather easy, but it is tricky to do this right, because there are USE_MATERIAL_TEMPLATEs and I haven't quite figured out how leather and other organic materials work with items.

> Actually.. I just found this:  http://dwarffortresswiki.org/index.php/Masterwork:Armor
> Has been made today, and now the armor script is a lot less of a priority all of a sudden.
Yep, that's pretty useful. Doesn't look as good as my tables, but it's easy to use, sortable and custom-made for Masterwork.

> Impressive.
I have impressive plans for one modular scripts that reads it all, then prints sortable html tables with links to relevant places, to do things like walking reaction chains and interaction chains. But that's a lot of work. More Current (but subject to long periods of inactivity) plans include:
* Backporting some plumbing to my older scripts and doing some fixes for them. This includes re-working how I store entity data.
* Material script.
* Syndrome and interaction scripts. Some of those are inline, so I guess I'll have to make up IDs for them from context, constant and counter.
* Reaction script. Basically print tables of custom reactions for each workshop with reagents and products. The tricky part is that reagents and products definitions are pretty flexible.


BTW, Here is an armour table for an old version of Masterwork, printed as CSV and imported into Open Office. Obviously it needs work to make it readable, but if someone likes spreadsheets, my scripts can provide the data. https://dl.dropboxusercontent.com/u/71287918/Scripts/Mas_armour.ods
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

Meph

  • Bay Watcher
    • View Profile
    • worldbicyclist

Speednumbers: how many people know that 1500 is slower than 700? ;)

Poison/venom: maybe my fault, but i thought one was about any syndromes (like in interactions or poison or blood), while I did mean Specialattack:inject.. so only creatures that infect people with the syndrome through bite or sting. but not that important.

megabeast: simple, MEGABEAST and SEMIMEGABEAST are the tags.

Webber: This tag only means that you can find their webs in caverns or the surface. I meamt a web-attack, which is interaction based.

Somehow I thought that more modders would come by here. Are you sure that deon knows about this? He was away for a while and usually does good manuals as well. :)
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 :::

Maklak

  • Bay Watcher
    • View Profile

Gah, I was writing a message and my computer crashed :/ 

Anyway, I uploaded newer version of all 4 scripts. Creatures got a lot of fixes, the others just some things like "centering html tables that finally works".

> Yet again, the '$' is "an unsupported command"
Dollar is a command prompt under Linux, just as ">" is under Windows (but I already use that for quoting earlier posts). I put it there to make it clear on first sight which of those are commands.

> I couldnt quite figure out how to extract the maximum info on creatures.
Try "--all --html" The table has so many columns that you'll probably want to divide it.
Also check "--desc --nofreq --nofarm --compact" to see descriptions and check for spelling mistakes.

> Info on creatures: Has Poison/Venom
"SYN:adder bite (Inj. Sick)" in syndrome / interaction column, so already there, I guess. Just search for "Inj."

> Is Megabeast (includes Semimegabeasts)
Added to MISC tokens.

> Is Webber
"INT:Spray web (Emission, U:Attack, R:5, W:300)" in syndrome / interaction column.
Making syndromes and interactions terse and readable is not a simple problem.

> Milk only yes/no. instead of a number.
Done

> Size instead of 60000 should be 60kg, is easier to read for users.
Sort of fixed.

> Speed: Normal, Fast, Slow. instead of numbers.
The numbers are still there, but you get colours and a longer footnote.
> Speednumbers: how many people know that 1500 is slower than 700?
There, I fixed it: it says how speed works in the footnotes. (There, I fixed it is a joke on repairs that are ugly but work.)

> Biome: instead of SAVANNA_TROPICAL, FOREST_TROPICAL write: Savanna,
Did that with a regexp to a few columns. Easier to read now. Anything more refined would require a hash filled with this: http://dwarffortresswiki.org/index.php/DF2012:Biome_token

> I assume that people that read the manual cant read raws.
Fun fact: Some time ago, I'd write a what's new post for FoE mod every time it updated. I did it by reading RAWs and guesswork. These scripts are a way to do that faster, so they are a bit raw-y themselves (that was a pun).

Deon said he'd drop by. My explanation for why more peaople don't use my scripts is that they are:
* Focused at a very narrow audience - only modders and people who read RAWs may be interested.
* Cumbersome - you need perl and have to spend an hour or two reading manuals to get them to work at all. Then figure out which options to use to get the columns you want.

I wrote a few other scripts, including one that checks for some incompatibilities between RAWs and Stonesense, but the interest is very low.
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
Pages: 1 2 [3] 4