Autopickup exception

From NetHackWiki
(Redirected from Autopickup exceptions)
Jump to: navigation, 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 as well.

You can either define the exceptions in the options screen or in your configuration file by putting the following lines in it:

AUTOPICKUP_EXCEPTION=">chest"

This will make the hero never pick up all items that match the string "chest".

AUTOPICKUP_EXCEPTION="<dagger"

This will make the hero always pick up all items that match the string "dagger".

If the first character inside the quoted string is a greater-than sign (>), then the matched items will be not be picked up; if it's a less-than sign (<), the items will be picked up. The rest of the string defines what items will match for that rule. The string matching allows for basic wildcards, where period plus asterisk (.*) matches any number of characters and question mark (?) matches any one character. A "never pickup" rule takes precedence over an "always pickup" rule if both match an item. If no rule matches, autopickup defaults to pickup_types.

NetHack attempts to convert the object names and called-classnames to singular form before matching them against your exceptions. This usually makes writing exceptions easier; however, when you use #name to give an object a called-classname, like "a gem called worthless", NetHack will mangle the called-classname as well, possibly making it harder to match against. In particular, it will attempt to make the word "worthless" singular by removing an "s", but only if the word comes at the end of the name. Thus, to drop all worthless glass, (whether formally or informally IDed) you should say ">*worthless?", not ">*worthless".[1]

How to use it effectively

Autopickup exceptions can greatly simplify dungeon exploration. However, the very limited nature of their regular expression syntax makes them a bit hard to configure.

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.

Use pickup_types as an in-game switch to distinguish between early-game and late-game configurations. In your nethackrc, simply don't mention items you want to default to pickup_types.

A few items are useful only in the early game (such as gold). You can remove according autopickup exceptions in-game with the O command. They will re-appear when you restore or start a new game. If your needs change much over the course of a long game, the easiest way to update the exceptions is to (un)comment lines in your config file, save the game, and restore.

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 Vendor named"

Avoid turning your scrolls of scare monster to dust:

AUTOPICKUP_EXCEPTION=">scroll of scare monster"
AUTOPICKUP_EXCEPTION=">scroll called scare monster"

Walk in peace over empty wands:

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

Good items left after a fight, but requires careful weight watching:

# autopickup_exception="<full healing"
# autopickup_exception="<potion of extra healing"
# autopickup_exception="<potion of healing"
# autopickup_exception="<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, but this likely picks up too much.

#  autopickup_exception="<blessed"

Never pick up corpses except lizards, newts, lichen, wraiths, and floating eyes

Since you can't define an exception from an exception, you have to enumerate the possibilities. The trailing [^<]*$ allows you to override this drop rule by naming a specific corpse with "<", such as "hill giant corpse named <".

# # We might pick up people food, but never corpses, except lizards, newts, lichen, wraiths, or floating eyes. 

AUTOPICKUP_EXCEPTION=">a corpse[^<]*$"
AUTOPICKUP_EXCEPTION=">b corpse[^<]*$"
AUTOPICKUP_EXCEPTION=">c corpse[^<]*$"

# lizards, but not wizards or guards or lords
AUTOPICKUP_EXCEPTION="<lizard corpse"
AUTOPICKUP_EXCEPTION=">[^r]d corpse[^<]*$"
AUTOPICKUP_EXCEPTION=">[^a]rd corpse[^<]*$"
AUTOPICKUP_EXCEPTION=">[^z]ard corpse[^<]*$"
AUTOPICKUP_EXCEPTION=">[^l]izard corpse[^<]*$"

#floating eye corpse
AUTOPICKUP_EXCEPTION="<floating eye corpse"
AUTOPICKUP_EXCEPTION=">[^y]e corpse[^<]*$"

AUTOPICKUP_EXCEPTION=">f corpse[^<]*$"
AUTOPICKUP_EXCEPTION=">g corpse[^<]*$"

# wraiths, but not Ixoth or Death
AUTOPICKUP_EXCEPTION="<wraith corpse"
AUTOPICKUP_EXCEPTION=">[^t]h corpse[^<]*$"
AUTOPICKUP_EXCEPTION=">[^i]th corpse[^<]*$"

AUTOPICKUP_EXCEPTION=">i corpse[^<]*$"
AUTOPICKUP_EXCEPTION=">k corpse[^<]*$"
AUTOPICKUP_EXCEPTION=">l corpse[^<]*$"
AUTOPICKUP_EXCEPTION=">m corpse[^<]*$"

#lichen corpse, but not all that other en stuff
AUTOPICKUP_EXCEPTION="<lichen corpse"
AUTOPICKUP_EXCEPTION=">[^e]n corpse[^<]*$"
AUTOPICKUP_EXCEPTION=">[^h]en corpse[^<]*$"

AUTOPICKUP_EXCEPTION=">o corpse[^<]*$"
AUTOPICKUP_EXCEPTION=">p corpse[^<]*$"
AUTOPICKUP_EXCEPTION=">r corpse[^<]*$"
AUTOPICKUP_EXCEPTION=">s corpse[^<]*$"

# newt
AUTOPICKUP_EXCEPTION="<newt corpse"
AUTOPICKUP_EXCEPTION=">[^w]t corpse[^<]*$"

AUTOPICKUP_EXCEPTION=">u corpse[^<]*$"
AUTOPICKUP_EXCEPTION=">v corpse[^<]*$"
AUTOPICKUP_EXCEPTION=">x corpse[^<]*$"
AUTOPICKUP_EXCEPTION=">y corpse[^<]*$"
AUTOPICKUP_EXCEPTION=">' corpse[^<]*$"

Define pickup / drop in-game

Without editing your config, you want to say "pick up all such objects" or "always leave this one on the floor". We will pick an object up if its individual name or called-classname ends with "<", and drop if ">".

In unpatched vanilla NetHack, the challenge are individual exceptions: You want to pick up your "blessed bag called CAUTION holding> named MY ONE AND ONLY<". But you want to leave any other "blessed bag called CAUTION holding>" on the floor, so you can't accidentally put it into your main bag and cause an explosion. In short, you want the individual object name to override the called-classname. You'd think this ruleset should work:

# good-faith attempt, doesn't work
autopickup_exception="> called .*>"
autopickup_exception="> named .*>"
autopickup_exception="> called .*<.* named .*>"
autopickup_exception="< called .*<"
autopickup_exception="< named .*<"
autopickup_exception="< called .*>.* named .*<"

But it fails. In the bag of holding example, both the first rule (drop) and the last one (pickup) match. Whenever conflicting rules match, the object is dropped. The solution is to add the regex [^<]$, which ignores any item which has a "<" before the end of the string, at the end of all drop rules.

This rule-set picks up "<" and drops ">" items, with priority on the individual object name.

# pickup what I define during game (called or named). Individual names take precedence.
autopickup_exception="<<"
autopickup_exception="> named .*>"
autopickup_exception="> called .*>.* named [^<]*$"

To avoid other conflicts, such as wanting to pick up a bag of holding named "Mine<", but not pick up any others, all drop rules should end with the regex [^<]$, like this:

autopickup_exception=">bag of holding[^<]*$"

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. E.g. call the mine town watchmens' helmets "plain". And call a magical but cursed helmet from a bones pile "#2 bones <" (trailing < to pick up a second specimen). 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       ^^^^^^
AUTOPICKUP_EXCEPTION="<conical hat"
AUTOPICKUP_EXCEPTION="<plumed helmet"
AUTOPICKUP_EXCEPTION="<etched helmet"
AUTOPICKUP_EXCEPTION="<crested helmet"
AUTOPICKUP_EXCEPTION="<visored helmet"
AUTOPICKUP_EXCEPTION="<tattered cape"
AUTOPICKUP_EXCEPTION="<opera cloak"
AUTOPICKUP_EXCEPTION="<ornamental cope"
AUTOPICKUP_EXCEPTION="<piece of cloth"
AUTOPICKUP_EXCEPTION="<old gloves"
AUTOPICKUP_EXCEPTION="<padded gloves"
AUTOPICKUP_EXCEPTION="<riding gloves"
AUTOPICKUP_EXCEPTION="<fencing gloves"
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 want to collect lightweight but dangerous projectiles and deposit then on an Elbereth square. This keeps monsters from reusing them against you over and over. (Deactivate daggers if you don't fire 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 permanent Elbereth are useful even in the ascension run or when farming. In those situations, 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 of wishing"
AUTOPICKUP_EXCEPTION="<wand called wish"
AUTOPICKUP_EXCEPTION="<wand of create monster"
AUTOPICKUP_EXCEPTION="<wand of teleportation"
AUTOPICKUP_EXCEPTION="<wand called tele"
# AUTOPICKUP_EXCEPTION="<wand of polymorph"
# AUTOPICKUP_EXCEPTION="<wand called poly"
AUTOPICKUP_EXCEPTION="<wand of fire"
AUTOPICKUP_EXCEPTION="<wand of lightning"
AUTOPICKUP_EXCEPTION="<wand of death"
# # Cold is used for Juiblex swamp, etc.
# AUTOPICKUP_EXCEPTION=">wand of cold[^<]*$"
AUTOPICKUP_EXCEPTION="<magic marker"
AUTOPICKUP_EXCEPTION="< lamp"
AUTOPICKUP_EXCEPTION="> oil lamp [^<]*$"
AUTOPICKUP_EXCEPTION="> lamp called oil[^<]*$"
AUTOPICKUP_EXCEPTION="<amulet of life saving"
AUTOPICKUP_EXCEPTION="<amulet called life"
AUTOPICKUP_EXCEPTION="<athame"

Avoiding loadstones

This rule-set should never pick up a loadstone, regardless of your blindness or knowledge of loadstones. You can still automatically pick up agate stones, etc.

AUTOPICKUP_EXCEPTION="> loadstone[^<]*$"
AUTOPICKUP_EXCEPTION="<stone called luck"
AUTOPICKUP_EXCEPTION="< luckstone"
# AUTOPICKUP_EXCEPTION="< touchstone"
AUTOPICKUP_EXCEPTION="> rock[^<]*$"

# #blind: glass/gems show up as gem, all else as stone.
AUTOPICKUP_EXCEPTION="> stone[^<]*$"

Only exceptions pick stuff up

If you want only the exceptions to pick anything up, you would normally set pickup_tyes to "" (empty). Unfortunately, that picks up everything. The solution is iron balls:

OPTIONS=pickup_types:0
AUTOPICKUP_EXCEPTION=">heavy iron ball[^<]*$"

References

External references