Autopickup exception

From NetHackWiki
Revision as of 02:09, 10 April 2020 by Hackerb9 (talk | contribs) (grammar cleanup)
Jump to navigation Jump to search

AUTOPICKUP_EXCEPTION is a configuration option that allows you to define what items are automatically picked up, with more precision than pickup_types gives. You also need to have autopickup on and pickup_types match the AUTOPICKUP_EXCEPTION -lines. Highly recommended — but not necessary — is adapting pickup_burden.

OPTIONS=autopickup
OPTIONS=pickup_types:$?!/(
OPTIONS=pickup_burden:unencumbered

In NetHack 3.6 autopickup exceptions are compiled in by default. NAO has them for 3.4.3 as well.

Syntax

An autopickup exception rule is expressed as either a < or a >, followed by a regular expression. The leading character determines whether items whose names match the regular expression are picked up: a < rule flags the matched item for pickup, while a > rule ignores the matched item.

The regular expression is matched against the singular form of the name of the item, plus any preceding article or number: "a gold piece" matches a single gold piece, "2 gold piece" matches a stack of 2 gold pieces, but "2 gold pieces" would match nothing.[1] Any "called ..." or "named ..." suffixes added with the #name command are included, so take note of your own naming habits and write your autopickup exceptions accordingly.

As of version 3.6.4, autopickup exceptions override one another sequentially the same way menucolors and msgtypes do, with rules specified further down in the config file taking precedence over those specified earlier, and rules specified during play via the O command taking precedence over everything. Order is all that matters; neither < nor > takes precedence over the other. Pickup_types is consulted if and only if no matching rule is found.

In the configuration file, exceptions are specified by the string AUTOPICKUP_EXCEPTION= followed by the rule enclosed in quotes. When adding an exception via the O command, you're just prompted for the rule.

Effective use

Autopickup exceptions can greatly simplify dungeon exploration. You can use them to keep dangerous items out of monsters' hands, to conveniently sort through large piles of loot, to automate things you might forget, to save a turn when fleeing or on speed runs, to remove good morphs from your polypiling line without paying attention, etc.

Some items, such as gold, are useful only in the early game. You can add and remove rules in-game with the O command, though the settings will revert the next time you run the program. If your needs change much over the course of a long game, the easiest way to update the exceptions is to comment or uncomment the lines in your nethackrc, save the game, and restore. You can also use pickup_types as an in-game switch to distinguish between early-game and late-game configurations by simply not mentioning items you want to default to pickup_types.

Easy ones

Individually-name the real Amulet right away and you'll never fall for a fake:

AUTOPICKUP_EXCEPTION=">Amulet of Yendor"
AUTOPICKUP_EXCEPTION="<Amulet of Yendor named"

Avoid turning your scrolls of scare monster to dust:

AUTOPICKUP_EXCEPTION=">scroll .* scare monster"

Walk in peace over empty wands and wands of nothing:

AUTOPICKUP_EXCEPTION=":0¥)"
AUTOPICKUP_EXCEPTION="> named empty"
AUTOPICKUP_EXCEPTION="> nothing"

Good items left after a fight that careful weight watching:

# AUTOPICKUP_EXCEPTION="<potion .* healing"
# AUTOPICKUP_EXCEPTION="<potion .* gain level"

Pick up formally identified artifacts. Don't blast yourself to death with a cross-aligned one — leave unidentified ones on the floor:

AUTOPICKUP_EXCEPTION="<[^| ]the "

Some people also want known-blessed items, though this likely picks up too much:

#  AUTOPICKUP_EXCEPTION="<blessed"

Corpses

The comestible item class includes food, which you may well want to autopickup, but also corpses, most of which are worthless, prohibitively heavy, and in the case of cockatrice and chickatrice corpses, extremely dangerous. If you want to pick up food, but not corpses, include % in your pickup_types and then add the following exception:

AUTOPICKUP_EXCEPTION="> corpse"

Corpses you will want to pick up include lichen and lizards, which do not decay and the latter of which is invaluable in certain emergencies. You may also want to grab newts, floating eyes, and wraiths, which are lightweight and have beneficial effects when eaten. If you want to pick up these, add the following lines beneath the corpse rule:

AUTOPICKUP_EXCEPTION="<lichen corpse" 
AUTOPICKUP_EXCEPTION="<lizard corpse" 
AUTOPICKUP_EXCEPTION="<newt corpse"
AUTOPICKUP_EXCEPTION="<floating eye corpse"
AUTOPICKUP_EXCEPTION="<wraith corpse"

Define pickup / drop in-game

The following rules let you manually override autopickup exceptions without changing the rules at all by #naming items with strings containing "<" or ">":

AUTOPICKUP_EXCEPTION="<<"
AUTOPICKUP_EXCEPTION=">>"

Because rules defined later take precedence over ones defined earlier, if you want these manual overrides to take effect unconditionally, you have to put them at the end of the file. If you want to be able to name a class of unidentified items with ">" to leave them alone and then individually-name one of those items with "<" to pick it up, add the following rules below that:

autopickup_exception="< named .*<"
autopickup_exception="> named .*>"

One of each kind of magical object

Usually, you need only one of each type of magical armor / ring / amulet / spellbook / magical tool. Wouldn't it be nice if the game managed that for you? It can if you're willing to class-name all objects immediately.

Below are the rules for armor. You could call the mine town watchmens' helmets "plain", turning it from its name from its unidentified description to "a helmet called plain" and removing it from the pickup list. See Tjr's config for other item types, although it needs to be updated for Nethack 3.6 regex format.

# AUTOPICKUP_EXCEPTION="<robe"
# AUTOPICKUP_EXCEPTION="<faded pall"
# AUTOPICKUP_EXCEPTION="<apron"
# AUTOPICKUP_EXCEPTION="<polished silver shield"
# AUTOPICKUP_EXCEPTION="<smooth shield" # blind description

AUTOPICKUP_EXCEPTION=">helmet"
AUTOPICKUP_EXCEPTION="<conical hat"
AUTOPICKUP_EXCEPTION="<plumed helmet"
AUTOPICKUP_EXCEPTION="<etched helmet"
AUTOPICKUP_EXCEPTION="<crested helmet"
AUTOPICKUP_EXCEPTION="<visored helmet"

AUTOPICKUP_EXCEPTION=">cloak"
AUTOPICKUP_EXCEPTION="<tattered cape"
AUTOPICKUP_EXCEPTION="<opera cloak"
AUTOPICKUP_EXCEPTION="<ornamental cope"
AUTOPICKUP_EXCEPTION="<piece of cloth"

AUTOPICKUP_EXCEPTION=">gloves"
AUTOPICKUP_EXCEPTION="<old gloves"
AUTOPICKUP_EXCEPTION="<padded gloves"
AUTOPICKUP_EXCEPTION="<riding gloves"
AUTOPICKUP_EXCEPTION="<fencing gloves"

AUTOPICKUP_EXCEPTION=">boots"
AUTOPICKUP_EXCEPTION="<combat boots"
AUTOPICKUP_EXCEPTION="<jungle boots"
AUTOPICKUP_EXCEPTION="<hiking boots"
AUTOPICKUP_EXCEPTION="<mud boots"
AUTOPICKUP_EXCEPTION="<buckled boots"
AUTOPICKUP_EXCEPTION="<riding boots"
AUTOPICKUP_EXCEPTION="<snow boots"

Keeping ammunition out of monsters' hands

Especially in the Mines, you will want to collect lightweight but dangerous projectiles and deposit them in a safe location &endash; on a square with a scroll of scare monster, the downstair on a previously cleared level, or underneath a boulder. This keeps monsters from reusing them against you. (Deactivate daggers if you don't throw them yourself — they're heavy.)

AUTOPICKUP_EXCEPTION="< arrow"
## AUTOPICKUP_EXCEPTION="<elven arrow"
## AUTOPICKUP_EXCEPTION="<orcish arrow"
## AUTOPICKUP_EXCEPTION="<silver arrow"
## AUTOPICKUP_EXCEPTION="<runed arrow"
## AUTOPICKUP_EXCEPTION="<crude arrow"
AUTOPICKUP_EXCEPTION="< ya"

## AUTOPICKUP_EXCEPTION="<bamboo arrow"
AUTOPICKUP_EXCEPTION="<crossbow bolt"
AUTOPICKUP_EXCEPTION="<dart"
AUTOPICKUP_EXCEPTION="<shuriken"
AUTOPICKUP_EXCEPTION="<throwing star"

AUTOPICKUP_EXCEPTION="<dagger"
## AUTOPICKUP_EXCEPTION="<elven dagger"
## AUTOPICKUP_EXCEPTION="<orcish dagger"
## AUTOPICKUP_EXCEPTION="<runed dagger"
## AUTOPICKUP_EXCEPTION="<crude dagger"
## AUTOPICKUP_EXCEPTION="<silver dagger"
AUTOPICKUP_EXCEPTION="<knife"

Things too good to miss

Wands of wishing, magic lamps, magic markers, and wands of lasting Elbereth are useful even in the endgame, when you likely have enough other things on your mind. You don't want monsters zapping create monster or shooting death rays at you.

AUTOPICKUP_EXCEPTION="<wand .* wish"
AUTOPICKUP_EXCEPTION="<wand .* create monster"
AUTOPICKUP_EXCEPTION="<wand .* tele"
#AUTOPICKUP_EXCEPTION="<wand .* poly"

AUTOPICKUP_EXCEPTION="<wand .* fire"
AUTOPICKUP_EXCEPTION="<wand .* lightning"
AUTOPICKUP_EXCEPTION="<wand .* death"
#AUTOPICKUP_EXCEPTION=">wand .* cold$" # For Juiblex's swamp

AUTOPICKUP_EXCEPTION="<magic marker"
AUTOPICKUP_EXCEPTION="< lamp"
AUTOPICKUP_EXCEPTION="> oil lamp"
AUTOPICKUP_EXCEPTION="> lamp .* oil"
AUTOPICKUP_EXCEPTION="<amulet .* life"
AUTOPICKUP_EXCEPTION="<athame"

Avoiding loadstones

With these rules, you should never pick up a loadstone, regardless of your knowledge of loadstones:

AUTOPICKUP_EXCEPTION="> loadstone"
AUTOPICKUP_EXCEPTION="<stone called luck"
AUTOPICKUP_EXCEPTION="< luckstone"
#AUTOPICKUP_EXCEPTION="< touchstone"
AUTOPICKUP_EXCEPTION="> rock"
AUTOPICKUP_EXCEPTION="> gray stone"

When blind, gems and worthless glass are called "gems", and all other * are called "stones", so with the following rule, you won't risk picking up loadstones while blind, either:

AUTOPICKUP_EXCEPTION=">^[a0-9]+ stone"

The leading ^[a0-9]+ ensures that valuable gems with "stone" in their identified name (amber stones, turquoise stones, etc.) are not matched.

Only exceptions pick stuff up

If you want only the exceptions to pick anything up, put this rule at the beginning of your file:

AUTOPICKUP_EXCEPTION=">.*"

This excludes everything, so that you can turn on autopickup, but not actually autopickup anything unless you say so with an exception.

References

External references

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

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

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