I want my NPC to take something from a non specific closed container

Sorry if this too obvious, but I couldn´t find an answer.

The player hide an object in a closed container (there are a lot of closed containers in the game) and I want this NPC to get the object by himself, but I don´t know how to get him to open the closed container. I tried something like this but to not avail. It says “the container” is too vague.

if the document is in a closed container:
	try James opening the container;
if the document is in a closed container (called the obstacle):
    try James opening the obstacle;
3 Likes

Thank you very much, Daniel. It works flawlessly!

1 Like

One of the key things to remember with Inform is that it’s not very good at understanding the word “the”. To us, “the” means “the one and only thing matching this description which is relevant in this specific context”. But Inform isn’t very good at knowing what’s relevant in context and what isn’t.

So whenever you want to use “the” to pick out a specific thing, you have to make sure you give Inform enough additional information to know which specific thing you want: in this case, giving the relevant container an unambiguous name (“the obstacle”).

5 Likes

A very helpful tip. It is a relief finally being able to define dynamic obstacles this way. Thanks again!