How does inform move the player out of a container?

In Inform, I can code and it works fine:
now the player is inside the box;

but Inform gives me an error when I write: now the player is out of the box; (or outside of)

If you can move a player INTO a container, surely there is a logical way to move them OUT of a container. Any help would be appreciated.

now the player is in the location

The location is the room that encloses the player. If the box is in room X, and the player is in the box, then the location is X. So moving the player to the location should do the trick! (Assuming that the box itself can’t be in a bigger box… in which case you need slightly different syntax,)

1 Like

or the exactly equivalent,

move the player to the location.

but which syntax also enables you to write

move the player to the location, without printing a room description. [note the comma]


move the player to the location,  printing an abbreviated room description.

See 8.9 in the Inform documentation.

These achieve magical teleportation of the player out of the box, but if you want the move to be subject to game rules, so that the player can’t get out of a closed, locked box, then you can write

try exiting.


try silently exiting.

which have the same result as if the player typed ‘exit’, except that in the second example text confirming a successful exit e.g. ‘You get out of the box.’ is not printed.

This is because Inform has no concept of things being outside other things, only of being inside (or in or within) things. So you have to move the player to be inside whatever the box is inside. You could begin to explain this idea to Inform:

To move/remove a/an/the/-- (outsider - a thing) out/outside/-- of/from a/an/the/-- (enclosure - a container):
	let the surroundings  be the not-counting-parts holder of the enclosure;
	if the surroundings are not nothing:
		move the outsider to the surroundings.
To place a/an/the/-- (outsider - a thing) out/outside of/from/-- a/an/the/-- (enclosure - a container):
	move the outsider outside of the enclosure.

and you can now write things like

move the pot plant outside of the greenhouse. [assuming the greenhouse is a container, not a room]


move player out from cupboard.


remove the shopping from the bag.


place the doll outside the Wendy House. [again, assuming the Wendy House is a container]

and so on.

To fully teach Inform the idea of ‘outside’ equivalent to how it understands ‘inside’ would involve a whole lot more work involving adjectives and spatial relations…

1 Like