Outfits

I’m trying to come up with a way to define outfits for given people – their adventuring outfit, their traveling outfit, their reveling outfit, their relaxing outfit. More outfits could be defined – a courting outfit, for example.

A few questions:

  1. Is there a way to define an outfit as a kind? I’m not seeing a way. It would be a kind that’s a list of portable objects that you either wear, “stow” in a carried container, carry over your shoulders/back, or “wield” in your hands.

  2. How would you relate people to their outfits?

  3. Can activities and actions be defined that operate on lists of things (an outfit being such a list)? What I want to do is define actions to don, doff and stow an entire outfit. The items would need to be “handy” – if not currently carried, then in the same room and accessible.

Ultimately what I want is to use these activities and actions, to succinctly specify/allow

  • When bedding down to sleep, a person doffs (or stows) their current outfit and puts on their sleeping outfit.

  • When arising from sleep, a person doffs (or stows) their current outfit (most likely their sleeping outfit but could be any outfit) and dons the appropriate outfit for the scene / region. I.e. if they are traveling, they don their traveling outfit. If they are currently “adventuring” in a dungeon, castle, or whatever, they don their adventuring outfit.

  • If a battle starts while the party is resting, other party members automatically attempt to don their adventuring / combat outfit.

  • Allow the player to specifically don, doff, or stow a named outfit that is related to them (e.g. “don traveling outfit”, “don courting outfit”).

OK, this is starting to come together in my mind (I’ve just gotten back to writing in Inform 7 after about a month, and before that I was just beginning to learn it).

Outfits can be a kind of object, and have a list of objects which are the articles. Outfits can also have an occasion, which will be a kind of value (adventuring, sleeping, traveling, etc). I can then also relate one person to many outfits.

The next challenge is to tie outfit-articles to an outfit-action and outfit-article-action. What I mean by that is outfits will be operated on by actions (“outfit-actions”), which will in turn execute the associated outfit-article-action on each outfit-article in the outfit. E.g. if an adventuring outfit includes (among other things) a breastplate, a backpack and a rope initially stowed in the backpack, then donning the adventuring outfit should put the breastplate on your chest, put the backpack on your back, and put the rope in the (worn) backpack.

I guess I can track that all with tables, but is there a way to do it just by defining some more abstract object kinds and some relations? Can a relation relate two other relation instances, to make a three-way relation? I.e. relation1 ties A to B, relation2 ties B to C, and relation3 ties relation1 to relation2? And also guarantee that one thing (B in this example) is in both of the relations that relation3 is tying together? Or should I make relation1 and relation2 be object kinds instead of true relations that simply have their “related objects” as properties, and then just relate these two object kinds with a single relation?

So, what I want is something like this. The action properties are not assigned correctly – I need to figure out how to specify them correctly. But assuming that can be done, am I on the right track here? I’m also assuming that I’ll write additional actions to let articles be added or removed to outfits dynamically, during the game.

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.

An outfit-article is a kind of object.
Every outfit-article has an object called article.
Every outfit-article has an action called donning-action. The donning-action is usually “put on [article]”.
Every outfit-article has an action called doffing-action. The doffing-action is usually “take off [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 to various outfits.
The verb to outfit-own means the outfit-owning relation.

my-breastplate is a thing.
my-backpack is a container.
my-rope is a thing.

my-breastplate-outfit-article is an outfit-article. The article is my-breastplate.
my-backpack-outfit-article is an outfit-article. The article is my-backpack.
my-rope-outfit-article is an outfit-article. The article is my-rope. The donning-action is “insert [article] into my-backpack”. The doffing-action is “”.

my-adventuring-outfit is an outfit.
The occasion is adventuring-occasion.
The outfit-articles are { my-breastplate-outfit-article, my-backpack-outfit-article, my-rope-outfit-artcle }.

Bob is a person. [The player is Bob.]
Bob outfit-owns my-adventuring-outfit.

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]

This looks like a good start, and the stored actions are what I needed to get further. I knew they existed, but hadn’t delved into them yet.

For cases where all articles aren’t handy, that should be OK when donning outfits; at most, we might want it to optionally report something like “by golly, I can’t find my fedora” when doing something like donning your traveling outfit, and continue to put on what happens to be handy. Often the donning and doffing of outfits will happen through AI, so missing articles are OK.

There may be cases where donning and doffing outfits should always succeed, regardless of issues with individual articles. In other cases, it should probably cause the whole action to fail. It wouldn’t be good for the game to proceed with actions that require successful donning or doffing in order to succeed in the next action. I’ll have to think about this …

I’ll eventually support ways to dynamically define outfits during the game. I.e. have a simple way to say (in simpler terms) “what I’m wearing and carrying now is the new definition of my adventuring outfit”. And have support for your “current outfit”, which is everything you happen to be wearing or carrying, possibly except some essentials that you always want to keep on your person.

I’m FINALLY getting back to dabbling with Inform after about 8 months.

Since any thing can be part of an outfit, I didn’t want to make the donning and doffing actions properties of every thing. So, I’m trying to use relations to associate the actions to things.

The point where I’m getting hung up is in referring to the other side of a relation. Note the lines marked as not compiling. I swear they were compiling months ago before I upgraded to 6M62, since I had to put in the check about the action being the waiting action for some reason while previously testing …

Outfit-choosing relates one person to one outfit.
The verb to outfit-choose means the outfit-choosing relation.
The verb to be outfit-chosen by means the reversed outfit-choosing relation.

Outfit-accessory-donning-prescribing relates one action to one thing.
The verb to donning-prescribe means the outfit-accessory-donning-prescribing relation.

Outfit-accessory-doffing-prescribing relates one action to one thing.
The verb to doffing-prescribe means the outfit-accessory-doffing-prescribing relation.

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.

Carry out an actor outfit-donning something (this is the donning an outfit dons all its accessories rule):
	let the-outfit be the noun;
	say "DEBUG: [Actor] outfit-donning [the-outfit][command clarification break]";
	repeat with accessory running through the things accessorizing the-outfit:
		if the accessory is not donning-prescribed by any action:
			next;
		let the-donning-action be an action;
		now the-donning-action is the action that donning-prescribes the accessory; [THIS LINE WON'T COMPILE]
		if the action name part of the-donning-action is the waiting action:
			next;
		say "DEBUG: trying [the-donning-action][command clarification break]";
		try the-donning-action;
	continue the action.

When play begins:
	repeat with outfitter running through PCs:
		if the outfitter outfit-chooses something:
			let the-chosen-outfit be an outfit;
			now the-chosen-outfit is the outfit that is outfit-chosen by the outfitter; [THIS LINE WON'T COMPILE]
			say "[printed name of outfitter] suit[s] up...";
			repeat with accessory running through the things accessorizing the-chosen-outfit:
				now the accessory is in the location;
				say "DEBUG: [accessory] is now here[command clarification break]";
			try the outfitter outfit-donning the-chosen-outfit;
	continue the action. 

How do I express things like “the action that donning-prescribes the accessory” and “the outfit that is outfit-chosen by the outfitter”?

This all seems like a very complicated way to implement outfits. I’d make an outfit a kind of thing that has a list of wearable things; then, if a player tries to “wear/take off [outfit]”, redirect the action to the listed wearable things.

In general, you can do things like this by saying “a random outfit that is outfit-chosen by the outfitter” rather than “the outfit that is outfit-chosen by the outfitter.” Inform doesn’t know that there must be one and only one, so it doesn’t accept “the…” (Though I’m not sure that “a random…” works for stored actions.)

However, in this case it looks like you are (properly!) using an if-clause to test that these things exist before trying to talk about them. In that case, you should just be able to assign the value to a temporary value in the if-clause rather than trying to find it again later:

[code]Outfit-choosing relates one person to one outfit.
The verb to outfit-choose means the outfit-choosing relation.
The verb to be outfit-chosen by means the reversed outfit-choosing relation.

Outfit-accessory-donning-prescribing relates one action to one thing.
The verb to donning-prescribe means the outfit-accessory-donning-prescribing relation.

Outfit-accessory-doffing-prescribing relates one action to one thing.
The verb to doffing-prescribe means the outfit-accessory-doffing-prescribing relation.

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.

Carry out an actor outfit-donning something (this is the donning an outfit dons all its accessories rule):
let the-outfit be the noun;
say “DEBUG: [Actor] outfit-donning [the-outfit][command clarification break]”;
repeat with accessory running through the things accessorizing the-outfit:
if the accessory is donning-prescribed by an action (called the-donning-action):
if the action name part of the-donning-action is the waiting action:
next;
say “DEBUG: trying [the-donning-action][command clarification break]”;
try the-donning-action;
continue the action.

When play begins:
repeat with outfitter running through PCs:
if the outfitter outfit-chooses something (called the-chosen-outfit):
say “[printed name of outfitter] suit[s] up…”;
repeat with accessory running through the things accessorizing the-chosen-outfit:
now the accessory is in the location;
say “DEBUG: [accessory] is now here[command clarification break]”;
try the outfitter outfit-donning the-chosen-outfit;
continue the action.[/code]

I haven’t checked this (in particular, I’ve never tried this for stored actions), so I’m not sure it might work.

Another thing is that you can give a name to the right side of a various-to-one or one-to-one relation, which will allow you to use “the.” I think if you wanted to go that route you would have to flip your relations, like this:

Outfit-accessory-donning-prescribing relates one thing to one action (called the donning action). The verb to donning-prescribe means the outfit-accessory-donning-prescribing relation.

Then you could talk about “the donning action of the noun.” (Though again again, I haven’t tried this for stored actions.)

All this is irrespective of Chin’s advice that this might not be the best way to implement outfits. (Or should I call you Chin Kee?)

Clothing is a neat thing to get complicated with, but unless you have a really specific reason to make lots of individual clothing pieces which have to come together to form an outfit (like a game about a fashion show, perhaps) it might be a lot more work for something that ends up more complicated for the player to interact with. Putting on and taking off clothing pieces becomes tedious as you’ve discovered since you’re trying to simplify it. The answer might be to not complicate it in the first place.

If you want outfits, I’d suggest making the outfit one item that the player wears to dress completely, and make a rule so the player can only wear one outfit at a time.

[code]Clothing is a kind of thing. Clothing is wearable. Understand 'clothes/clothing" as clothing. An outfit is a kind of clothing. Understand “outfit” as an outfit.

Check wearing an outfit:
if the player wears an outfit (called O):
say “You’ll need to take off [the O] before putting on a different outfit.” instead.[/code]

Then if you want variation, make individual pieces of clothing the player can add to an outfit piecemeal as desired by the plot or to raise their armor-class or whatever. You could make different kinds of additional clothing such as

[code]A hat is a kind of clothing.

Check wearing a hat:
if the player wears a hat (called H):
say “(First taking off [the O][command clarification break]”;
try silently taking off O;[/code]

You could specify a “necklace” kind, but allow the player to wear multiples as they could in real life.

You could even define clothing pieces that won’t work with specific outfits:

Check wearing the lapel pin: if the player wears suit of armor: say 'You can't pin that on metal.' instead.

Every turn when the player is in Church: if the player does not wear their Sunday best: say "You realize you aren't dressed for church, and escape to the parking lot..."; now the player is in parking lot; if the player wears a hat and the player is male: say "You realize you shouldn't be wearing your hat indoors, so you take it off."; try silently taking off a random hat worn by the player.