Autoletter Branch

This branch is at https://github.com/bobbydurrett/NetHack/tree/autoletter

This sits on top of vanilla Nethack 3.6.6 and adds a feature that will automatically assign letters to Nethack objects based on options in your .nethackrc file. The parent branch includes all my previous branches including my building patch but Autoletter should work with standard 3.6.6 code.

The top level file notes.txt contains a long running commentary about my programming efforts. You might want to delete it. Also I have some debugging code in files.c and extern.h that you might not want so just look for things that start with write_debug and remove them.

Here are the options as I like them for a .nethackrc file. These just set certain tools to my preferred letter giving higher priority to better objects. I.e. prefer a magic lamp to an oil lamp for letter l. I am used to just doing command “a l” to light or unlight my lamp

OPTIONS=autoletter:b:blindfold
OPTIONS=autoletter:l:magic lamp:1
OPTIONS=autoletter:l:lamp:2
OPTIONS=autoletter:l:oil lamp:2
OPTIONS=autoletter:l:brass lantern:2
OPTIONS=autoletter:k:key
OPTIONS=autoletter:k:skeleton key
OPTIONS=autoletter:m:mirror
OPTIONS=autoletter:m:looking glass
OPTIONS=autoletter:w:magic whistle:1
OPTIONS=autoletter:w:whistle:2
OPTIONS=autoletter:p:pick-axe
OPTIONS=autoletter:u:unicorn horn
OPTIONS=autoletter:h:bag of holding:1
OPTIONS=autoletter:h:oilskin sack:2
OPTIONS=autoletter:h:sack:3
OPTIONS=autoletter:h:bag:4

The format is OPTIONS=autoletter:letter:object name or type:priority

Object type can be the unidentified type like “lamp” or the fully identified type like “magic lamp”. An object name is just a string you enter using #name or an artifact name like Stormbringer. Here are a couple of name options I might use if I wanted my primary weapon as “a” and my alternate as “A”:

OPTIONS=autoletter:a:Primary
OPTIONS=autoletter:A:Secondary

Priority defaults to 1 if you leave it off. 1 is the highest priority and priority has to be an integer >= 1 (1,2,3,4,…)

You can have at most 50 of these options with the current settings.

If you want to try this out yourself I don’t have a public server but you can download the Windows version here:

autoletterwindows.zip md5 hash 87b6bfc86388a7d68347b1b66ec7155e

Most of the code is at the end of options.c. Search for “autoletter” to find most of it.

The code revolves around two main data structures:

autoletter_array – an array of up to 50 options sorted by object name or type. Binary search used to lookup name or type.

autoletter_inventory – 52 element array that is an array version of the user’s main inventory. Each entry corresponds to a lower or upper case letter. The main routine converts the linked list main inventory into array form and then back. Was faster than what I tried first.

If anyone wants to discuss this or other Nethack issues please contact me with my nethack@bobbydurrettdba.com email alias or leave a comment on this page.

Bobby