The 'listName', 'inventoryName', and 'wornName' give the names of state as displayed in room/contents listings, inventory listings, and listings of items being worn by an actor. This state name is displayed along with the item name (usually parenthetically after the item name, but the exact nature of the display is controlled by the language-specific part of the library).
The 'listingOrder' is an integer giving the listing order of this state relative to other states of the same kind of object. When we show a list of equivalent items in different states, we'll order the state names in ascending order of listingOrder.
ThingState : object
The idea is that you set up the object's "static" vocabulary with the *complete* list of words for all of its possible states. For example:
+ Matchstick 'lit unlit match';
Then, you define the states: in the "lit" state, the word 'lit' is in the stateTokens list; in the "unlit" state, the word 'unlit' is in the list. By putting the words in the state lists, you "reserve" the words to their respective states. When the player enters a command, the parser will limit object matches so that the reserved state-specific words can only refer to objects in the corresponding states. Hence, if the player refers to a "lit match", the word 'lit' will only match an object in the "lit" state, because 'lit' is a reserved state-specific word associated with the "lit" state.
You can re-use a word in multiple states. For example, you could have a "red painted" state and a "blue painted" state, along with an "unpainted" state.
'toks' is the *adjusted* token list used in matchName().
'lst' is a list of the objects being listed in this state. If we're only listing a single object, this will be a list with one element giving the object being listed. If we're listing a counted set of equivalent items all in this same state, this will be the list of items. Everything in 'lst' will be equivalent (in the isEquivalent sense).
Implementation of this is always language-specific. In most cases, this should do something along the lines of checking for the presence (in the token list) of words that only apply to other states, rejecting the match if any such words are found. For example, the ThingState object representing the unlit state of a light source might check for the presence of 'lit' as an adjective, and reject the object if it's found.
Modified in en_us.t:
Match the name of an object in this state. We'll check the token list for any words that apply only to *other* states the object can assume; if we find any, we'll reject the match, since the phrase must be referring to an object in a different state.