I need to create the following effect, and am at a loss for how to approach it:
1. There will be a thing (we’ll call it a widget). There will be two widgets in the world, one of which starts out offstage.
2. A widget can be in one of two states, frobodlicated or unfrobodlicated. However, I don’t want this to be too obvious to the player until he figures out how to frobodlicate a widget; therefore, I want an unfrobodlicated widget to be described as (and referred to by the player in commands) simply as a widget.
3. When two widgets are in the same place and the same state, I need them to be indistinguishable. Thus, for example, if the player is carrying two widgets which are both frobodlicated, I want them to appear in his inventory as “2 frobodlicated widgets”; if he then types “drop frobodlicated widget” it will drop one without the necessity (or even the possibility) of specifying which one.
4. If the two widgets are in different locations, I need to be able to specify which one is referred to. In particular, when the trigger occurs to move the initially offstage widget onstage, I need to be able to specify that that is the one which gets moved, regardless of the state that the other one is in.
5. If the two widgets are in different states, I need to be able to distinguish them for all purposes. For example, if the player holds both and they are in different states, the inventory list would contain entries for “a frobodlicated widget” and “a widget”; if he then wants to drop (or do something else with) one of them, it would understand a reference to “widget” as the unfrobodlicated widget and a reference to “frobodlicated widget” as the frobodlicated widget.
I understand from the documentation that to create multiple indistiguishable widgets I would create widget as a kind, not a thing; each widget would then be implemented as an unnamed instance of the widget kind. However, I need to be able to distinguish them in certain situations (i.e., where they are in different places or different states). On top of this, I need to avoid the dreaded disambiguation loop problem where the printed (and understood) name of one item (the unfrobodlicated widget, which I want to appear as “widget”) is a subset of the name of another (the frobodlicated widget).
Frankly, I can’t figure out where to begin with this.
Any advice would be greatly appreciated.
Thanks.
Robert Rothman