Skip to content

Rule language

A rule is one line of text. It is what the addon saves, what the rule builder shows under As text, what a search box takes, and what a profile line carries. The builder writes it for you; this page is for reading it, typing it, or writing what the builder cannot.

rule = term / term / ... every term must hold
term = test a keyword and its value, or free text
| !term not
| ( rule | rule | ... ) any one of the alternatives
  • / means “and”: cat 4/pct <60 is armour and under 60% of its usual price.
  • | means “or”, and only inside parentheses: (wool | silk).
  • ! turns the next term around: !quality poor. Plain negation: a test that is false because a value is missing is true when negated, so !pct <60 also holds for an item with no usual price. To require one, say so: pct >=0/!pct <60.
  • Spaces around /, |, ! and the parentheses do not matter. Keywords and text are read in any case.

A test is a keyword, then its value. A keyword counts only as a whole word: required or ilvl40 is free text, not req or ilvl.

A term that is not a keyword is free text. It matches an item whose name holds it, or whose category, subcategory or slot is called exactly that, in your game’s language: linen, cloth.

name robe matches an item whose name holds “robe”, and nowhere else. Put the name in quotes when it holds /, |, !, ( or ), or begins or ends with a space: name "of the eagle". The quotes may follow name directly: name"of the eagle". Only /, | or ) can follow a quoted name.

quality rare, quality uncommon+ (that or better), quality common-rare (a range). The qualities, worst to best: poor, common, uncommon, rare, epic, legendary.

Item level: ilvl 40, ilvl 40+, ilvl 40-60, ilvl <60, ilvl <=60, ilvl >40, ilvl >=40. The comparison may touch the keyword: ilvl>=40.

Required level, written like ilvl: req <=30.

The unit price, against an amount of money: price <5g, price <=1g50s. It needs a comparison first: <, <=, > or >=.

The unit price as a percentage of the item’s usual price: pct <60, pct <=62.5. False when the item has no usual price.

What reselling at the usual price would leave after the auction house’s 5% cut, minus the price: profit >=1g. False when the item has no usual price.

One item by its ID: item 2589. For several, use alternatives: (item 2589 | item 2592).

The item’s category, by the game’s own number, which reads the same in every language: cat 2 (weapons), cat 4 (armour). A word instead of a number, such as cat armor, is matched against the category’s name in your game’s language; older rules were written that way, and the builder turns such names into numbers when it can.

The subcategory, as category and subcategory numbers: sub 4.1 (armour, cloth). A name works as for cat.

Where the item is worn, by the game’s equip location: slot INVTYPE_CHEST, written in any case. A robe counts as worn on the chest. A name works as for cat.

list <name>, a name of letters, digits, _ and -. The parser accepts it, but this version of the addon supplies no lists, so it never matches (and !list <name> always does).

usable, with no value. The parser accepts it, but this version of the addon does not tell the test whether you can use an item, so it never matches (and !usable always does).

Gold, silver and copper, in that order, each at most once: 5g20s3c, 50s, 3c. A decimal is allowed where it comes to whole copper: 1.5g is 1g50s. A bare number is gold: 5 is 5g. The addon saves the shortest form, without spaces (1g50s).

Each example is run through the addon’s own parser when these pages are built. “Saved as” is the text the addon keeps when it differs from what was typed.

RuleSaved asMeans
linenthe sameFree text: "linen" in the item's name, or a category, subcategory or slot named exactly linen.
name robethe same"robe" in the item's name, and nowhere else.
name "of the eagle"name of the eagleA name in quotes may hold spaces and the characters / | ! ( ). The quotes are kept only when they are needed.
quality rarethe sameExactly rare.
quality uncommon+the sameUncommon or better.
quality common-rarethe sameCommon, uncommon or rare.
ilvl 40-60the sameItem level 40 to 60, both included.
ilvl >=40ilvl 40+Item level 40 or more.
req <60req <=59Required level under 60.
price <5gthe sameA unit price under 5 gold.
price <= 1.5gprice <=1g50sA unit price of at most 1 gold 50 silver.
pct <60the sameUnder 60% of the item's usual price.
profit >=1gthe sameReselling at the usual price, after the auction house's 5% cut, would leave at least 1 gold over the price.
item 2589the sameThe item with ID 2589 (Linen Cloth).
cat 4/sub 4.1/pct <60the sameArmor, cloth, under 60% of its usual price. Categories are written by the game's own numbers.
slot invtype_chestslot INVTYPE_CHESTWorn on the chest, robes included.
(cat 2 | cat 4)/req <=30/pct <70the sameA weapon or armor, required level 30 or less, under 70% of its usual price.
(wool | silk)/price <3sthe sameWool or silk, under 3 silver each.
!pct <60the sameNot under 60% of its usual price. Also true for an item with no usual price yet.
pct >=0/!pct <60the sameHas a usual price, and is not under 60% of it.

The addon points at the character where the problem starts and says what it expected. For example:

RuleWhat the addon says
ilvl=40a level is a whole number, written like 40, 40+, 40-60, <60, <=60, >40 or >=40.
price 5gstart with a comparison, <, <=, > or >=, then the value.
quality shinyquality is poor, common, uncommon, rare, epic or legendary, written like rare, uncommon+ or common-rare.
price <5g20not an amount: write it like 5g20s3c, 1.5g, 50s or 5 (gold).
wool | silk| separates alternatives only inside ( and ).
(wool | silkthis ( is never closed.
name "robethis quote is never closed.
wool/a term is missing here.

Every message the parser can give:

  • Enter an amount, such as 5g20s.
  • An amount cannot be negative.
  • An amount cannot include a fraction of a copper.
  • Write gold, silver and copper in that order, each at most once.
  • Not an amount: write it like 5g20s3c, 1.5g, 50s or 5 (gold).
  • A term is missing here.
  • This ( is never closed.
  • This ) has no ( to close.
  • | separates alternatives only inside ( and ).
  • Expected / between terms here.
  • This quote is never closed.
  • Only /, | or ) can follow a quoted name.
  • <keyword> needs a value.
  • Usable takes no value.
  • Quality is poor, common, uncommon, rare, epic or legendary, written like rare, uncommon+ or common-rare.
  • A level is a whole number, written like 40, 40+, 40-60, <60, <=60, >40 or >=40.
  • The first value of this range is larger than the second.
  • Start with a comparison, <, <=, > or >=, then the value.
  • A percentage is a number of 0 or more, such as 60 or 62.5.
  • An item is its ID, a whole number such as 2589.
  • A list name is one word of letters, digits, _ and -.

Each condition of the rule builder is one term, joined with /:

ConditionComparisons offeredWritten as
Categoryis any ofcat
Subcategoryis any ofsub
Slotis any ofslot
Qualityat least, exactly, at most, betweenquality
Item levelbetween, at least, at mostilvl
Required levelbetween, at least, at mostreq
Priceat most, under, at least, overprice
Percent of usualunder, at most, at least, overpct
Profitat least, over, at most, underprofit
Namecontainsname
Itemis any ofitem
  • A list condition with several values becomes alternatives: Category “Weapon” and “Armor” is (cat 2 | cat 4).
  • not becomes !.
  • “at least” and “at most” on levels become 40+ and <=60; “between” becomes 40-60.
  • “under”, “at most”, “at least” and “over” on money and percent become <, <=, >= and >.

The builder cannot show free text, an “or” across different fields, groups inside groups, or a category, subcategory or slot written by a name that is not exactly one this game knows. Such a rule is kept and used, and edited as text.