The Mogaminator The Mogaminator is a rules-based system for automatic object handling, which you can activate or modify with the _ command. With this system, you can decide which objects to pick up, which to destroy, which to automatically identify, and which to display as wanted in the object list. You can automatically inscribe objects to suit your tastes, and even enter conditional statements to handle the preferences of different races and classes. Or you can just keep the default Mogaminator rules, which already do all of the above! This document describes this system in tutorial fashion, assuming you know nothing about it. Detailed reference material will appear towards the bottom of this document (see [a] if you really cannot wait!). The system is named after its original author, Hengband developer Mogami. Review of Object Knowledge There is no doubt about it: the game generates lots and lots of objects. Some are valuable, some are not, and some are only valuable in specific situations... The Mogaminator will help you untangle that mountain of loot. First, a really quick review of what is explained in detail at [b]. When you find an object, it will generally be unidentified, but you might have (or soon receive) a rough sense of the object's quality, called object feeling or pseudo-ID. If the object looks promising, you probably want to identify it to reveal the basics and maybe *Identify* it to reveal special properties. So your knowledge of an object is in one of the following states: [1] Unsensed [2] Sensed (pseudo-identified) [3] Identified [4] *Identified* For mushrooms, potions and scrolls, things are a little different; these objects come in flavors, and once you have learned the flavor, you will immediately recognize all future instances of that object. Indeed, all instances of the object are exactly alike, so the identification game is simply to discover and know the first instance of the object, and then decide, via your pick-up and destroy preferences, what to do with future instances of this type of object. Managing Objects There are three ways to manage objects: manually, by using the Easy Destroyer ([c] below), and by using the Mogaminator. The Mogaminator is much more powerful than the Easy Destroyer, which simply destroys items, usually junk. The Mogaminator and the Easy Destroyer should only be used side-by-side if you have turned the always_pickup option on. What is the Mogaminator? Basically, it is a rules-based system for taking a given action each time you encounter a certain type of object. The default action is pick up, and this action is used whenever you fail to specify an alternative action; but the Mogaminator can also destroy junk for you and identify and inscribe objects automatically. Let's discuss the basics. Basic Usage The Mogaminator is activated by pressing _, which also brings up an in-game editor where you can manage your preferences. It might look like this: (^Q:Quit, ^W:Save&Quit, ESC:Menu, Other:Input text) (0,0) ######################################### # Consumables ######################################### mushroom of restoring#!E ~mushroom of hallucination ?:[EQU $RACE Snotling Doppelganger] ~mushroom ?:1 ?:[LEQ $LEVEL 35] potions:resist heat and cold#!kq ?:1 potions:resistance#!kq potions:stone skin#!k potions:heroism potions:speed#!kq potions:giant strength#!k potions:enlightenment potions:of strength#!k ------------------------------------------------------------------------------- This line is a comment. If you are new, you probably want to run from this complexity as fast as you can. Notice the top line of the screen where it tells you how to get out: ^Q (and you can also exit through the ESC menu). The desire to exit immediately is understandable, and in fact not a problem: simply pressing _ turned the Mogaminator on and initialized it with default preferences, so it should do a good job without any further messing. (If you are very lazy, you can stop reading here and just happily play away with the default preferences for the rest of the game!) So What Happened? With the Mogaminator now on, you will find much of the junk you encounter being destroyed. For example, all those corpses and skeletons you leave behind as you hack and slash your way through the dungeon... except for wanted corpses, which are getting automatically picked up! That's a good start; but you might still run into objects you consider useless. For example, suppose you bought a lantern at the General Store; now you don't really care about torches anymore. Use the k command (or ^D for the Roguelike keyset) and you get a prompt like: Really destroy Wooden Torches {unidentified}? [y/n/Auto] Notice the Auto option. Choose that, and you get a message that the object is destroyed, but the fact that you don't like torches is remembered by the system. The next time your character moves on top of one, it will be destroyed automatically. That's one simple way to use the Mogaminator: keep registering stuff for automatic destruction as you encounter it, and the loot mountain becomes easier to manage; but as we'll see later, auto-pickup is even better than auto-destruction. Oops, I'm Auto-Destroying Rings of Speed Ouch! Well, don't panic. You can fix the problem easily; but doing so will require you to go back to the preference file editor. Press _ and then press END to move to the end of the document. This is where the game keeps track of any objects that you automatically registered for destruction. Your screen might look something like: (^Q:Quit, ^W:Save&Quit, ESC:Menu, Other:Input text) * (0,268) ?:[EQU $CLASS Tourist] ~photograph ?:1 ~special items !worthless items #!unusable items ?:$AUTOREGISTER # *Warning!* The lines below will be deleted later. # Keep them by cut & paste if you need them for future characters. (!nameless lights:^wooden torch$ ------------------------------------------------------------------------------- Destroy all light sources whose name begins with "wooden torch$", and which ar neither ego-item nor artifact. Do not display as wanted. This line will be deleted later. You cannot tell from the picture above, but I placed the cursor on the very last line of the file; in my case, the line from when I registered torches for destruction. Notice that at the very bottom of the screen, the game tells you exactly what the given rule means; if you are curious, you can move the cursor around the default preference file and actually learn quite a bit about how the system works. If you wish to simply remove this (or any other) rule, just delete the corresponding line and then exit with ^W to save and apply your changes. What About Stuff I Want? What you don't want is only half the story; some objects you really like. The two work nicely together, since interesting objects will appear at the top of the ] object list. This allows you to easily track the interesting stuff even if the junk has not been destroyed! Suppose you want potions of Cure Critical Wounds (this is a random but reasonable example of an item not set to be picked up by default). Wouldn't it be nice if these potions were automatically picked up, as well as displayed near the top of the object list? This is accomplished by adding the following line to the top of the preferences file: (^Q:Quit, ^W:Save&Quit, ESC:Menu, Other:Input text) * (0,0) cure critical wounds ######################################### # Consumables ######################################### mushroom of restoring#!E ~mushroom of hallucination ?:[EQU $RACE Snotling Doppelganger] ~mushroom ?:1 ------------------------------------------------------------------------------- Pick up all items which have "cure critical wounds" as part of their name. Display these items as wanted in object list. I colored the new line yellow in the screenshot to make it stand out. Pay attention to the bottom of the screen: does it sound like it will work? The reason I had to put the new line at the top is that rules are processed in order of priority from top to bottom; so if I placed the new rule at the bottom, it might have been overridden by an earlier rule. Now, let's press ] to activate the Object List - is there anything on this level that I want? There are 4 wanted objects: LEVEL 1 ! 4 Potions of Cure Critical Wounds S 4 E 16 EXP 3 AU 747 There are 4 other objects: | !( ~ 4 Wooden Torches {unidentified} N 3 E 17 STR : 16 [Press ESC to exit. Press ? for help] INT : 18 >.....#+#.%% WIS : 9 %%%%.%%.#.% ##.. DEX : 18/40 %'%....# #%.... CON : 17 %%......% %%.~..% CHR : 12 #%......+% %%% %#....%%.. AC 6 %#........%%%%%%%%%#%.%% ##.......... HP 37/ 37 %.........'.'.......@..#% #%..........# SP 14/ 14 %%%......%%%%%%%%%%%#*'.###%% #%....##....* ..'.......# %.......%..#%....%%....#% %%##......% %........%%%....##....## %.....%# %.......'......#%.!..%% %.#...% #.......#%%########### %%%%#%% #.......# Bingo! You can even automatically travel to those delicious potions by pressing J inside the Object List. What could be easier? To recap, adding the line "cure critical wounds" tells the Mogaminator to pick up any object that has "cure critical wounds" as part of its name. You don't have to type so much - "crit" might work just as well - but the less you type, the more likely it is that your new rule will also match other objects. For example, "cure" would match potions of Cure Light Wounds, Cure Serious Wounds and Cure Critical Wounds, and even Staves of Cure Wounds. Sometimes this is OK, but at other times, it is better to type more. Introduction to Rules and Events So how does all this work? Basically, the preference file is an ordered list of rules. Whenever a certain event happens (such as moving on top of an object), the rules are scanned from top to bottom, and the first one that matches (if any) is applied. Every rule has an action associated with it that determines what to do if the rule applies. Each rule is a single line in the file; but not every line is a rule. Some lines are blank, some are comments, and some are conditionals that tell the game when to ignore rules. Objects are tested against rules whenever a specific event happens; generally when the player (1) moves on top of an object, (2) gets a new object feeling (see [d]) or (3) identifies an object (see [e]). Rules A rule is a single line that consists of an action to perform, a predicate to test matches, and an optional inscription to add. Let's discuss each of these in turn. Actions First of all, picking something up is the default action and is inferred whenever you fail to specify an alternative. What are the alternatives? ! Destroy ; Prompt to pick up ~ Leave on the floor These are the primary actions. Pick-up is assumed if the rule does not begin with !, ; or ~. Note that if the always_pickup option is on, then ; and ~ will be overridden by it; and even ! is overridden unless the leave_mogaminator option is also on. In addition, there are the following action letters that augment the primary action: ( Don't display this item on the M map ? Automatically identify this item The first of these is not commonly used, since the M map item display has been completely obsoleted by improvements to the object list. The second option (?) is very useful, though, since it automatically identifies the matching object. This is a great time-saver, but requires you to carry Scrolls or Staves of Identify. All of the action letters must be specified first in the line for the rule, with one exception. The # letter indicates that you wish to automatically inscribe matching objects, and it must occur at the end of the rule, followed only by the inscription text itself. For example, #@ad!sdk at the end of a rule will automatically inscribe @ad!sdk to any object matching the rule. (See [f] for an explanation of this inscription!) Matching We saw above that matching is by string comparison with the object name, but you can be more specific than that if you want. To do so, use the following keywords to construct a predicate used to test objects. The keyword portion of the match consists of zero or more adjectives modifying a noun that indicates the broad class of objects which should be considered. In addition, you can specify a free form text comparison string by adjoining : followed by text to search for. We'll put all of this together in the examples section below. Let's do nouns first. A complete list is presented at the end of this document, but some common nouns to get us started include: Items Applies to everything. This is useful for very general rules, such as ~?unidentified items to automatically identify, but leave on the ground, everything not yet identified; or even items to pick everything up! Weapons Applies to all melee weapons, but not to ranged weapons. Shooters Applies to all missile weapons, including bows, slings and crossbows. Armors Applies to all forms of armor, including shields, helms and cloaks as well as body armor. Wands Applies to magical devices that are wands Staves Applies to magical devices that are staves Rods Applies to magical devices that are rods Potions Applies to potions Scrolls Applies to scrolls If you are using keywords to build a match predicate, then you must specify exactly one noun, but may use as many adjectives as you like. The complete list of adjectives is given below at [g], but here are some of the more common ones: Unaware Applies to objects whose flavor has not yet been identified. Unidentified Applies to any objects that have not yet been identified. Unsensed Applies to objects that have not been identified or pseudo-identified. Ego Applies to all excellent objects. Nameless Applies to all non-ego, non-artifact objects. Wanted Applies to corpses and skeletons of wanted monsters. These may be turned in at the Hunter's Office for a prize. As an example of using multiple adjectives, the phrase ?unidentified ego weapons applies to, well, all melee weapons that are both excellent and not yet identified. Of course this means you must have pseudo-identified the object to know that it is an ego. Finally, use a search string to further refine the match. If you don't use any adjective or noun keywords, then the entire text of your rule (starting after any action letters, and including all text up to the # inscription character) is used as the search string. If you are using keywords, mark the end of the keyword section with the : separator. Examples are discussed below. Examples !potions:apple juice Destroy potions of apple juice (as refreshing as they might be!). It uses the ! action letter for destruction, the potions keyword to apply to an entire class of objects, the : separator key, and a text field for string matching against the object name. ?unaware items Pick up and automatically identify unidentified flavored items (e.g. a potion you've never seen before). Note that the pickup action is implied since none of the other primary actions are indicated, and even though there is a secondary action (to auto-id). This command uses the adjective unaware to modify the noun items. You could narrow down the applicability of this rule by using a more specific noun, such as scrolls or potions. wanted corpses#Wanted!kkk Pick up wanted corpses, and automatically inscribe them with Wanted!kkk. This inscription may make it sound like the monster was wanted for racism, but it simply means you get prompted repeatedly if you accidentally try to destroy the corpse. (See [h] for more on how inscriptions work.) ?staves:destruction#@ud!sdk Pick up and automatically identify all staves whose name contains the string "destruction". Inscribe these objects with @ud!sdk. Example Scenarios After that last section, you should have complete mastery over individual rules. Now, it is time to step up one level and apply multiple rules to accomplish common tasks. Ready? Scenario #1: Handling Objects In this scenario, you would like to handle the stream of objects in the most efficient way possible. Let's begin with the following rules: unsensed armors unsensed weapons These rules say to pick up all armor and weapons not yet sensed or identified. That leaves out many types of objects, like potions and scrolls, but at least weapons and armors are objects that can be sensed. Since objects need to be in your pack to be sensed (we know immediate floor-pseudo-ID didn't kick in because the objects matched the unsensed adjective!), it is convenient to pick them up. Now, let's add the following rules: !average common weapons !average common armors You might not actually want this; but for now, assume your character is advanced enough to view average common equipment as junk. These rules will fire once pseudo-ID kicks in, destroying weapons and armor that pseudo-ID as average. The common adjective prevents these rules from applying to rare average items, like dragon scale mail or blades of chaos. So, now our character is merrily picking up all equipment and then auto-destroying the average stuff once pseudo-id kicks in. Can we do more? Well, try adding: ?unidentified ego items Now, the egos are automatically being identified on pseudo-ID as well. Pretty sweet! But maybe you get tired of some ego types after a while, and want them registered for destruction: !common ego cloaks:of protection !common ego weapons:of sharpness Now even boring excellent items are being toasted for you, automatically, with nary a keystroke on your part; but, sometimes swords of sharpness become dice-boosted, and might not be so boring after all. You can protect them with dice boosted weapons or perhaps even weapons more dice than 30 though that last one is an advanced maneuver. In summary, the complete order of your rules might be: weapons more dice than 30 ?unidentified ego items !average common weapons !average common armors unidentified armors unidentified weapons !common ego cloaks:of protection !common ego weapons:of sharpness New armors and weapons come down and hit rule 5 or 6 when your character steps on them, so they get placed into your pack automatically. Eventually pseudo-ID will kick in, revealing the object as average, in which case it is destroyed by rule 3 or rule 4, or as excellent, in which case it is processed by rule 2 which auto-identifies the ego item and rescans the rules. If it is a cloak of protection, it is destroyed by rule 7, while if it is a weapon of sharpness, it is destroyed by rule 8 - unless it happened to be hugely dice boosted, in which case it is protected by top-priority rule 1. Easy, right? Now you only have {bad} and {good} and {special} equipment to worry about... Scenario #2: Flavored Objects This one is easier, and I'll give the full set of rules first: potions:healing#!kq potions:of strength#!k potions:of intelligence#!k potions:of wisdom#!k potions:of dexterity#!k potions:of constitution#!k potions:of charisma#!k potions:augmentation#!k scrolls:artifact creation#!* ... ?unaware items collecting potions collecting scrolls ?:$AUTOREGISTER ... (!potions:^potion of restore charisma$ (!scrolls:^scroll of treasure detection$ ... <many more junk flavors auto-registered for destruction> ... Now, the pattern is wanted flavors on top for autopickup (and inscription), unwanted flavors on bottom for autodestruction (these are placed in your file automatically each time you press A while destroying an object) and rules for collecting and unaware items in the middle. Unaware items get automatically identified, at which point one of the pick-up or destroy rules might get a chance to act. As for the collecting rules, those fire if you have another object of the same flavor in your pack. Perhaps you are carrying potions of Cure Critical Wounds, but don't have a rule specifically for this flavor; in this case, the collecting rule will pick up other potions of Cure Critical Wounds for you. Scenario #3: Spellbooks OK, this is the last one. See if you can figure this one out first: first realm's fourth spellbooks#@md!sdk first realm's third spellbooks#@mc!sdk ~first realm's second spellbooks#@mb!k ~first realm's first spellbooks#@ma!k second realm's fourth spellbooks#@mh!sdk second realm's third spellbooks#@mg!sdk ~second realm's second spellbooks#@mf!k ~second realm's first spellbooks#@me!k !first spellbooks !second spellbooks !third spellbooks:major arcana !fourth spellbooks:manual of mastery third spellbooks fourth spellbooks Did you figure it out? This scenario picks up high level spellbooks from your character's magic realms, leaves low level spellbooks from your realms, destroys all other low level spellbooks, destroys all arcane magic spellbooks, but picks up high level spellbooks from other realms (presumably to sell for gold). Spellbooks from your realms are auto-inscribed to keep book labels consistent. Here, as elsewhere, order is very important: rules for the character's spell realms must come before the general rules to destroy low level spellbooks. (There is an unreadable adjective that would have made processing safer and less order-dependent here.) Which Rule is Being Used? If you are ever unsure about which rule is being applied in a given situation, turn on the destroy_debug option (see [i]). With this option you can use the Inspect command for more information. For example: a Thieves' Guide [Burglar's Handbook] Autopick: (!unreadable first spellbooks I may or may not like this behavior, and if I don't, now I know which line to change! In addition, with debugging turned on, the rules used are printed in the message log as actions are taken, so you can see exactly why objects are being destroyed, picked up, left on the ground or auto-identified. For example: You have 26 charges remaining. (AutoID:~?unidentified rods) You see a Rod: Frost Ball (1/3 charges). (Destroy:(!rods:frost ball$) Auto-destroying. Since this is message spam, you probably don't want to leave the destroy_debug option permanently on. Conditionals This is an advanced topic, but the underlying principles are simple. What you consider useful or junk may depend on your race, class, character level or other similar details; and conditionals help you apply rules only when they are appropriate. Each conditional statement evaluates as either TRUE (1) or FALSE (0); if a conditional that evaluates as FALSE is encountered, all rules that follow it are ignored until the next TRUE conditional is reached. Conditional lines always begin with the characters ?:, followed by a (rather cryptic looking) expression that the game will evaluate. Let's look at an example. Remember Scenario #1 above when we added lines to destroy average equipment? I said you might not actually want them, unless your character was advanced enough. Suppose you consider level 20 advanced enough? ?:[GEQ $LEVEL 20] !average common weapons !average common armors ?:1 Notice there are two lines colored in violet, each beginning with ?:. These are the conditionals; the first includes a funny-looking expression while the second one is much simpler, just ?:1. The first conditional might or might not evaluate as TRUE; it depends on the value of $LEVEL (which you probably guessed is your current character level) and whether or not it is >= 20. GEQ stands for greater than or equal to, and 20 is just a number. The order ([GEQ $LEVEL 20] instead of, say, $LEVEL GEQ 20 or even $LEVEL >= 20) is because GEQ is this expression's function, and $LEVEL and 20 are arguments for it. In contrast, ?:1 is easy. It evaluates as... well, 1! And as we already noted, 1 means TRUE; so ?:1 flips the "ignore rules" switch back off, and effectively marks the end of the area to which the previous conditional applies. Here's another example: ?:[OR [EQU $CLASS Mage High-Mage Sorcerer] [EQU $RACE Beholder Lich] ] wizardstaff ?:1 That's a more complicated expression, but you can probably figure it out: it's TRUE if your class is either a Mage, High-Mage or a Sorcerer; or if your race is either a Beholder or a Lich. So, we have expressions composed of functions (like GEQ and OR), variables (like $RACE and $LEVEL), literals (like Mage and Sorcerer) and brackets. What are the functions and variables we can use? Function Explanation IOR Inclusive Or: [IOR a b c ...] is TRUE if the value of any subexpression a, b, c, ... is TRUE. OR Same as IOR. (If you are a programmer or a mathematician you might expect there to be a XOR function, but there isn't!) AND Logical And: [AND a b c ...] is TRUE if the values of all subexpressions a, b, c, ... are TRUE. NOT [NOT a] is TRUE if a is FALSE, and vice versa. Use this when you want to take an action when something is not true. EQU [EQU v a b c ...] is TRUE when the value of v is one of the values a, b, c, ... Comparison is by string. Typically, you use this with v being a built-in variable expression like $CLASS (see below), and the remaining arguments being strings to test like Mage or Sorcerer. Note that string literals are not quoted and therefore may not contain spaces. Hyphenate names with spaces (Filthy-Rag instead of Filthy Rag) if necessary. LEQ [LEQ v a] is TRUE when the integer value of v is less than or equal to the integer value of a. Note that while EQU treats its arguments as strings, LEQ treats them as numbers. GEQ [GEQ v a] is TRUE when the integer value of v is greater than or equal to the integer value of a. Note that while EQU treats its arguments as strings, GEQ treats them as numbers. Variable Explanation $RACE Returns the name of your race; for example, Snotling or High-Elf. $CLASS Returns the name of your class; for example, Warrior-Mage or Mindcrafter. Note that if you are playing in Monster mode, then this variable always returns Monster, while $RACE returns the actual monster race you are playing, such as Lich or Dragon. $SUBCLASS Returns the name of your subclass, if any. This could be, say, Yeqrezh on a Disciple or Evil Bias on a Gray-Mage. $SPECIALITY Returns the name of your speciality, for example Axes on a Weaponmaster or Potions on a Devicemaster. Returns none for all classes except those two. $REALM1 Returns the name of your first realm, if any; for example, Chaos or Sorcery. If the player does not have a first realm, then this variable returns none. $REALM2 Returns the name of your second realm, if any; for example, Life or Death. If the player does not have a second realm, then this variable returns none. $LEVEL Returns your current level. Typically, you combine this with GEQ or LEQ to test the level against a threshold, such as [LEQ $LEVEL 34]. $SELLING Returns Off if you have turned the no_selling option on, and On otherwise. $MONEY Returns the amount of gold the player has. Like $LEVEL, use this with GEQ or LEQ to test whether your player is rich or poor. All variables begin with a $ character to distinguish them from string literals. Literal Explanation Number Numbers are written like 105 or 32. String Strings are written like High-Mage or Beholder, and may not contain spaces. Using the Editor The editor should not be too hard to use, and you can probably figure things out on your own. Like any text editor, you move the cursor about with the arrow keys and then type when you have located the correct position. Advanced things (and easy things that slip your mind) can be done through the ESC menu: (a-j) Command: #####+---------------------------+####### # Con| a) Help | #####| b) Quit without save ^Q |####### mushr| c) Sa+----------------------------------+ ~mush| d) Re| a) Left (Left Arrow key) ^B | | e) Lo| b) Down (Down Arrow key) ^N | ?:[EQ| f) Ed| c) Up (Up Arrow key) ^P | ~mush| g) Se| d) Right (Right Arrow key) ^F | ?:1 | h) Mo| e) Beginning of line ^A | | i) In| f) End of line ^E | ?:[LE| j) Ad| g) Page up (PageUp key) ^O | potio| k) Ad| h) Page down(PageDown key) ^L | ?:1 | l) Ke| i) Top (Home key) ^T | potio| m) Co| j) Bottom (End key) ^U | potio+------+----------------------------------+ potions:heroism potions:speed#!kq potions:giant strength#!k potions:enlightenment potions:of strength#!k ------------------------------------------------------------------------------- This line is a comment. Here, you can clearly see what commands to use to move the cursor about, as well as backup keys in case normal keys like arrows somehow fail. Note that the editor automatically colors each rule line according to the syntax of the expression. Sometimes the text displayed is not exactly the same as the rule you actually typed in (adjectives might be shuffled, for instance); but the meaning will be the same. To avoid confusion, the line your cursor is on is never syntax-colored and always displays exactly what you typed. The Easy Destroyer If, after reading all of the above, you decide that the Mogaminator is too much for you to handle, you may instead use a simpler system to manage objects: the Easy Destroyer. This system is configured via options (see [j]); the option destroy_items turns the Easy Destroyer on and off. Using the Mogaminator and the Easy Destroyer side-by-side is recommended if and only if you have the always_pickup option on. If you have turned on the Mogaminator but don't like what it's doing, you can use the no_mogaminator option to turn it off, or the leave_mogaminator option to limit object destruction to complete junk only. Using always_pickup also disables item destruction by the Mogaminator while still allowing the Easy Destroyer. Reference Tables This section will give all the nitty-gritty syntax details for the Mogaminator. But first, where are those preference files located anyway? The default preferences are initialized from lib/pref/pickpref.prf; so if you want to edit the default preferences for all characters, this is the file to edit. You can also create your own personal default preferences at /lib/user/pickpref-UserDefault.prf; this has the advantage that you don't need to overwrite the original defaults, and can go back to them easily if you start disliking your changes. (Another advantage of the user defaults is that you can set and edit them in-game, which you cannot do with the global defaults.) Once you activate the Mogaminator, your preferences are stored in a separate file in a system-dependent location. On Windows, they will be stored at lib/user/pickpref-NAME.prf, while on Linux they might be moved to ~/.angband/FrogComposband/pickpref-NAME.prf (outside the game's directory structure). Here, NAME is replaced with your player's current name. So if you want to edit your character's preferences using an outside text editor, this is the file you need to change. It's usually simpler to just use the in-game editor; but if you do edit preferences outside the game while you are playing, be sure to use the $ command to force the game to reload the preference file. The promised reference tables follow below... enjoy! Table I: Line Types in the Editor Type Explanation Comment These lines begin with a # and are ignored by the system. Conditional These lines flip the global processing switch ON and OFF. If the expression evaluates to TRUE, then the switch is turned ON and any subsequent rules will be included. If the expression evaluates to FALSE, the switch is turned OFF and any subsequent rules will be ignored until the next TRUE conditional is reached. See [k] above for details. Rule Every other line, unless it is blank, is a rule. The syntax of a rule is described in the following 5 tables. Table II: Rules: Syntax Rules have one of the following two syntactic forms: [Actions] Adjectives* Noun Special-Clauses* [:Search-String] [#Inscription-String] [Actions] Search-String [#Inscription-String] Square brackets denote optional syntactic elements. * is the Kleene-Star and indicates that 0 or more of the preceding syntactic elements may be specified. All rules must be specified on a single line in your preference file. Syntactic Element Explanation Actions The "what to do if this rule matches" part. Uses one or more of the action letters described in the next table. If this element is omitted, the action defaults to pick up. Adjectives These modify nouns, further narrowing down the set of objects that will match the rule. Noun A single noun is always specified for the first syntactic form and indicates the broad class of objects to which this rule shall apply. Special Clauses Further refinements, discussed below ([l]). They resemble adjectives in that they modify nouns, but unlike adjectives they involve numerical comparison of object attributes. They also always follow the noun, while adjectives precede the noun. Search String This is a free-form text value to compare against the object's name. Comparison is by string and is case-insensitive. Two special characters, ^ and $, indicate the matching string must be at the beginning or end (respectively) of the object's name; for example, ^foo will only match objects whose names begin with foo, so foobar matches it but barfoo does not. Similarly, bar$ only matches objects whose name ends with bar. Finally, note that object names are always in the singular; so, for example, Seeker Bolt would work for a string match, but Seeker Bolts would always fail. Inscription String This is a free-form text value that will be automatically inscribed on any object matching this rule. If this seems complicated, study the default preferences and you will soon figure things out. Table III: Rules: Action Letters Letter Type Explanation ! Primary Destroy ; Primary Prompt to pick up ~ Primary Leave on the floor Primary Pick up - assumed if you fail to provide an alternative primary action letter. There is no specific action letter for this action, it is simply assumed unless overridden. ( Secondary Hide in M map ? Secondary Automatically identify this item, provided you have scrolls or staves of Identify. # Terminal Auto-inscribe matching objects with whatever text follows this key. Note that Primary and Secondary action letters must be placed at the beginning of a rule line, while Terminal action letters must be placed at the end of a rule line. Every rule must have one Primary action (which is assumed to be Pick Up if nothing else is specified). It can have 0 or more secondary actions, and the sole Terminal action is also optional. Table IV: Rules: Nouns Noun Explanation Items Applies to everything. This is useful for very general rules, such as ~?unidentified items to automatically identify, but leave on the ground, everything not yet identified; or even items to pick everything up! The noun items is implicitly assumed if no other noun is specified. Weapons Applies to all melee weapons (including diggers), but not to missile weapons. Favorite Weapons Applies to all weapons, including shooters, that your class likes. For example, Weaponmasters specialize in a given type of weapons, such as Axes or Crossbows; whatever their speciality is, this "noun" will apply to these preferred items. Note that the game considers favorite weapons a noun, not an adjective followed by a noun. Hafted Weapons Applies to all hafted weapons like Maces, Flails and War Hammers; these weapons are preferred by Priests. Like the Favorite Weapons "noun" above, the Mogaminator views this as a single noun, not an adjective followed by a noun. Diggers Applies to all digging implements, such as shovels, mattocks and picks. Shooters Applies to anything that goes in the shooter shot, including slings, bows, crossbows, harps and guns. Ammo Applies to all ammunition for missile weapons: arrows, pebbles, shots and bolts. Armors Applies to all forms of armor (for more specific nouns, see below): Suits Applies to body armor. Shields Applies to shields. Cloaks Applies to cloaks. Helms Applies to helmets and crowns. Gloves Applies to gloves. Boots Applies to boots. Wands Applies to wands. Staves Applies to staves (the magical device kind, not the quarterstaff kind!). For example, try staves:healing or staves:speed. Rods Applies to rods. Potions Applies to potions. (Watch out - many potion names, like Potion of Strength and Potion of Restore Strength, partially match each other.) Scrolls Applies to scrolls. Rings Applies to rings. Amulets Applies to amulets. Lights Applies to anything that goes in the light source slot. Spellbooks Applies to all spellbooks. If you are a non-caster (and non-seller) you can specify !spellbooks with impunity, but as a book caster you probably want to combine this with adjectives. Junk Applies to complete junk like broken sticks. Also covers statues (which are potentially sellable); use !worthless junk to exclude them. Corpses Applies to corpses, which are potentially useful; Possessors can possess them, Igors cut them apart, some demons eat humanoid corpses, and wanted corpses can be turned in at the Bounty Office. Skeletons Like corpses, you may turn in wanted skeletons at the Bounty Office. Archers may also use skeletons to make arrows and bolts. If you are using keywords to build a match predicate, then you must specify exactly one noun, but may use as many adjectives as you like. Table V: Rules: Adjectives Because there are so many adjectives, they are grouped here by kind. Object Knowledge Unsensed Applies to objects that have not yet been identified or pseudo-identified. Unidentified Applies to objects that have not yet been identified (e.g. ?unidentified items to auto-identify everything). Unaware Applies to objects whose flavor has not yet been identified. Identified Applies all objects that have been identified. *Identified* Applies to fully identified objects, and is rarely needed. Object Quality Average Applies to all average items. Some players like to combine this with the ! action letter quite early; but that can be inconvenient if you are looking for a reforge base item. Good Applies to all good items. Ego Applies to all excellent objects. See [m] for more information. Artifact Applies to all artifacts. See [n] for more information. Cursed Applies to all cursed items. Use sparingly; cursed items can be good, and !worthless items catches the real junk. Nameless Applies to all objects that are neither artifacts nor ego items. Rare Applies to all objects in a specific, hardcoded list of object types; for example, Blades of Chaos and Maces of Disruption are rare, as are all dragon armor pieces including dragon scale mail. Common Applies to all objects that are not rare; so a Long Sword is common, but a Blade of Chaos is not. Worthless Any object whose value is 0 is considered worthless. Watch out a bit, though: for example, corpses are "worthless", but you still want to keep some of them. The default preferences have !worthless items at the very bottom, below rules that protect useful worthless things. Icky Icky items are items unsuitable for your class; they may be an Icky Wield or cause other class-specific penalties. Object Attributes Dice Boosted When used with weapons or shooters, this adjective indicates that the object's damage dice or damage multiplier are higher than usual for the object kind. See the Special Clauses below for more information about matching on an object's attributes. Spellbook Adjectives Unreadable This will match spellbooks that you cannot use, either because you are playing a class that does not have realms or because the book does not belong to a realm you selected. First Realm's Applies to books from your primary magic realm, if any. Second Realm's Applies to books from your secondary magic realm, if any. First Second Third Fourth Each realm of magic has four spellbooks; these adjectives refer to each of these books by number. Usually, the first and second books are cheap, while the third and fourth are valuable. Corpse Adjectives Wanted Combine with corpses or skeletons to indicate the remains of a wanted monster. Unique Combine with corpses or skeletons to indicate the remains of a unique monster. (Maybe you're a collector?) Human Some characters use humanoid corpses either as food, or as part of a ritual to summon a powerful demonic ally. For these situations, add a rule like ~human corpses to your preferences, though ~special items will also work. Miscellaneous Collecting Collecting items matches stackable objects identical with objects already in your pack. Special Special items are objects your race or class needs; objects that are usually considered junk by default. For example, some characters receive scant sustenance from normal food and must consume humanoid corpses (yum!). Daemon casters use corpses for various spells. Archers use skeletons to make their own ammo. Beastmasters and Cavalry actually enjoy wands of Haste Monster. Such special scenarios are handled with this adjective. Note that this is a meaning completely distinct from the object feeling {special}, which refers to artifacts. Unusable Applies to wearable items you currently have no equipment slots for. Especially handy in Monster Mode - still, use with some care in case you acquire new slots over time... Table VI: Rules: Special Clauses In the following clauses, N refers to a digit (0-9); the sequence NN means you may type one or two digits, and can therefore enter any number between 0 and 99. Analogously, NNNNNN allows numbers between 0 and 999999. If you enter too many digits, the parser will not recognize your special clause, and you will get unsatisfactory results from your rule. Special Clause Explanation More Dice Than NN This clause applies to weapons only, and is true whenever the maximum possible damage exceeds the number you enter. For example a (2d5) weapon will match more dice than 9 but will fail to match more dice than 10. More Bonus Than NN An object's bonus is here the largest of its pval, to-hit, to-dam and to-AC. For example, rings more bonus than 9:speed will pick up rings of speed (+10) or better, but will not match other rings of speed; and suits more bonus than 19:power dragon says that you would quite like a Power Dragon Scale Mail, but only if its to-AC bonus is +20 or better! More Level Than NN This clause is intended to be used on corpses so that Possessors can manage the mountains of dead bodies they create. You can also use it with other objects, in which case it corresponds to the level of the object, or its ego type. For devices, it matches the power level of the device. More Charges Than NN Intended for magical devices; maybe you already have a Staff of Cure Wounds with 20 charges and consider anything smaller than that to be junk. More Weight Than NN Some classes have weight restrictions on armor, like Monks, Scouts and Ninjas. Other classes, like Maulers, prefer very heavy weapons. This clause matches against the weight of the object, in pounds; so weapons more weight than 39 will match weapons weighing at least 39.1 lbs. More Value Than NNNNNN This clause matches against the known value of the object. Use with care, since unknown or even un-*identified* objects may have "known" values lower than the actual value. Table VII: Conditionals: Syntax Conditional statements have the following syntactic form: ?:Expression Conditional expressions use the following (partial) grammar: Expression := Literal | Variable | [Function Expression*] Function := IOR | OR | AND | NOT | EQU | LEQ | GEQ Variable := $RACE | $CLASS | $REALM1 | $LEVEL | $MONEY | ... Literal := 23 | 52 | Rage-Mage | High-Elf | ... Note that unlike above, square brackets are part of the syntax of expressions and do not indicate optional elements in the grammar. Rather, function application expressions are always surrounded with square brackets. When the expression on a conditional line evaluates to FALSE or 0, then any subsequent rules will be ignored. When the expression evaluates to TRUE or non-zero, then any subsequent rules will be applied. See [o] above for details. Table VIII: Conditionals: Functions Function Explanation IOR Inclusive Or: [IOR a b c ...] is TRUE if the value of any subexpression a, b, c, ... is TRUE. OR Same as IOR. AND Logical And: [AND a b c ...] is TRUE if the values of all subexpressions a, b, c, ... are TRUE. NOT [NOT a] is TRUE if a is FALSE, and vice versa. Use this when you want to take an action when something is not true. EQU [EQU v a b c ...] is TRUE when the value of v is one of the values a, b, c, ... Comparison is by string. Typically, you use this with v being a built-in variable expression like $CLASS (see below), and the remaining arguments being strings to test like Mage or Sorcerer. Note that string literals are not quoted and therefore may not contain spaces. LEQ [LEQ v a] is TRUE when the integer value of v is less than or equal to the integer value of a. Note that while EQU treats its arguments as strings, LEQ treats them as numbers. GEQ [GEQ v a] is TRUE when the integer value of v is greater than or equal to the integer value of a. Note that while EQU treats its arguments as strings, GEQ treats them as numbers. Table IX: Conditionals: Variables Variable Explanation $RACE Returns the name of your race; for example, Snotling or High-Elf. $CLASS Returns the name of your class; for example, Warrior-Mage or Mindcrafter. Note that if you are playing in Monster mode, then this variable always returns Monster, while $RACE returns the actual monster race you are playing, such as Lich or Dragon. $SUBCLASS Returns the name of your subclass, if any. This could be, say, Yeqrezh on a Disciple or Evil Bias on a Gray-Mage. $SPECIALITY Returns the name of your speciality, for example Axes on a Weaponmaster or Potions on a Devicemaster. Returns none for all classes except those two. $REALM1 Returns the name of your first realm, if any; for example, Chaos or Sorcery. If the player does not have a first realm, then this variable returns none. $REALM2 Returns the name of your second realm, if any; for example, Life or Death. If the player does not have a second realm, then this variable returns none. $LEVEL Returns your current level. Typically, you combine this with GEQ or LEQ to test the level against a threshold, such as [LEQ $LEVEL 34]. $SELLING Returns Off if you have turned the no_selling option on, and On otherwise. $MONEY Returns the amount of gold the player has. Like $LEVEL, use this with GEQ or LEQ to test whether your player is rich or poor. All variables begin with a $ character to distinguish them from string literals. Note that some variables allowed by edit files are not allowed here, and some variables that are allowed here (like $SYS and $KEYBOARD) are unlikely to apply and so not documented. Table X: Conditionals: Literals Literal Explanation Number Numbers are written like 105 or 32. String Strings are written like High-Mage or Beholder. Note that string literals are not quoted and therefore may not contain spaces; hyphenate if necessary (Filthy-Rag for the Filthy Rag race). -- Original : PosChengband 4.0.0 Updated : FrogComposband 7.1.liquorice