I took your example and messed with it a bit. The result still needs a lot of work, but maybe it will get you closer to where you want to be. It compiles, and the player can don and doff the adventuring outfit. See comments in the code for some trouble spots and suggestions.
[rant=Outfits (rough)][code]
[This occasion stuff isn’t incorporated into the example in any way yet]
An occasion is a kind of value.
The occasions are adventuring-occasion, traveling-occasion, sleeping-occasion, reveling-occasion, relaxing-occasion, courting-occasion, formalizing-occasion and ritualizing-occasion.
[Would be nice if we didn’t need this level of indirection (outfit-article → article).]
An outfit-article is a kind of object.
Every outfit-article has an object called article.
Every outfit-article has a stored action called donning-action.
[The commented-out code causes the noun part of the stored action to be an invalid value rather than the article of the outfit-article that we want. So, below, we enumerate the donning-action and doffing-action. Not ideal.]
[The donning-action is usually the action of wearing the article.]
Every outfit-article has a stored action called doffing-action.
[The doffing-action is usually the action of taking off the article.]
An outfit is a kind of object.
Every outfit has an occasion.
Every outfit has a list of outfit-articles called outfit-articles.
Outfit-owning relates one person (called the owner) to various outfits.
The verb to outfit-own means the outfit-owning relation.
[TODO; Probably want player’s inventory to look like:
You are carrying:
Your adventuring outfit (a rope, a backpack, and a breastplate)
What happens when player is carrying partial outfit, or only partially wearing outfit because of manual commands (like “wear backpack”)?]
The breastplate is wearable.
The backpack is a wearable container. Understand “pack” as backpack.
The rope is a thing.
my-breastplate-outfit-article is an outfit-article. The article is breastplate.
The donning-action is the action of wearing breastplate. [“the action of wearing the article” isn’t working here. Can only get this to work by explictly naming the object.]
The doffing-action is the action of taking off breastplate.
my-backpack-outfit-article is an outfit-article. The article is backpack.
The donning-action is the action of wearing backpack.
The doffing-action is the action of taking off backpack.
my-rope-outfit-article is an outfit-article. The article is rope. The donning-action is the action of inserting rope into backpack. The doffing-action is the action of removing rope from backpack. [Is there a way to specify no action? Default stored action is waiting, which produces “time passes” (as if the character stops undressing and spends a turn contemplating the rope in his backpack) during the doffing process.]
my-adventuring-outfit is an outfit.
The occasion of my-adventuring-outfit is adventuring-occasion.
The outfit-articles of my-adventuring-outfit are { my-breastplate-outfit-article, my-backpack-outfit-article, my-rope-outfit-article }.
Understand “adventuring outfit” or “outfit” as my-adventuring-outfit.
Tavern is a room. “A smoky tavern. Adventure awaits.”
[Objects weren’t accessible when the player was Bob. Maybe Bob needs to be transparent.]
[Bob is a person. The player is Bob.]
The player outfit-owns my-adventuring-outfit.
When play begins:
repeat with owned-outfit running through outfits:
let outfit-owner be the owner of the owned-outfit;
repeat with owned-outfit-article running through the outfit-articles of the owned-outfit:
now the outfit-owner carries the article of the owned-outfit-article.
Outfit donning is an action applying to one thing.
Understand “don [any outfit]” or “wear [any outfit]” or “put on [any outfit]” as outfit donning.
[Some issues with regular action definition because outfits are objects rather than things (“That isn’t available”; action tracing shows “failed the basic accessibility rule”; placing the outfit in scope doesn’t help) , so we do this instead of the usual check, carry out, report. Make them things even though they’re abstract concepts?]
[After deciding the scope of the player:
place my-adventuring-outfit in scope.]
before outfit donning:
[TODO: check preconditions. Right now we just get complaints about individual actions,
and the higher level outfit donning action continues despite the problem.]
repeat with owned-outfit-article running through the outfit-articles of the noun:
try the donning-action of the owned-outfit-article;
stop the action.
Outfit doffing is an action applying to one thing.
Understand “doff [any outfit]” or “remove [any outfit]” or “take off [any outfit]” as outfit doffing.
before outfit doffing:
[TODO: check preconditions. See above.]
repeat with owned-outfit-article running through the outfit-articles of the noun:
try the doffing-action of the owned-outfit-article;
stop the action.
Test me with “i / don outfit / i / doff outfit / i”
[/code][/rant]