Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  

Author Topic: Alphabetize Raw Entries  (Read 1817 times)

i2amroy

  • Bay Watcher
  • Cats, ruling the world one dwarf at a time
    • View Profile
Alphabetize Raw Entries
« on: October 16, 2010, 07:55:04 pm »

This is just a tiny thing, but would it be possible for the vanilla raws to get organized into alphabetical order. It would save a lot of time for a lot of modders if we didn't have to go searching through huge text documents for a specific creature. I know that you could use a search function, but if you were copying lots of things it gets tedious searching for things, especially those that show up in multiple creatures (i.e. cave swallow, cave swallow chicks, giant cave swallow, etc.).
« Last Edit: October 17, 2010, 05:47:12 am by i2amroy »
Logged
Quote from: PTTG
It would be brutally difficult and probably won't work. In other words, it's absolutely dwarven!
Cataclysm: Dark Days Ahead - A fun zombie survival rougelike that I'm dev-ing for.

Knigel

  • Bay Watcher
    • View Profile
Re: Alphabetical Order
« Reply #1 on: October 16, 2010, 08:01:46 pm »

Would this be as simple as it sounds? If it is, I would greatly support this. Trying to find one region on a list with about a dozen pages in no comprehensible order in Adventure Mode is kind of a pain.
Logged

i2amroy

  • Bay Watcher
  • Cats, ruling the world one dwarf at a time
    • View Profile
Re: Alphabetical Order Raws
« Reply #2 on: October 16, 2010, 08:09:19 pm »

No, I'm talking about the entries in text documents in the objects folder. The things that modders edit to adjust the world. And it is a simple thing of reorganizing, that would take hardly any time.
Logged
Quote from: PTTG
It would be brutally difficult and probably won't work. In other words, it's absolutely dwarven!
Cataclysm: Dark Days Ahead - A fun zombie survival rougelike that I'm dev-ing for.

rephikul

  • Bay Watcher
  • [CURIOUSBEAST_IDEA]
    • View Profile
Re: Alphabetical Order Raws
« Reply #3 on: October 16, 2010, 10:19:32 pm »

inorganic_metal.txt
Iron
Gold
Silver

Stockpile setting
Iron
Gold
Silver

Metalsmith workshop
Iron
Silver

z-stone menu
Iron
Gold
Silver

Yes, we definitely need to sort it :)
Logged
Intensifying Mod v0.23 for 0.31.25. Paper tigers are white.
Prepacked Dwarf Fortress with Intensifying mod v.0.23, Phoebus graphics set, DFhack, Dwarf Therapist, Runesmith and a specialized custom worldgen param.

Untelligent

  • Bay Watcher
  • I eat flesh!
    • View Profile
Re: Alphabetical Order Raws
« Reply #4 on: October 17, 2010, 12:07:52 am »

'course, you can always use ctrl-f in the raw files.
Logged
The World Without Knifebear — A much safer world indeed.
regardless, the slime shooter will be completed, come hell or high water, which are both entirely plausible setbacks at this point.

i2amroy

  • Bay Watcher
  • Cats, ruling the world one dwarf at a time
    • View Profile
Re: Alphabetical Order Raws
« Reply #5 on: October 17, 2010, 05:46:45 am »

So in the event of metals it's not as bad, but mind you that those are just three metals, there are still plenty of others that are all out of order. And sure, you could use ctrl-f in the raw files, but ctrl-f has limited usefulness in other cases. For example, lets say that I wanted to edit gypsum in inorganic_stone_material. The word 'gypsum' appears 15 times in the text file. Even if I add the ']' after it in the search box, I still get 6 results that I need to search through. Or lets say that I want to edit two of the gibbons in creature_large_tropical; the word 'gibbon' shows up with 52 results, many of which aren't even creatures, each of which I need to search through to find the ones that I want. And those aren't the only ones, there are tons of entries that return multiple results that you need to search through one at a time to find the right one. Plus this is easy to implement, when I last organized my raws in 40d it only took me like 45 min, and that was with a modded game with three to four times the number of entries as vanilla. Heck, I'd even do it for Toady if he asked me to, but me just reorganizing my own raws doesn't do anything when we're getting a new version to tinker with every third week.
Logged
Quote from: PTTG
It would be brutally difficult and probably won't work. In other words, it's absolutely dwarven!
Cataclysm: Dark Days Ahead - A fun zombie survival rougelike that I'm dev-ing for.

rephikul

  • Bay Watcher
  • [CURIOUSBEAST_IDEA]
    • View Profile
Re: Alphabetical Order Raws
« Reply #6 on: October 17, 2010, 08:42:26 am »

So in the event of metals it's not as bad, but mind you that those are just three metals, there are still plenty of others that are all out of order.
It's actually bad. Raw ordering is loaded and used for in game ordering which's also been under fire for a long time now. A simple reorganization that satisfy 2 crowds in one swift move is something I find very important.
Logged
Intensifying Mod v0.23 for 0.31.25. Paper tigers are white.
Prepacked Dwarf Fortress with Intensifying mod v.0.23, Phoebus graphics set, DFhack, Dwarf Therapist, Runesmith and a specialized custom worldgen param.

zwei

  • Bay Watcher
  • [ECHO][MENDING]
    • View Profile
    • Fate of Heroes
Re: Alphabetize Raw Entries
« Reply #7 on: October 18, 2010, 12:47:24 am »

Yeah, considering that fallout from this would be entries also ordered in game, i am all for it.

CaptApollo12

  • Bay Watcher
    • View Profile
Re: Alphabetize Raw Entries
« Reply #8 on: October 19, 2010, 10:34:43 pm »

... there is a really easy program to write.
it just has find the tags that would start the entry much like dwarf fortress does to get the tags in the first place and then find the next one to show that it is done.

Put the txt in question into an array
Its just any sort that you could do. http://en.wikipedia.org/wiki/Sorting_algorithm
 print it to the txt file when done
rince and repeat until all rar is sorted
Logged
"MONTARON!  You are so AGGRAVATING!   'Tis disturbing to my demeanor..."

thistleknot

  • Bay Watcher
  • Escaped Normalized Spreadsheet Berserker
    • View Profile
Re: Alphabetize Raw Entries
« Reply #9 on: August 20, 2014, 11:05:23 pm »

I'm bringing this thread back from the dead.

I know rawexplorer does it, but does anyone have any command line scripting-fu abilities that can help us use something like sed and regular expressions to alphabetize a set of raws based on their [object:id] [id:instance] instance's?

Update:
Well, RawExplorer author just got back to me and told me to be wary of object order dependencies.

So alphabetizing might be out of the question for some things...
« Last Edit: August 20, 2014, 11:11:42 pm by thistleknot »
Logged

Dirst

  • Bay Watcher
  • [EASILY_DISTRA
    • View Profile
Re: Alphabetize Raw Entries
« Reply #10 on: August 21, 2014, 09:18:17 am »

I'm bringing this thread back from the dead.

I know rawexplorer does it, but does anyone have any command line scripting-fu abilities that can help us use something like sed and regular expressions to alphabetize a set of raws based on their [object:id] [id:instance] instance's?

Update:
Well, RawExplorer author just got back to me and told me to be wary of object order dependencies.

So alphabetizing might be out of the question for some things...

Well, within an object the order can be vitally important (bodypart needs to be declared before it can be given an attack, etc.).  Across objects, I think the only serious dependencies are on creature variations like giant versions and animal men.  I could be wrong on that, but this solution would handle any known dependencies:

The game loads the raws in alphabetical order using the internal name on the first line.  A convention of putting variations in a later file than base creatures would automagically guarantee that dependencies are fulfilled.  For example:

creature_subterranean
creature_subterranean_variations

creature_myawesomemod
creature_myawesomemod_variations
Logged
Just got back, updating:
(0.42 & 0.43) The Earth Strikes Back! v2.15 - Pay attention...  It's a mine!  It's-a not yours!
(0.42 & 0.43) Appearance Tweaks v1.03 - Tease those hippies about their pointy ears.
(0.42 & 0.43) Accessibility Utility v1.04 - Console tools to navigate the map

thistleknot

  • Bay Watcher
  • Escaped Normalized Spreadsheet Berserker
    • View Profile
Re: Alphabetize Raw Entries
« Reply #11 on: August 21, 2014, 11:52:42 am »

that's good to hear.  Currently that's been my line of thinking as well, within the object token placement mattered. 

I recall my past conversations with RawExplorer author were trying to see if there was a way to alphabetize tokens within each [object:id] [id:*] (for a similar diff comparison problem); however, I/he soon realized that they had some sort of dependency chain.  I was also miffed that sorting destroyed header comments :(

I imagine the tokens are like variables fed into functions and or object constructors when the creation of the object is made.  Moving tokens out of place could have bad consequences (at least for some things).  If somehow a caste specifying token got deleted, there'd be a ton of duplicates...

For some reason, I think the token parser that Toady uses is smart enough to skip invalid tokens and/or almost accept them in universal manner; except... when a caste token is deleted.  Then I guess those duplicates are dumped?

Once the objects read in C++ runtime.  The variables are fed in from these raw files.  So alphabetizing them internally is out of the question.  However, I think a next logical step would be to sort them by caste within each [id:*]
« Last Edit: August 21, 2014, 12:00:37 pm by thistleknot »
Logged

Uristsonsonson

  • Bay Watcher
    • View Profile
Re: Alphabetize Raw Entries
« Reply #12 on: August 22, 2014, 09:06:50 am »

I spent all of an afternoon doing the objects file by hand. I replaced it on DFFD with a file Reelya made with some kind of sorter, but it never worked for me for some reason. I could try to find a spare copy somewhere.
Logged