Being Prepared
Now we've created the rules that will govern any specific jackets we might happen to put in our game: each one will always have one pocket, which will be able to contain no more than two things. The description of "a list of things" is text with a list, which we will learn about further in a few sections.
Next we might want to create the environment and an actual example of the jacket kind:
Notice that, since Inform has created a pocket for the hoodie, we can now refer to it by name in our source, giving it any additional properties we need to define. Here we simply put a few items into it.
Test me with "x hoodie / get hoodie / get knife / get map / i / put hoodie in pocket / put whistle in pocket / put map in pocket / put knife in pocket / i".
A dome made of two flexible rods and a lot of bright green ripstop nylon. It bills itself as a one-man tent, but you'd call it a two-dwarf tent: there is no way to arrange yourself on its square floor so that you can stretch out completely.
Your hoodie is balled up in the corner.
>(Testing.)
>[1] x hoodie
Both elbows are stained from yesterday's entrenching project.
The hoodie's pocket contains a Swiss army knife and a folded map.
>[2] get hoodie
Taken.
>[3] get knife
Taken.
>[4] get map
Taken.
>[5] i
You are carrying:
a folded map
a Swiss army knife
a hoodie
a whistle (being worn)
>[6] put hoodie in pocket
You can't put something inside itself.
>[7] put whistle in pocket
(first taking it off)
You put the whistle into the hoodie's pocket.
>[8] put map in pocket
You put the folded map into the hoodie's pocket.
>[9] put knife in pocket
There is no more room in the hoodie's pocket.
>[10] i
You are carrying:
a Swiss army knife
a hoodie
Notice that Inform automatically refuses to put the hoodie into its own pocket: as a default, a container cannot contain something of which it is itself a part.