NPCs can't go through doors?

I created a person to follow around the main character, but when I go through a door that I’ve opened, in the place of the description that the character is there, I get “You must supply a noun.”

Can they not go through doors?

Every Turn:
	if Invvar is zero:
		if the location of Bartow is not the location of the player:
			let the way be the best route from the location of Bartow to the location of the player;
			try Bartow going the way;
	otherwise:
		stop the action.

“The best route” by default doesn’t use doors, so your code isn’t finding a route, and “the way” is evaluating to nothing. In order to let the NPC find a route through doors you have to say “let the way be the best route from the location of Bartow to the location of the player, using doors.” See section 6.14 of Writing with Inform.

It’s usually a good idea to check whether you’ve found a route by adding “if the way is a direction” before you try your NPC going the way, to avoid that puzzling error message.

By the way, you probably don’t need “stop the action”; if I’m not mistaken that’ll cut off the Every Turn rulebook and thus prevent any later Every Turn rule from running, which is probably not your desired behavior. You could just omit the “otherwise” (and you can make the rule heading “Every turn when Invvar is zero:” rather than making it a rule that actually runs every turn but only does anything when Invvar is zero. Though that probably doesn’t carry any big performance costs or anything.

One last side note, there are some bugs with NPC-door interactions, but I don’t think those should cause any problems with your code; your problem is with the route-finding.

Thank you! That helped. I had been looking for that section, but one thing I have noticed is that a lot of this information is mentioned and easily miss when looking for it again. :slight_smile:

I appreciate the help!

One thing that helps is typing a short bit from your code into the search box; if you just type “the best route” (without quotes) it’ll get you that exact phrase, which turns up the section that explains it. Or if you type “, using” that… doesn’t work for some reason.

But it’s often worth trying when there’s something you know is in there but you can’t find it. And there’s also zarf’s index.

It works on LInux, if not in whatever IDE you’re using (the Mac one, IIRC?). I think you found a new bug.

Doesn’t work in the Windows IDE either …

Yeah, it’s the Mac one. “, using” finds sections 11.3 and 12.4 but “room, using” finds 6.14 and 6.17.