Making specificly named NPCs do things


Sorry if this seems like a trivial question but I searched the Inform manual and the web and couldn’t find much conclusive responses.

I want to make NPCs do things. The way in the inform manual e.g. for moving appears to be:
move NPCXY to RoomYX.

Other sorts of more complex actions (e.g. NPC picking up things) either doesn’t seem to be done at all, or not with an explicitly named NPC, but rather as a part of some more complex rule which iterates NPCs and then makes each one do something (without naming each NPC directly).

My problem is, I have the specific NPC name, e.g. Robert. Now I want to make him do something, e.g. walk west or pick something up.

Something on the web suggested: try Robert trying walking west.
or: try Robert trying picking up chair.

However, this simply doesn’t work for me. How can I do this properly?


The syntax is just “try Robert walking west” or “try Robert taking the chair”.

However, note that this will most likely not trigger any special rules you have, if they are written like “Check doing something” or “Instead of doing something”. This may or may not be what you wanted; sometimes you only want special behavior when the player is the one doing stuff. To make your special behavior work when anyone does it, use “Check someone doing something” or “Instead of someone doing something”. Then you can find out who is doing it with the “person asked” global variable.

Ok I tried this:

[ some other code up here, including room definition ]
Edward Cross is a person.
Edward Cross is in the Lower Control Room.

Every turn:
	if the lower control room is visited and the lower control room was not visited:
		say "'Amy Garland! It's good you arrived!', he says, a bit short of breath. 'Hi Edward', you respond. 'The call by Mr. Huddleston sounded rather urgent.'
He nods and then waves you to follow him, 'Let's go to where the problem is located.'";
		try Edward Cross walking west;

The compiler doesn’t like that:

If I take the “try Edward Cross walking west” out, it works. (text is printed out when I enter the room the first time, but obviously the NPC does not walk west as I want him to) The player can also walk west with no trouble in the given location.

I’m just using the standard extensions and basic screen effects by emily short, nothing special. I didn’t fiddle around with the walking action either, except for some simple blocking checks for the player in various rooms (in the style of “instead of going west while in apartment corridor:” or “Check going south:If location is …”).

Oh I am stupid. Of course I need to use “try Edward cross going west”… stupid me :slight_smile: now it works.