Howto: Keeping track of socketed items

Sir Lister of Smeg

Diabloii.Net Member
Howto: Keeping track of socketed items

In windows, I used to check atma stashes during playing, but so far, since switching to linux I've not been able to do so (the game crashes). I can of course look at the dumps from atma, but since they're ordered in order of appearance (I think), not alphabetically, it's not very convenient when I want to check whether I should keep the socketed items I find. So I set about writing a script to do the following:
Sorting the filedump of my stash of grey socketed items, and stripping a lot of information that I did not consider essential. The following script works on a single filedump, but I'll explain how to expand it as well.
First of all, those using any form of unix, such as for example BSD (such as MacOsX) and linux, should be ready from the outset, those using windows will need a unix shell in order to be able to use the script. An option is for example Cygwin, but I'm quite sure other options exist as well.

Note that this only works on a stash/character containing only items that are at least socketed or ethereal, non-socketed, non-ethereal items will fubar everything due to the way the script is built. The technical explanation: the invocation of gawk in the script is such that two lines are combined unto one, however, an item that is non-ethereal and non-socketed will be represented by only one line instead of two in the output of the grep command beforehand. Note that rare items will only have their name mentioned, not their type, but I repeat, the script was intended for use on a stash containing only grey socketed items, a more elaborate version might follow but does require some hacking. (although using it on a stash containing only grey items, including non-socketed ethereal ones should not lead to troublems)

The script is a oneliner:

Code:
grep "^[[:digit:]][[:digit:]]*:\|Ethereal\|Socketed" | gawk '{str=$0;getline;print str, $0}' | sed s/[[:digit:][[:digit:]]*:// | sort | uniq -c
save it under any name, for example, sock.sh, in the Diablo II/Save directory.
Invoke it using "bash sock.sh < infile.txt > outfile.txt", while in that directory.

(those unfamiliar with unix systems, please see the note at the end)

Where infile.txt is the dump from atma, infile is the name of the character/stash, and outfile is of your choosing (and you can of course change the .txt to something else)

You'll end up with a file, outfile.txt, containing only the item type, whether it's ethereal or not, and how many sockets it has, in addition, the number in front is the number of items of that type, etherealness, and number of sockets you have in the stash.

{Note for those unfamiliar with changing directories in unix-sytems: to change the directory, you need to use slashes in unix, not backslashes as in windows. Also, spaces in the directorynames are represented by a backslash-space. So to go to the Diablo II directory, you need to use "cd Diablo\ II". Most of the time, you'll start in the home folder. Depending on the exact system you're using, you'll have to use then "cd /dev/hda5/Diablo\ II/Save" (hda is pata-harddisk one partition five) to get to the correct directory or instead sdf1 in the above (sata/scsi-harddisk 6, partition 1). Or alternatively, at least on my system, but afaik it's not standard, "media' instead of "dev" in the the above.}
 

purplelocust

Diabloii.Net Member
Nice idea! It's also worth mentioning that you can pipe the output through grep again, to check for particular items. That is, I would expect a typical use might be- I just found a 4 socket ethereal war spear, do I already have some? So you can take the output of your one liner and pipe it into something that greps for War Spear to see if you already have it.
 

Sir Lister of Smeg

Diabloii.Net Member
Nice idea! It's also worth mentioning that you can pipe the output through grep again, to check for particular items. That is, I would expect a typical use might be- I just found a 4 socket ethereal war spear, do I already have some? So you can take the output of your one liner and pipe it into something that greps for War Spear to see if you already have it.
Sure, I just wanted to print out a list of all my socketed items, for checking `live', your method is indeed the way to go, and I'll append the code for those not used to using grep.
Code:
grep "^[[:digit:]][[:digit:]]*:\|Ethereal\|Socketed" | gawk '{str=$0;getline;print str, $0}' | sed s/[[:digit:][[:digit:]]*:// | sort | uniq -c | grep "War Spear"
To check for another item, you will have to change the War Spear above to that item, and keep in mind that it's case sensitive.

When playing in a window, I have no problem checking on the computer, but when playing fullscreen (what I've been doing lately), I've noticed troublems switching to the desktop. I have a multimedia keyboard, and oddly enough, using the calculator key I can get to the desktop, but that remains then at 800x600. I know there exists a key combination to switch to the desktop from a fullscreen application, I believe it's alt-d or ctrl-alt-d (in gnome), but that does not work after changing the super-key so I can use alt to check for items and keep it pressed while picking them up in Diablo II. I need to check whether I still need to make that change when playing fullscreen though, I originally did that to play in windowed mode and it might not be needed now.



 
Top