Replacing inventory command, erroneously incl. what is worn

This has probably been answered before in various forms but I’m having a hard time searching for a solution to this.

In my game I want to list worn items only when the player examines themselves, because clothing is not super important but I still want them to have options to fiddle with it.

[code]The player wears an elaborate hat, a pair of stylish pants, a boring shirt, and green socks.

The player carries an enormous nacho.

Instead of taking inventory:
If the number of things carried by the player is 0, say “You are empty-handed.” instead;
Now all things carried by the player are marked for listing;
Say "You are carrying ";
List the contents of the player, tersely, as a sentence, including contents, listing marked items only;
Say “.”

Place is a room.

Test me with “actions / i / take off socks / i / wear socks / i”.[/code]

The inventory command in this test results in 1) not carrying any clothing, 2) carrying the socks you took off, and 3) still carrying the socks even though now you are wearing them.

I’m not sure why it’s inconsistent. The first inventory command should be just as wrong or correct as the third one. I know “list the contents of the player” would show worn things, but “listing marked items only” should take care of that, since we made a list of things carried by the player.

Putting “now nothing is marked for listing” at the end doesn’t help.

Is this just all wrong/backwards though? What’s the best way to do this?

Adding “Now all things worn by the player are not marked for listing” fixes it, but that seems silly to have to do.

Do I want to do something like “to list the contents of the player:”?

Is there a “list the things the player is carrying” so I don’t have to use contents?

Hey Uncle,

I think this does what you need (although I don’t like using instead rules for this sort of thing. I would just replace the two relevant carry out rules with new ones. That’s obviously up to you.):

[code]The player wears an elaborate hat, a pair of stylish pants, a boring shirt, and green socks.

The player carries an enormous nacho.

[added this:]
The description of yourself is “As good-looking as ever, sporting [a list of things worn by the player].”

Instead of taking inventory:
If the number of things carried by the player is 0, say “You are empty-handed.” instead;
Now all things carried by the player are marked for listing;
Now all things worn by the player are not marked for listing; [< added this]
Say "You are carrying ";
List the contents of the player, tersely, as a sentence, including contents, listing marked items only;
Say “.”. [< added a period after – don’t need too, just makes me feel safer]

Place is a room.

Test me with " actions/ i / x me / take off socks / i / x me / wear socks / i /x me / drop nacho / i".[/code]

HTH :slight_smile:

The problem is that the “marked for listing” property isn’t being reset between turns. That’s because it’s handled by the rules for looking, and not by the general turn sequence. (Try looking before you take inventory each time, and you’ll find things work differently.)

You could add “now everything is unmarked for listing;” at the start of your rule. That would probably work OK.

Skinny Mike, I did discover that line but as I said it seemed a little silly to me, and made me think I might be going about this the wrong way, or just missing one simple rewording that would fix all of it.

jrb, I had tried “now nothing is marked for listing,” but you’re right, it has to be “everything is unmarked for listing” and that also fixes the issue. And I get the logic there. “Nothing is marked for listing” is me adding nothing to the existing list, rather than erasing it. :astonished: I will probably go with that as the fix, it is cleaner.

Thank you both for the replies!

Incidentally, a (hacky but simple) way of doing this without totally rewriting the taking inventory rules would be:

The wardrobe is a container.
First carry out taking inventory:
      now everything worn by the player is in the wardrobe.
First after taking inventory:
      now everything in the wardrobe is worn by the player;
      continue the action.

That is a cool way to do it, however I did want to rewrite inventory so I could list as a sentence instead of a list.

That’s helpful though as another way of thinking about things. I’m working on commands for wear all and remove all, and want to avoid messages about every individual item, but “now” commands would skip that.