"now the player drops everything"


I am working on Inform 7 and am fairly new to it, too.

I am trying to make a rule that causes the player to drop everything carried and worn, but I don’t know the right syntax.

I can make the player drop a specific item with, eg:

now the hooded cloak is in the location

but how do you move all the inventory items at once? (Moreover, without individually naming them.)

The scenario is that (player character) Prince Donovan changes into a (player) werewolf, as soon as he takes off the silver amulet he is wearing. The transformation works like a charm, bringing the werewolf from ‘nowhere’ to the location, making the werewolf the player, and sending Donovan to ‘nowhere,’ but I don’t know how to keep Donovan’s inventory items in the location (as he drops them during the transformation).

Here is the code:

After taking off the silver amulet: now the werewolf is in the location; [this is the line I need to figure out: now Prince Donovan drops... all???;] now the player is the werewolf; now Prince Donovan is nowhere; say "The pains are horrible. Hair grows everywhere. Your ears get pointy and your hearing acute.[paragraph break]You have turned into a werewolf."

Any help will be greatly appreciated.


Try something like

now everything enclosed by the player is in the location

(or Prince Donovan, instead of the player)

I’m not sure if that’s the proper syntax or not, but it seems to work when I try…

Edit: Actually, do what matt w said.

I think using “enclosed by” might not do quite what you want in some cases.

For example, suppose the player is carrying a locked box containing a key. After “now everything enclosed by the player is in the location”, you might find that the key is no longer in the box. (Though it didn’t seem to happen that way when I tried it, so maybe I’m missing something. Is it supposed to work that way? Since the key is enclosed by the player, I would expect it to end up in the location rather than merely enclosed by the location.)

As another example (and this one does have an actual problem when I try it), suppose you’ve decided to give the player parts, for example with “every person has a nose” or similar lines. (Or, “a head is part of the player” for a less general case.) Then after “now everything enclosed by the player is in the location” you’ll find that their nose (or head or whatever) is now on the ground.

So, I would use either “carried” or “had” here. The latter includes worn items, though the phrasing becomes a little weird (“everything had by the player”).

Speculation: Maybe it loops through objects and tests whether they’re enclosed by the player, and if so, moves them to the location. So if the box happens to come before the key in the loop, the box gets moved to the location, and then when the loop gets to the key it’s no longer enclosed by the box. Which would also mean that the behavior of this is dependent on the loop hitting things in the right order, which is not something you can count on.

Anyway, I think it’s definitely better to write

now everything carried by the player is in the location; now everything worn by the player is in the location

which should take care of everything that’s supposed to drop and not disassemble anything.

Thank you!!! This is what I was looking for!