ThingStateclass | thing.t[471], en_us.t[214] |
Superclass Tree | Subclass Tree | Global Objects | Property Summary | Method Summary | Property Details | Method Details |
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.
Modified in en_us.t[214]:
Language-specific modifications for ThingState.
class
ThingState : object
lightSourceStateOff
lightSourceStateOn
matchStateLit
matchStateUnlit
unwornState
wornState
listingOrder
listName_
stateTokens
findStateToken
inventoryName
listName
matchName
wornName
listingOrder | thing.t[504] |
listName_ | en_us.t[325] |
stateTokens | en_us.t[242] |
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.
findStateToken (toks) | en_us.t[293] |
'toks' is the *adjusted* token list used in matchName().
inventoryName (lst) | thing.t[494] |
listName (lst) | thing.t[488], en_us.t[316] |
'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).
Modified in en_us.t[316]:
get our name
matchName (obj, origTokens, adjustedTokens, states) | thing.t[520], en_us.t[250] |
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[250]:
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.
wornName (lst) | thing.t[501] |