NearInfinityBrowser / NearInfinity

An Infinity Engine Browser and Editor

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Feature request idea - is it possible to auto-sort store inventory? (Primarily thinking for bags)

ahungry opened this issue · comments

In trying out NearInfinity, I notice that I can open a save game (decompress it), then open up the relevant .sto file that corresponds to a bag my party has. This seems to present a view of contents in the store, with different tab options (a GUI list view, a Raw view (bytes) and an edit view).

I'm old to BG, but new to the modding community, and can't find anything out there dealing with auto-sorting via scripts (infinity script files, or lua etc.), so I'm thinking doing it through NI may be easiest (if such a feature could be added/extended into what's there).

If I were to take a crack at this, anyone have any input/links to NI documentation for going about this?

I would probably just sort the contents by their keys like MISC01 etc., so at the least, for the most part, similar items would end up grouped (boots near boots, armor together and so on).

Edit: I see this list is already sorted in the display - just not the Raw (so, I guess the sorting is already happening, I'd just like to persist the changes into Raw after the sort is done).

The code for modifying structured game resources in NI is rather convoluted and slow. I think the potential number of use cases for such a feature is too small to be worth the effort.

I'd suggest to look into WeiDU scripting instead. It allows you to modify game resources much more easily.

If you'd like to try your hands on it, a good starting point would be the WeiDU documentation, IESDP for information about resource formats, and the G3 Forums for questions. Or inspect any mod sources to see how it's done in practice.

Edit: I see this list is already sorted in the display - just not the Raw (so, I guess the sorting is already happening, I'd just like to persist the changes into Raw after the sort is done).

The View tab presents data in a more human-readable way, which isn't necessarily synced with the data structure in the resource that can be inspected in the Edit tab.

Thanks @Argent77 ! I'll give that a look

I ended up cobbling together a nodejs program to do this, as I sort of ended up working backwards (started with reading the .sav file/decompressing, parsing the .sto (store) and sorting entries based on their easily readable resref - then decided to expand that to do the actual dialog.tlk lookups for the full names - after that, ended up grouping items in addition to alphabetizing).

If any future readers are interested, the code is here: https://github.com/ahungry/bgee-bag-sort/