A Guide to Debug Mode for Non-Sourcedivers
Last edited 2004-10-25 for NetHack 3.4.3
Compiled by Dylan O'Donnell <[email protected]>

Invoking debug mode
~~~~~~~~~~~~~~~~~~~
In contrast to explore mode, debug mode (also known as "wizard mode"; no
relation to the Wizard role) can only be entered when starting a new
session, not partway through an existing session. To invoke debug mode,
NetHack must be started from the command line with the -D option, and in
addition the user starting the game must have the username authorised to do
so (by default, and in the official binaries, 'wizard'; this can be changed
at compile time by altering the WIZARD definition in include/config.h). On
single-user platforms, this is simply a matter of specifying the name with
the -u option:

nethack -u wizard -D

whereas on multi-user platforms, you need to be logged in as the user
'wizard' (or other specified name), and can just use:

nethack -D

If you are not using the authorised name, the -D option will instead start
an explore mode game. Regardless of whether the authorised name has been
changed, the player name of any debug mode character will be 'wizard'.

It is possible to restore a saved normal-mode game (belonging to any
player) in debug mode, by renaming the savefile (changing any userid
reference in the filename to that of the authorised wizard user, and the
character name to 'wizard'); as with any debug-mode restore, you'll be
prompted whether to keep the savefile or not.


Gameplay changes
~~~~~~~~~~~~~~~~
As in explore mode, dying can be refused; your life will be saved as if you
were wearing an amulet of lifesaving (but it'll even defeat self-genocide).
You are also immune to death by some forms of trickery (provided it doesn't
involve entire levelfiles going missing). Also as in explore mode, when you
do choose to end a game, nothing will be written to the high-score file.

The Big Room will always be generated, rather than the usual 40% chance;
the portal to Fort Ludios will be created in the first eligible vault,
rather than the usual 1/3 chance.

You are offered the option to leave bones whenever you die on any level
capable of leaving bones (regardless of depth, so even DL 1-3), possibly
replacing another bones file already stored for that level; similarly,
whenever you enter a level for which a saved bones file is present on the
system, you are given the opportunity of loading those bones, and are
asked whether you wish to delete ("unlink") the file or leave it in place.
It is generally considered unsporting to leave debug-mode bones (whether
enriched or booby-trapped) for regular characters to find.

You can force the gods to be pleased when you pray; answering "y" to the
question will zero your prayer timeout, clear any negative luck, set your
alignment to 1 if non-positive, remove any god's anger, and finally
persuade your god to overlook any remaining prayer disability.

When asking permission to Quest, you will be informed of any alignment
problems; if too low an alignment is the only one, you're given the option
to boost it to the minimum requirement there and then. (It'll revert to
be within the usual alignment limit for the age of the game the next time
you take any action that changes your alignment, so don't mess about
before going down into the Quest.)

When reading a blessed scroll of genocide, selecting '*' as the class will
result in nothing being genocided, but all monsters on the current level
being removed (including pets and NPCs, so be careful). It won't prevent
new ones being randomly created as usual, but it's handy to clear them out
of your way if you're testing something else.

You get to control whether any fountain you quaff from or dip into dries up.

You can force a #mount command to succeed if possible, regardless of most
usual impediments (healing wounded legs if necessary.)

A stethoscope or wand of probing will reveal more information about a pet:
its tameness, hunger level, and apport (willingness to fetch).

Wishes received from any source have additional options; see the
description of the ^W command in the section below. Similarly, teleport and
level teleport are always controlled and have some restrictions removed;
see ^T and ^V below. Monster creation with wand, spell, or scroll of create
monster allows you to specify what you get; see ^G below. (You can abdicate
the responsibility of specifying, and get random monsters as usual, by
hitting escape; useful if you get a horde result and don't care.)
Enlightenment shows a little extra information; see ^X below.


Special and augmented commands
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Debug mode gives access to several additional commands, and extends the
function of a few ordinary ones.

 ^E  detect secret doors and traps

     Equivalent to zapping a wand of secret door detection or casting a
     spell of detect unseen: secret doors and corridors, non-statue traps,
     mimics, and hidden and invisible monsters in an area of radius 8 are
     revealed.

 ^F  do magic mapping

     Equivalent to an uncursed scroll or spell of magic mapping, and also
     maps all traps on the level; unlike a blessed scroll, doesn't reveal
     secret doors.

 ^G  create monster

     You can specify to create any of a class of monster by symbol, or a
     particular monster. You can ask for a particular monster to be "tame",
     "peaceful", or "hostile" (feel free to have a tame Wizard of Yendor).
     "]" asks for a level-appropriate random monster.

 ^I  identify items in pack

     Equivalent to a full-identify from a scroll or spell of identify.

 ^O  tell locations of special levels

     List where each special level and branch level is (with the Castle
     pass-tune thrown in for free); Fort Ludios will be listed as a
     "floating branch" if its portal has not yet been generated. If you
     are on the Vibrating Square level or one of the first four Elemental
     Planes, you'll also be told the co-ordinates of the Square or portal.

 ^T  do intra-level teleport

     Removes some restrictions on teleport; always controlled, and you can
     teleport on no-teleport levels. The Amulet or the Wizard's Tower
     still have a residual 1/3 chance of preventing teleport, and any
     restrictions on teleporting between individual regions of a level
     will still be in effect.

 ^V  do trans-level teleport

     Removes the usual restrictions on level teleport; always controlled,
     and you can teleport while carrying the Amulet, in the Endgame, or
     in Sokoban, and to the Sanctum before performing the invocation
     ritual. You still can't teleport below the Valley of the Dead from
     the Dungeons of Doom, however. You can specify any special level or
     branch level by its name, whether you've visited there yet or not.
     ? will bring up a menu similar to the ^O command, which allows you
     access to any part of the game, regardless of whether that branch
     would usually be accessible (except returning from the Endgame to the
     earlier game, or to Fort Ludios before its portal has been created);
     if you use it to reach the Endgame, you will be issued with an Amulet
     and taken to the Plane of Earth.

 ^W  make wish

     You can wish for any object in the game and get it, including the
     invocation items and the Amulet of Yendor; your Quest Artifact (and
     other artifacts, with no chance of failure); magic lamps; usable wands
     of wishing; and venom. You can specify any valid attribute on an
     object, and get it (regardless of Luck or other factors), even ones
     you can't usually wish for (charges, enchantments and quantities in
     excess of their usual limits, and "trapped" chests). You can also
     wish for traps by name, and some dungeon features: fountains ("magic"
     can be specified), thrones, sinks, pools, lava, altars (of a
     particular alignment, or random if you don't specify), graves, trees,
     and iron bars.

 ^X  show attributes including intrinsic attributes

     In addition to the usual ^X character and god description, you will
     be enlightened. As well as the usual enlightenment information, you
     will be shown the exact values of your alignment, luck, god anger,
     and prayer timeout; whether your steed has wounded legs; and how much
     longer you are due to remain polymorphed or engulfed.

 #conduct          list which challenges you have adhered to

     In addition to the usual information provided, lists the exact
     number of times some conducts have been broken: weaponless,
     illiterate, polypileless, polyselfless.

 #enhance          advance or check weapons and spell skills

     You can choose to #enhance skills whether you've practised
     sufficiently or have free slots or not (though you're still limited
     to the usual role maxima). You'll also be told how many free skill
     slots you have available, how far you've practised each, and how
     many practices are required to advance normally.

 #levelchange      change experience level

     Equivalent to quaffing the appropriate number of uncursed gain level
     potions; though you can also reduce your experience level if you need
     to.

 #monpoly_control  control monster polymorphs

     Toggles control of monster polymorph on and off; when on, you will be
     prompted to specify what form a monster should assume whenever one
     shapeshifts or is polymorphed.

 #poly             polymorph self

     Equivalent to quaffing a potion of polymorph (but ignores
     unchanging); always controlled, but has the same chance as normal
     controlled polymorph of resulting in "You feel like a new <race>!".

 #lightsources     show mobile light sources
 #seenv            show seen vectors
 #stats            show memory statistics
 #timeout          look at timeout queue
 #vision           show vision array
 #wmode            show wall modes

     These show fairly technical information that you're unlikely to need
     unless you're doing deep-level debugging; of them, #timeout is the
     most likely to be useful to the average experimenter (handy to
     monitor when a corpse is due to rot or revive, for example).


Additional options
~~~~~~~~~~~~~~~~~~

menu_tab_sep

 Use tabstops rather than assuming monospacing in some menus. (This will
 likely only work under some interfaces, and may be rather broken in
 those; it's not a generally-available option for a reason.)

sanity_check

 Run checks on the object chains and timers after each turn to verify
 all is as it should be; if something's misplaced or untimed, a complaint
 will be generated.


Environment variables
~~~~~~~~~~~~~~~~~~~~~
NetHack pays attention to a few special environment variables when in debug
mode (these will need to be set from the command line before the game
session, with 'set VARIABLE=value', 'export VARIABLE=value', or whatever
syntax your platform uses to set environment variables).

SHOPTYPE:  This should be a single character from the list below. Each
          normal room-and-corridor Dungeons level created will contain a
          special room of the indicated type (even if one couldn't
          normally be created there).

          g or G    general store
          [         armour shop
          ?         scroll shop
          !         potion shop
          )         weapon shop
          %         food shop
          =         jewellery shop
          /         wand shop
          (         tool shop
          +         book shop
          z or Z    zoo
          m or M    graveyard (m)orgue)
          b or B    beehives
          t, T or \ thronerooms (\ may need to be escaped as \\)
          s or S    barracks (s)oldiers)
          a or A    anthole
          c or C    cockatrice nest
          l or L    leprechaun hall
          _         temple
          }         swamp

          Any other character will give a random shop (only) type, in
          the usual proportions.

SPLEVTYPE: This can be set to a level designation (or a comma-separated
          list of level designations) to force that particular version of
          a special level with multiple variants to be generated. The
          levels that this applies to are:

          bigrm-1 to bigrm-5
          medusa-1 or medusa-2
          minetn-1 to minetn-7
          minend-1 to minend-3
          soko1-1 or soko1-2 to soko4-1 or soko4-2

          For example, setting SPLEVTYPE to "minetn-4,bigrm-5" guarantees
          your getting College Town and the oval Big Room.

WIZKIT:    This variable specifies a filename to be read at game start.
          The file this points to should contain a list of objects
          specified according to the usual wishing syntax, one per line;
          you will start the game with these objects in your inventory
          (essentially, you're preloading ^W commands).


Acknowledgements
~~~~~~~~~~~~~~~~
Corrections and clarifications provided by Pat Rankin.