Pockets and inventory

Hey all-
So my first game had no inventory, so I’m struggling to manage inventory now. The PC wears a uniform which has a pocket, and I want the contents of the pocket to show up in inventory, and I can’t make that happen.

The player wears a uniform. The description of the uniform is "A uniform.".

The pocket is part of the uniform. The pocket is a container. The description of the pocket is "A small flat pocket, suitable only for carrying pieces of paper in."

Something can be pocketable. Something is usually not pocketable.

A note is here. It is pocketable. The description is "a note.".

Check inserting something into the pocket:
	if the noun is pocketable:
		continue the action;
		now all things enclosed by the pocket are marked for listing; 
		say "That really won't work in the pocket, which is quite small and flat. It's really only suitable for carrying pieces of paper in.";
		stop the action.

I also tried

if the pocket encloses something:
		now all things enclosed by the pocket are marked for listing

I also tried

The pocket is the player's holdall, etc."

But no dice. Everything works and you can put the note in the pocket, but it doesn’t show up on taking inventory. And also, I can’t drop anything from the pocket, so I’ll need to make a special thing for that, and I just know there’s an easier, standard way to do this that I’m missing.
But of course the syntax eludes me and the documentation isn’t helping. What am I missing?

This is an interesting issue that I don’t have time to dig into now – sorry! But one piece of the puzzle is that I’m pretty sure “marked for listing” isn’t a permanent property of an object – rather, it’s set within the relevant action. So I think you’d need to modify another rule, maybe the inventory-taking one or some of the contents-listing rules for containers, rather than being able to just cue off inserting stuff into the pocket.

1 Like

What! You mean you’re doing unimportant stuff like parenting a small baby instead of answering my question?!


Check out the recipe book: 6.7. Inventory - especially the “Equipment List” example.

Probably the solution is to replace the inventory routine as in the example “Persephone”:

Instead of taking inventory: 
    say "[if the player carries something][We]['re] carrying [a list of things carried by the player][otherwise][We]['re] empty-handed"; 
    say "[if the player wears something]. [We]['re] wearing [a list of things worn by the player][end if].";
    if the player wears the uniform:
      if the pocket contains something:
         say "You've got [a list of things in the pocket] in your pocket."

Maybe something like

Use the serial comma.
The player is wearing the jacket.
The pocket is an open container. The pocket is part of the jacket.
There is lint in the pocket. There is a receipt in the pocket. There is a pen in the pocket.

Rule for printing inventory details of the jacket:
  say " (the pocket ";
  if the first thing held by the pocket is nothing begin;
    say "is empty";
    say "contains ";
    list the contents of the pocket, as a sentence, giving brief inventory information, tersely, not listing concealed items;
  end if;
  say ")";

test me with "i / get receipt / i / get pen / i / get lint / i".

which produces:

>test me
>[1] i
You are carrying:
  a jacket (the pocket contains lint, a receipt, and a pen)
>[2] get receipt
>[3] i
You are carrying:
  a receipt
  a jacket (the pocket contains lint and a pen)
>[4] get pen
>[5] i
You are carrying:
  a pen
  a receipt
  a jacket (the pocket contains lint)
>[6] get lint
>[7] i
You are carrying:
  a pen
  a receipt
  a jacket (the pocket is empty)

I saw Persephone while messing with this, but I have other things riding on whether or not the PC carries things, so I was dreading using an “instead of.” I have learned to fear “instead of” mightily- I know it will make me wail and cry sometime in the future.
Still, this would definitely work if I add an “instead of dropping,” too.

The serial comma is something I haven’t used yet. There’s so much stuff in the documentation, and without some experience using it, it’s often hard for me to see how the documentation’s examples are applicable to my needs. A lot of it blurs together without really sinking in.

So this is super helpful both with my immediate question and with helping me grok the general usefulness of the serial comma. Thanks as always!


The use serial comma option just determines whether there’ll be a comma before “and” in “lint, a receipt, and a pen”: it’s not crucial to functionality here. The two major US English style guides disagree on it: the Chicago Manual of Style endorses it; the AP Stylebook says not to use one.

So reasonable people can disagree on the usage, and it can fairly be considered a matter of taste. That said, everyone who doesn’t use it is wrong, and probably also a bad person.


What if the PC carries a container in a container in a container, and so on, for example, a note in an envelope in a wallet in a bag. Does I7 know recursive functions?

Sorry, it is a bit off-topic, but I couldn’t resist to ask about recursiveness in I7.

1 Like

Understandable, but “taking inventory” is one of the unique commands that usually isn’t going to cause problems with any other - as opposed to something like “Instead of going west…”

1 Like

Inventory already shows contents of containers and supporters recursively. (But examining an NPC doesn’t mention what they’re wearing or carrying by default, though their inventory is, in general, in scope.) It’s parts that aren’t accounted for automatically. And this is probably a reasonable choice because there could be a lot of reasons one could choose to use the incorporation relation, and you’d have to make a lot of assumptions about how they (and their potential contents) should be displayed.

Since it probably won’t come up much, special-casing the jacket and pocket like I did above is probably a more suitable approach in practice than trying to generalize it… but for some game, generalizing could be the right choice.

But, yes, I7 supports recursion. This works as you might expect:

i is initially 5.

To foo:
  say "[i] ";
  if i > 1 begin;
    decrement i;
    say "[line break]";
  end if.

To decide what number is fibo of (N - a number):
  if n < 3, decide on 1;
  decide on fibo of (N - 1) + fibo of (N - 2);

  when play begins:
    repeat with i running from 1 to 8 begin;
      say "[fibo of i] ";
    end repeat.

Wow, thank you! Now I wonder for what madness this could be used in an IF game!

I7 doesn’t just support recursive functions. It supports recursive rulebooks.

1 Like