Jukka's Nethack modifications and utilities

reclist

3.4.3 patches:  combined, makedefs, dump, logmoves, extinct/showborn, sortloot, paranoid, hpmon, hide features, forgetquit, germankb, deathexplore, menucolor, window_edge, itemcategories, adjust_split, helpless, quiver fired, credit, aoy_container, owned artifacts
directories, altkey, config

Some patches for old versions

Notice: Nethack 3.4.3 is available at http://www.nethack.org.

If you link this page as "http://www.iki.fi/jslahti/nethack.html" , you will not need to update the link if I happen to move it to another ISP again.

Latest addition: Paranoid patch now shows the item to be #dipped when you use the #dip command.

Reclist

Reclist 3.4.0 works with Nethack 3.4.3. I haven't yet checked the other utilities in the .zip packet.

Reclist is a utility that can be used to view the Nethack RECORD file formatted, much the same way as you see it when the game ends or when you use 'nethack -s'.
Like with 'nethack -s', you can choose to view the entire record file or just one username or one character role. But there are some more switches to view a certain character race, role or alignment, or just games that ended before a certain date or after a certain date.
You can also see the dates when the games ended and you can view other files with the same format, for example the logfile. You can even pipe the output of some other utility to be viewed with reclist, and pipe the reclist output to some pager. And reclist calculates the average score of the viewed entries.
It understands the file formats of Nethack versions at least from 3.1.0 to 3.4.3.

Mergrec is another little utility that can be used to merge two nethack 3.3 record files together.

Logsrt reads the logfile, sorts it in descending order by the scores, and prints it out that way.

Author: Jukka Lahtinen
Downloads: recls340.zip (170 KB) A packet containing the C source and MS-DOS and OS/2 exe files for reclist, mergrec and logsrt and some reclist documentation.
  reclist.c (28.5 KB) The C source

Some patches for the game (Nethack 3.4.3):

Principle: I don't use any patches that add new monsters or items (or delete official ones) or otherwise change the plot. I don't want to change game balance, at least not very much. So the patches described here are mainly to make the interface more comfortable or to give more information when the game ends.

Exception: the aoy_container, credit and owned artifacts patches DO change things a bit more. I don't use them myself, I just put them on this page because Topi asked me to. However, I'm not going to include them in my combined diff.

At the moment none of these patches change anything that is checked for the validity of bones and save files, so if you already use self-compiled binaries, you should be able to just throw the patches in and continue your saved game if you don't change anything else. But you should be aware that if you have saved games from any binaries you didn't compile yourself, it is very much possible that some important compile options are different and the old bones and save files don't work.

The platform-independent non-bugfix patches were made / updated roughly in the same order as they are listed here. (I try to keep possible bugfixes close to the start of the page whenever there is any, and platform-dependent patches after the general ones..) Some patches affect some of the same files, and if you don't apply all of them, the patch utility might not be able to process everything. But it should't be hard to see what you need to do manually in that case.

Most of the patches here (and some others that I haven't cared to include) are included in PatchHack, and a binary packet from windows can be downloaded from http://www.online-club.de/~phlucas/nh.html#PatchHack .

You can find Slash'em ports of many (if not all, I haven't checked thoroughly and the situation may change) of these patches and many others at http://bamgames.free.fr/Slashem/ .

Other Nethack patches can be found at http://bilious.homelinux.org/ .

You can find some information about compiling the game at the Nethack wiki http://nethack.wikia.com/wiki/Compiling and about applying the patches at section 4.11 of the Nethack FAQ, and also at the wiki http://nethack.wikia.com/wiki/Patching

3.4.3 Patches

Patches for all platforms

A combination of my 3.4.3 patches (updated 6.8.2007)

This is a monolithic diff that includes the patches I use with 3.4.3. Most of them are described below on this page. I always make this diff from the actual source directory that I used to build the binaries I run myself, diffed against the official source tree. I just try to remember to delete from the diff anything implementation-dependent that is not related to any of the actual patches (like the platform-related settings in include/config.h) and stuff that may cause problems on some other platform. So, if you have an otherwise unpatched Nethack 3.4.3 source and you got it compiled as it is, this is the most convenient way to add all the patches I use. If you have applied other patches not mentioned here, you'll probably need to edit some files manually anyway.

Authors: several.. patches collected together by Jukka Lahtinen
Download: nh343jl.diff
Changes:
6.8.2007:  - Paranoid patch now shows the item to be #dipped when you use the #dip command.
25.4.2007:  - added the quiver fired patch
30.1.2007:  - updated the dump patch
- included Pasi Kallinen's extra status attributes patch

Makedefs (updated 25.5.2007)

This will let you see most of these patches listed with the #version (or alt-v or meta-v on some platforms) command, when they are compiled in.

I also added some more options to IGNORED_FEATURES, the list of compilation options to be ignored when compatibility of bones and save files are checked. The options TEXTCOLOR, EXP_ON_BOTL and SCORE_ON_BOTL can safely be ignored there, as far as I know.

Author: Jukka Lahtinen
Download: makedefs-343.diff
Affected file: util/makedefs.c
Bones / save files: NOT affected.
Changes:
25.4.2007 - added awareness of the quiverfired patch.

Dump character (updated 30.1.2007, Slash'em version added 11.4.2005, NOT the same version as the latest one for standard Nethack)

The "dump character" patch will make the game write your character's inventory, kill list, conduct information and intrinsics (everything it lists on the screen and some more) to a file when the game ends. Please read the README file dump-343.README for more information.
You should add in your include/config.h
#define DUMP_LOG
#define DUMPMSGS 20
to activate all the features of the dump patch and to define the number of latest messages to print in the dump file. (They are included in this diff, but you may have other changes in the file that prevent the patch utility from automatically adding them.)

TODO: The latest messages would be more logically placed in the beginning of the dump file, before the map. After all, they, or at least some of them, may have been shown to the player before the map was in its final state. I'm probably going to change the order when I update the patch for the next version of the game.

Authors: Tom Friedetzky, Jukka Lahtinen, Darshan Shaligram, Clive Crous (Slash'em version)
Download: dump-343.diff    (for standard Nethack 3.4.3)
  dump-S007E6F1.diff    (for Slash'Em 0.0.7E6F1) This is older than the version for vanilla Nethack and doesn't include the latest messages in the dump file.
Affected files: include/decl.h, include/extern.h, src/botl.c, src/cmd.c, src/decl.c, src/display.c, src/end.c, src/invent.c src/options.c, src/pline.c, src/spell.c, src/topten.c, src/weapon.c, win/tty/wintty.c, dat/opthelp, doc/Guidebook.*
Bones / save files: NOT affected.
Changes:
30.1.2007: - Don't dump the disclose prompts for inventory, attributes etc.
28.6.2006:  - Version 1.4.0: added dumping the lagest messages.
dumpmsg.diff is an incremental patch to add this feature if you already use the previous dump patch version.
16.7.2004: - minor non-functional changes to get rid of some compiler warnings
20.6.2004: - the numeric alignment is now always printed to the dump file. Previously it was only printed in wizard mode.
2.5.2004: - now the inventory listing and vanquished monsters should always be dumped regardless of whether or not you view them on the display

Record the number of moves (3.4.3-checked 11.12.2003)

The "logmoves" patch will make the game append the number of moves in curly braces at the end of the record and logfile entries, so you can see how many moves the game took. It also appends a "{wiz}" or "{exp}" tag if the game was played in wizard or explore mode. The game will treat it as addition to the text string telling what killed you (or why the game otherwise ended), so the patch will NOT invalidate your existing record and logfile, not even existing bones and save files! (Keeping the existing files was the reason why I put the additional information where it is.)
Apply the patch and add
#define LOG_MOVES
somewhere in include/config.h

Author: Jukka Lahtinen
Download: logmoves-343.diff
Affected file: src/topten.c
Bones / save files: NOT affected.

Extinct & showborn (updated 14.12.2003)

This is a combination of "extinct" and "showborn" patches which were separate for earlier versions.

The extinct patch makes extincted species listed among the genocide list (marked with the "(extinct)" tag) when the game ends.

Notice that the counters used to check extinction keep track of the number of each monster CREATED, not ones killed. So, if a monster is marked extinct, it just means that none of them would have been created any more in the game, not necessarily that you killed them all. Some may still be alive somewhere in the dungeons.

The "showborn" patch will optionally add the number of each monster species created after the number of them killed, if the number is different. No born counter is shown for species with no killed individuals, or for those species with all born individuals killed.
It also adds the wizard mode extended command #showkills that lets you see the kill counters of each monster race as you see them when the game ends.

Download and apply the patch and add the definition
#define SHOW_EXTINCT
#define SHOW_BORN
somewhere in your include/config.h to compile the features in.
You also need to turn the "showborn" option on to actually show the born counters. Use the 'O' option in the game or edit your configuration file.

Authors:  Wingnut, Jukka Lahtinen
Download: extborn-343.diff  if you don't have and don't want to install the dump patch. Notice that the dump patch can't be installed automatically with the patch utility after this.
  extborn-343d.diff  if you have the dump patch installed before this. With this version the extinctions and born counters will be written in the dump file, too.
Affected files: include/flag.h, src/cmd.c, src/end.c, src/options.c, dat/opthelp, dat/wizhelp, doc/Guidebook.*
Bones / save files: NOT affected.
Changes:
28.6.2006: - made a new extborn-343d.diff to match the dump diff change. No functional changes and no effect on extborn-343.diff

Sortloot (updated 19.5.2005)

This patch optionally causes item lists be sorted alphabetically by description when you loot or apply containers or pick up something, and with the "full" setting also in inventory and drop listings. The items are still grouped in classes if the sortpack option is on, but the order of items of the same class is different.
Apply the patch and #define SORTLOOT in config.h to compile it in.
Use the additional sortloot option to control the behavior (values full, loot and none).

Authors: Jeroen Demeyer, Jukka Lahtinen
Download: sortloot-343.diff for unpatched 3.4.3 source. If you want to install the dump or extborn patch after this, you'll need to do some of it manually.
  sortloot-343d.diff if you have the extborn and dump patches installed.
Affected files: dat/opthelp, doc/Guidebook.*, include/extern.h, include/flag.h, src/end.c, src/invent.c, src/objnam.c, src/options.c, src/pickup.c
Bones / save files: NOT affected.
Changes:
28.6.2006: - made a new sortloot-343d.diff to match the dump diff change. No functional changes and no effect on sortloot-343.diff
19.5.2005: - honor the user's menu_headings setting
2.5.2004: - made a new sortloot-343d.diff to match the dump diff change. No effect on sortloot-343.diff
14.1.2004:  - added a return keyword that was missing from the previous version
9.1.2004:  - now the sorting ignores the singular/plural difference in stackable items (for example "a cursed scroll of identify" and "3 blessed scrolls of identify" are listed next to each other)
- escaped the # character in Guidebook.tex

Paranoid (updated 6.8.2007)

This patch makes the commands #q (quit) and X (change to explore mode) (if the option paranoid_quit is on), and the prompts for hitting peaceful monsters (if options confirm and paranoid_hit are on) and leaving wizard mode bones (regardless of runtime options), expect a typed "yes" instead of just 'y'. Every other response will be treated as "no".
Now it also forces the menu to be shown with the 'T' and 'R' commands even when there is only one item to be taken off or removed, if the additional paranoid_remove option is set.

Apply the patch and add
#define PARANOID
in your include/config.h and OPTIONS=paranoid_hit,paranoid_quit,paranoid_remove in your configuration file.

Authors: David Damerell, Jonathan Nieder, Jukka Lahtinen, Stanislav Traykov, Kristian Glass
Download: paranoid-343.diff if you don't have other patches installed. Installing the dump and extborn patches after that will need some manual work.
  paranoid-343d.diff if you have the extborn and dump patches installed
Affected files: include/flag.h, src/cmd.c, src/do_wear.c, src/end.c, src/options.c, src/potion.c, src/uhitm.c, dat/opthelp, doc/Guidebook.*
Bones / save files: NOT affected.
Changes:
6.8.2007:  - show the item to be #dipped when you use the #dip command.
28.6.2006: - made a new paranoid-343d.diff to match the dump diff change. No functional changes and no effect on paranoid-343.diff
13.3.2004:  - added the paranoid_remove option and functionality

Color Hp monitor (updated 16.7.2003)

This patch colors the Hp monitor at the status line with the tty interface. If your Hp is lower than maxhp but more than 2/3 of max, it is shown green. If it is less than that, but more than 1/3 of max, it is yellow. If it's less than 1/3 of max, the color is red. And with values less than 1/10 of max, it is highlighted, blinking or whatever your screen shows with the ATR_BLINK attribute.

#define HPMON in include/config.h to activate the patch.

Author: Ralph Churchill
Download: hpmon.diff
Slash'em version: slashem-0-0.7E5-hpmon.diff
Affected file: src/botl.c
Bones / save files: NOT affected.
Changes:
16.7.2004:  - #include wintty.h in botl.c to get rid of some compiler warnings

Hide features from bones (3.4.3-updated 13.12.2003)

The official Nethack binaries have the compile time option SCORE_ON_BOTL disabled, and enabling it breaks bones and save compatibility. Bones and save files can be imported from official binaries by turning the corresponding bit on in the IGNORED_FEATURES macro (see makedefs), but to export files the other way (for example if you want to use Hearse) you need to have the flag disabled from the files. That's what this patch does.
If you want to compile this functionality off, you just need to comment out the #define HIDDEN_FEATURES in src/version.c.

Author: Jukka Lahtinen
Download: showscore_hide.diff
Affected files: src/version.c
Bones / save files: The SCORE_ON_BOTL feature flag will not be set in the files. Patched game will ignore the flag in any file it loads, so compatibility of bones files will actually increase.
However, if you change the value of SCORE_ON_BOTL and recompile, it will change the flags structure and depending on other flags and settings, it may cause the flags struct size to change (depending on whether the number of booleans there crossed some byte boundary) and thus still invalidate the old files.
Even if the struct size doesn't change and the old saves load, the value of some the boolean flags probably change when you load the saved game, so always remember to check the settings after loading games saved before the change. But those settings are not saved in bones files, so you don't need to worry about bones: if they load, they are fully compatible.

No quitters in record file! (3.4.3-checked 13.12.2003)

With this patch you can prevent quit games from getting in to your record file. However, they will be logged to the logfile. You may also choose not to have wizard and explore mode games logged in the logfile.

#define FORGET_QUITTER in include/config.h or to keep quitters out of the record file and
#define PROMPT_LOGEXP to be prompted about logging wizard and explore mode games.

Author: Jukka Lahtinen
Download: forgetquit.diff
Affected file: src/end.c, src/topten.c
Bones / save files: NOT affected.

German keyboard (3.4.3-checked 13.12.2003)

German keyboards have the 'y' key where most keyboards have 'z' and vice versa. This little patch swaps the movement and zap/spellcast commands for those keys, so that people playing with a German keyboard layout can have the Nortwest movement key between 't' and 'u' like the rest of us.

Apply the patch, add "#define GERMANKB" in your include/config.h and recompile.

Author: Jukka Lahtinen
Download: germankb.diff
Affected files: dat/help, dat/hh, doc/Guidebook.*, src/cmd.c, src/decl.c
Bones / save files: NOT affected.

Better patch for qwertz keyboards (added 17.12.2003, located elsewhere)

This is an alternative for my own germankb patch, adding a runtime option to switch between the normal command key set and the swapped y/z commands. It's better especially for servers where the game may be played remotely with different keyboard layouts. Remove the germankb patch before installing this one.

#define QWERTZ in config.h to enable this patch in compilation and turn the additional qwertz_layout option on to activate it.
Author: Stanislav Traykov
Download: http://home.in.tum.de/~traykovs/nethack/qwertz-343.diff
Affected files: dat/help, dat/hh, dat/opthelp, doc/Guidebook.*, include/decl.h, include/flag.h, src/cmd.c, src/decl.c, src/options.c
Bones / save files: NOT affected.

Explore mode at death (3.4.3-updated 13.12.2003)

Do you often wish that when your character dies, you would have an option to continue the game in explore mode to peek what MIGHT have happened?
This patch will prompt you for going to explore mode, if you die and no bones file is created. If you answer yes, it will first update the logfile, and possibly the record file (after all, it's been a fair game until that point), and after that it switches the game to explore mode.
Since I feel that continuing when a bones file was generated would not be a good idea (many people would consider it cheating, because you may get information of that level and monsters that were there, that you didn't know when you died), I decided that it will not be allowed.
Calculating your score before switching to explore mode requires, in some situations, some actions that are not COMPLETELY undone in the diff, like paying your debt to shopkeepers, so the switch might not always happen exactly the same way it does when you use the X command before getting the final blow. But I did it as close as I could.

NOTICE: If you have installed the version 1.0 of the dump patch, you should edit src/end.c slightly before installing this patch: Go to the done(how) function, find the label "die:" and move the line "program_state.something_worth_saving = 0;" and the comment above it to above the #ifdef DUMP_LOG block that grabs the screen dump. (Or back out the dump patch and reinstall the current version, if you prefer doing that.) I changed that to the version 1.1 of the dump patch, but the first version was downloadable for a while, so it is possible that you may have installed it.

Apply the patch, add
#define DEATH_EXPLORE
in include/config.h and compile. Then, add
OPTIONS=death_explore
in your configuration file, and upon death you are prompted for going on in explore mode.

Author: Jukka Lahtinen
Download: dthexp-343.diff if you don't have other patches and don't intend to install the dump and paranoid patches. Notice that installing those patches after that will take some manual work.
  dthexp-343d.diff if you have the dump and paranoid patches installed
Affected files: include/flag.h, src/cmd.c, src/end.c, src/options.c, dat/opthelp, doc/Guidebook.*
Bones / save files: NOT affected.

Menucolors (located elsewhere)

The menucolor patch lets you define different colors for the menus in tty mode, for example show cursed items in red and blessed items in green.

Author: Pasi Kallinen
Download: http://bilious.homelinux.org/~paxed/nethack/nh343-menucolor.diff
Affected files: dat/opthelp, include/color.h, include/extern.h, include/flag.h, src/decl.c, src/files.c, src/options.c, src/save.c, win/tty/wintty.c
Bones / save files: NOT affected.

Window edge (located elsewhere)

This patch adds a new configuration option 'win_edge' that allows you to define whether the menu and text-windows in TTY mode are left or right aligned.

Author: Pasi Kallinen
Download: http://bilious.homelinux.org/~paxed/nethack/nh343-winedge.diff
Affected files: include/flag.h, src/options.c, win/tty/wintty.c
Bones / save files: NOT affected.

Item categories (located elsewhere)

This patch adds item categories I (unidentified), r (known to be rustprone) and P (just picked up) to menus so you can quickly drop them.

You need to #define ITEMCAT (for categories I and r) and ITEMCAT_JP (for category P) to compile the patch in and turn on the added option like_swimming for category r to be shown.

Author: Stanislav Traykov
Download: http://nh.gmuf.com/#itemcat
Affected files: dat/opthelp, doc/Guidebook.*, include/extern.h, include/flag.h, include/hack.h, include/objclass.h, include/obj.h, src/do.c, src/invent.c, src/options.c, src/pickup.c,
Bones / save files: NOT affected.

Splittable #adjust (changed 5.2.2004)

This patch lets you use count with the #adjust command, splitting a stack of items to two inventory letters. To merge mergeable items from two inventory slots to one, #adjust one of the slots to the other one.

#define ADJSPLIT in include/config.h before compilation to activate the patch.
Author: Sam Dennis, conditionalized by Jukka Lahtinen
Download: adjsplit.diff
Affected file: src/invent.c
Bones / save files: NOT affected.
Changes:
5.2.2004:  - fix for a bug that sometimes caused items disappearing if you pressed ESC instead of specifying a new inventory letter for the item(s) to be changed.

Helplessness reasons (added 29.3.2004, located elsewhere)

Normally when you die and are in the middle of a multiturn [in]action, you get "while helpless" appended to the death reason. This patch adds different reasons depending on why you're helpless, for example "while disrobing" or "while sleeping off a magical draught".

Author: Pasi Kallinen
Download: http://bilious.homelinux.org/~paxed/nethack/nh343-helpless.diff
Affected files: include/decl.h, include/extern.h, src/allmain.c, src/apply.c, src/artifact.c, src/ball.c, src/decl.c, src/detect.c, src/dig.c, src/dothrow.c, src/do_wear.c, src/eat.c, src/end.c, src/engrave.c, src/explode.c, src/hack.c, src/mcastu.c, src/mhitu.c, src/mthrowu.c, src/muse.c, src/pickup.c, src/polyself.c, src/potion.c, src/pray.c, src/priest.c, src/save.c, src/sounds.c, src/spell.c, src/steal.c, src/teleport.c, src/timeout.c, src/trap.c, src/uhitm.c, src/vault.c, src/zap.c
Bones / save files: NOT affected.

Quiver with the f command (added 25.4.2007)

Normally, when you use the f (fire) command and you have no ammunition quivered, the game just says you have no ammunition quivered and then just prompts you what to throw and leaves you with nothing quivered.
With this patch, in the same situation, the game will first prompt you what you want to quiver (like the Q command) and then fire whatever you chose to quiver.

Install the patch, #define QUIVER_FIRED in your config.h, compile and turn on the additional quiver_fired option to use the feature.

NOTE: It is recommended that you use suppress_alert:3.3.0 (or higher) with the quiver_fired option. Otherwise you will always get a note about the #quit command before the quivering prompt.

Author: Jukka Lahtinen
Download: quivfir-343.diff
Affected files: dat/opthelp, doc/Guidebook.mn, doc/Guidebook.tex, doc/Guidebook.txt, include.flag.h, src/dothrow.c, src/options.c
Bones / save files: NOT affected.

Credit cloning (3.4.3-updated 19.7.2004)

(NOT included in nh343jl.diff)

This patch will prevent credit cloning.

Gold on shop floors are free and one does not get credit by dropping gold in a shop. Credit is bought from a shopkeeper by (p)aying when you don't owe anything. If you already have credit in a shop and try to pay when you don't owe anything you are asked if you want your credit money back. If you don't want then you are asked if you want to buy more credit.

Author: Topi Linkala (nes@iki.fi)
Download: shop_credit.diff
Affected files: include/config.h, include/extern.h, src/dokick.c, src/pickup.c, src/shk.c
Bones / save files: NOT affected.

Aoy_container (3.4.3-updated 19.7.2004)

(NOT included in nh343jl.diff)

This patch allows the insertion of Amulet of Yendor, Candelabrum of Invocation, Bell of Opening and Book of Dead into a container. It also prevents naming these items.

Naming of Amulet of Yendor or unknown fake is a major insult against your original god and minor insult if your god is not the original one. Naming of known fake Amulets are permitted.

If you carry a container containg one of those items or your Quest Artifact everything should work as if they were in your inventory, except you wont get the benefits from your Quest Artifact.

When a monster has in its inventory a container containing one of those five items and has nothing better to do, then it will take the most valued item out of that container and if that container contains no other valued items drop it.

Pet won't pick up a container that contains the Amulet of Yendor.

Author: Topi Linkala (nes@iki.fi)
Download: aoycont.diff (the patch itself)
aoycont.txt (technical information)
Affected files: include/dungeon.h, include/extern.h, include/hack.h, src/apply.c, src/bones.c, src/dig.c, src/do.c, src/do_name.c, src/dogmove.c, src/dokick.c, src/dothrow.c, src/end.c, src/fountain.c, src/invent.c, src/lock.c, src/makemon.c, src/mklev.c, src/mkobj.c, src/monmove.c, src/mthrowu.c, src/objnam.c, src/pickup.c, src/potion.c, src/pray.c, src/rumors.c, src/shk.c, src/sp_lev.c, src/spell.c, src/steal.c, src/timeout.c, src/trap.c, src/uhitm.c, src/wizard.c, src/write.c, src/zap.c
Bones / save files: Bones not affected. Save files from an unpatched game work with the patch, but games saved with a patched version will cause confusion if loaded to an unpatched game if the Amulet or some of the invocation items is in a container. So take them out before saving if you plan to continue without this patch.

Owned artifacts (added 20.7.2004)

(Not included in nh343jl.diff)

This patch enables owned artifacts. If you wish for an artifact there is a chance that the owner of that artifact arrives with the artifact and starts to fight with you. Have fun.

Author: Topi Linkala (nes@iki.fi)
Download: ownedarti.diff
Affected files: include/config.h, src/mplayer.c, src/objnam.c
Bones / save files: NOT affected.

Platform-dependent patches

Bones directory

Unmodified Nethack 3.4.3 supports a separate bones directory on some platforms, but not on some others. The necessary changes to add the support depends on which platform you use.

Single-user systems and others with a common config file (3.4.3-checked 13.12.2003)

The official NT binary version shows a list of variable playground locations with the O command, with directories defined in the config file. But the OS/2 and msdos versions compiled from the official sources without changes do NOT show them or use the directory settings from the config file. So I just examined how files.c determines whether the locations list is shown or not, and what are the relevant differencies between include/os2conf.h and include/ntconf.h.

I didn't extract a diff for this, instead I just explain what to edit to do this:
Depending on your platform, add these lines to os2conf.h, pcconf.h or whatever is the right *conf.h in the include directory:

#define NOCWD_ASSUMPTIONS
#define PC_LOCKING
#define HLOCK "NHPERM"
On OS/2, maybe also on some other non-microsoft version, you'll probably also have to edit sys/share/pcunix.c. Change the lines 11 and 15 from
#if defined(WIN32) || defined(MSDOS)
to
#if defined(WIN32) || defined(MSDOS) || defined(PC_LOCKING)
I have successfully used this in OS/2 with Nethack from 3.3.1 to 3.4.3 and Philipp Lucas tested it with at least 3.3.1 in msdos, and I suppose it also works for most others like that.
Affected files: include/*conf.h, sys/share/pcunix.c
Bones / save files: NOT affected. But remember to move the bones files when necessary.
Unix-like systems (3.4.3-checked 19.12.2003)

The Unix version has directory names hardcoded for security reasons and to prevent cheating by users without root privileges, and they can't be changed by the config file settings. This patch will make bones to be read and written in a "bones" subdirectory under the directory where you have the level lock files and the save subdirectory. (Either the playground directory or some other directory that you have defined as VARDIR.)
After applying the patch, make sure there is a subdirectory "bones" in the same directory as the "save" directory, and with the same user, group and permissions. The diff changes sys/unix/Makefile.top to do this with the install target, but I know that many people will not copy their makefiles from sys/unix again (after configuring it to their needs once), and many people don't make the install target again..
Author: Jukka Lahtinen
Download: bonesdir.diff
Affected files: src/files.c, sys/unix/Makefile.top
Bones / save files: NOT affected. But remember to make sure the bones directory exists with the right permissions and move the bones there.

Linux-specific stuff

The alt key with Linux (3.4.3-checked 18.12.2003)

To get the alt key working on Linux console the same way as it does in the msdos, os2 and win32s versions, you don't need to even recompile the game, just edit your /usr/games/nethack (it's a shell script that starts the actual game).
Note: this works for the text consoles, but don't expect it to do anything useful in xterm or other X11 command windows. The conditionals for the TERM environment are meant to check that you are really on a console, not in an xterm or some other X window.

Near the end you will find a line
		exec $HACK "$@" $MAXNROFPLAYERS
Add these setmetamode commands around it and remove the exec keyword:
#		Alt-key as 'meta'
		if [ "$TERM" == "linux" ]
		    then setmetamode meta > /dev/null
		fi
		$HACK "$@" $MAXNROFPLAYERS
#		Change alt key back
		if [ "$TERM" == "linux" ]
		    then setmetamode esc > /dev/null
		fi

Before editing the actual file, you may like to try these commands from the command line before and after playing, without the /dev/null redirction, to make sure they work on your system. I have successfully used it with Redhat Linux versions from 4.1 to 9.0 and Fedora 1-6, kernels up to 2.6.19, but I can't guarantee it to work for everybody.
The script comes from sys/unix/nethack.sh in the source tree, so if you compiled your game yourself, you'll probably want to make the same change there to avoid the need to do it again after the next compilation(s).

Author: Jukka Lahtinen
Affected file: sys/unix/nethack.sh (/usr/games/nethack)
Bones / save files: NOT affected.

Separate configurations for console and X11 (edited 19.12.2003)

Do you want to play the game both on console and X11? And use the windowtype:x11 when you play on X11, and possibly other different settings, but don't like always editing your .nethackrc in between?
This is another little thing that you can do without recompiling the game, just editing the /usr/games/nethack script, like the alt key fix. Load the script (/usr/games/nethack) in your favorite text editor, and add these lines somewhere to be executed before the actual game starts:
if [ -n "$DISPLAY"  -a  -f $HOME/.nethackrc.x11 ] ; then
     NETHACKOPTIONS=$HOME/.nethackrc.x11
fi
And copy your .nethackrc as .nethackrc.x11 (in your home directory). Then, whenever you start the script from xterm, it will use .nethackrc.x11 as the configuration file if it exists, otherwise it will use .nethackrc as before. If you use an icon in X11 to start the game, you will probably need to check the "Run in terminal" box in the launcher properties. If you compile the game again, the script is overwritten, so you'll probably want to add the same lines to sys/unix/nethack.sh in the source tree.
Another option is to leave the /usr/games/nethack script as it is, and just add a wrapper script that sets NETHACKOPTIONS and calls the original script. I actually had done it that way before trying to set it conditionally in the normal starting script. This is how my /usr/games/nhx script looks like:
#!/bin/sh
if [ -n "$DISPLAY"  -a  -f $HOME/.nethackrc.x11 ] ; then
    NETHACKOPTIONS=$HOME/.nethackrc.x11
fi
exec nethack "$@"
So, if I want to play with the x11 options, I start the game with 'nhx' instead of 'nethack'. And I have configured my Nethack icon to start with /usr/games/nhx too.

Valid HTML 4.0! (validation)

This page is viewable With Any Browser