X11

From NetHackWiki
Jump to navigation Jump to search

X11 is a GUI of NetHack, mainly used on unix-type operating systems. If your copy of NetHack has that compiled in, you can enable it by setting OPTIONS=windowtype:X11 in your config file.

Character selection dialog
Without tiles or any X resources.
Running on Kubuntu Linux 6.06.

X11 can do both tile-graphics and ASCII.

If you do not have any X11 resources set for NetHack, all windows will be black text on white background, and this makes playing almost impossible, unless you turn off color.

You can define the X resources in a text file, for example NetHack.ad in the playground or ~/.Xdefaults, with one resource per line. You can then use xrdb -merge ~/.Xdefaults to make the resources active for your X session.

The configuration file that comes with NetHack sources, win/X11/NetHack.ad, contains extensive documentation about the file and what you can change in it. This file is copied to the nethack playground when compiling and installing from source.

List of some of the X resources NetHack accepts:

Resource string Value Explanation
NetHack*font font Sets the font for all NetHack windows. Must be fixed-width font!
NetHack.tile_file filename What file contains the tiles used for the map? The file must reside in the NetHack playground. If NetHack was compiled with USE_XPM, then this can be a normal xpm-bitmap, otherwise it must be NetHack's custom format.
NetHack.pet_mark_bitmap filename File to use to annotate pets in tile mode. Same restrictions as with tile_file above, except this one must be a two color, black and white, image; the white will be transparent and black will be replaced with pet_mark_color, see below.
NetHack.pet_mark_color color Color of the pet annotation mark.
NetHack*message_lines number The number of lines the message window will show without scrolling.
NetHack*message_line boolean If True, the message window has a line that separates old and new messages.
NetHack*autofocus boolean If True, force keyboard focus to attach to popup windows.
NetHack*slow boolean If True, the default, a popup for single character prompts such as y/n is not used.
NetHack*background color Sets the background color of all NetHack windows
NetHack*foreground color Sets the foreground color of all NetHack windows
NetHack*map*background color Sets the background color of the map
NetHack*map*black color Sets the color 'black' in map to some other color
NetHack*map*red color Sets the color 'red' in map to some other color
NetHack*map*green color Sets the color 'green' in map to some other color
NetHack*map*brown color Sets the color 'brown' in map to some other color
NetHack*map*blue color Sets the color 'blue' in map to some other color
NetHack*map*magenta color Sets the color 'magenta' in map to some other color
NetHack*map*cyan color Sets the color 'cyan' in map to some other color
NetHack*map*gray color Sets the color 'gray' in map to some other color
NetHack*map*orange color Sets the color 'orange' in map to some other color
NetHack*map*bright_green color Sets the color 'bright_green' in map to some other color
NetHack*map*yellow color Sets the color 'yellow' in map to some other color
NetHack*map*bright_blue color Sets the color 'bright_blue' in map to some other color
NetHack*map*bright_magenta color Sets the color 'bright_magenta' in map to some other color
NetHack*map*bright_cyan color Sets the color 'bright_cyan' in map to some other color
NetHack*map*white color Sets the color 'white' in map to some other color
  • 'boolean' can be either True or False.
  • 'color' can be defined either with a named color, or a hexadecimal RGB number, such as #00ff00.
  • 'font' can be any font string the X11 server knows about. Use xlsfonts or xfontsel or some such program to see the fonts.

Some good values would be, for example

! Lines beginning with ! are comments and are ignored.
NetHack*font:                   vga

NetHack*background:             black
NetHack*foreground:             grey

NetHack*map*background:         black

NetHack*map*black:              grey25
NetHack*map*red:                red3
NetHack*map*green:              green3
NetHack*map*brown:              DarkOrange3
NetHack*map*blue:               blue3
NetHack*map*magenta:            magenta3
NetHack*map*cyan:               cyan3
NetHack*map*gray:               gray70
NetHack*map*orange:             yellow
NetHack*map*bright_green:       green
NetHack*map*yellow:             yellow
NetHack*map*bright_blue:        blue
NetHack*map*bright_magenta:     magenta
NetHack*map*bright_cyan:        cyan
NetHack*map*white:              white

This page may need to be updated for the current version of NetHack.

It may contain text specific to NetHack 3.4.3. Information on this page may be out of date.

Editors: After reviewing this page and making necessary edits, please change the {{nethack-343}} tag to the current version's tag or {{noversion}} as appropriate.