From NetHackWiki
Jump to: navigation, search

Pacifist Key Bindings for GNU Screen

Many attempted pacifist games end abruptly with accidentally bump-killing weak monsters, breaking pacifist conduct. One of the more extreme solutions to this problem is to use GNU Screen to remap the movement keys so they are all prefixed with m. For example, pressing k will actually send mk to the game. This eliminates the possibility of bump-killing (unless you're wielding Stormbringer, but that would be a silly weapon choice for a pacifist), but can make other activities, like inventory management or choosing a direction to apply a stethoscope or key, somewhat annoying.

Below is a set of three screen rc files that allow you to switch "pacifist mode" on and off while playing. After creating these files, you can start nethack with:

 screen -c ~/.screenrc-pacifist telnet

When you hit F11, the key bindings are activated. Pressing F12 returns the bindings to normal. While the key bindings are activated, you can hit ctrl + t to send the next movement key as-is, without the m prefix.

RC Files

Simply create these three files and start nethack as above. The keys to turn pacifist mode on/off can be modified in ~/.screenrc-pacifist by replacing "F1" and "F2" with the keys of your choice. Type "k1" though "k9" to use the F1 through F9 keys, "k0" is F10, and "F1" and "F2" are the F11 and F12 keys, respectively. You can also use, for example, ctrl + o by typing "^o" and omitting the "-k" argument.


# Hit F11 (not F1!) to enable pacifist key bindings
bindkey -k F1 source ~/.screenrc-pacifist-on
# Hit F12 (not F2!) to disable pacifist key bindings
bindkey -k F2 source ~/.screenrc-pacifist-off


# Enable pacifist key bindings:
# Defuse movement keys so they won't attack.
# Unfortunately, deactivates autopickup.
bindkey 'h' stuff 'mh'
bindkey 'y' stuff 'my'
bindkey 'k' stuff 'mk'
bindkey 'u' stuff 'mu'
bindkey 'l' stuff 'ml'
bindkey 'n' stuff 'mn'
bindkey 'j' stuff 'mj'
bindkey 'b' stuff 'mb'
# make control-t the unbound-prefix
bindkey "\024" mapdefault
wall "Pacifist mode activated!"


# Disable pacifist key bindings
bindkey 'h'
bindkey 'y'
bindkey 'k'
bindkey 'u'
bindkey 'l'
bindkey 'n'
bindkey 'j'
bindkey 'b'
bindkey "\024"
wall "Pacifist mode deactivated!"