"Using doors" seemingly not working

Hello! I’m getting this error when trying to create a character who follows the PC through a door.

You'll have to say which compass direction to go in. I didn't understand that instruction.
My code is directly copied from the example with Dracula, and I’ve put in a print statement…

Every turn: if the location of Dracula is not the location of the player: let the way be the best route from the location of Dracula to the location of the player, using doors; say "Going [the way] from [the location of Dracula]"; try Dracula going the way.
…which prints “[the way]” as “nothing”. He seems to be able to move to the nearest room with no door between and wait there, but not to pass through a door. (Perhaps I need to invite him? /joke)

Any idea what’s going on?

Your code works for me. Maybe there’s a problem with one of your map connections? (The index map might give a hint.)

All the rooms in the index are definitely connected as far as I can tell. (Room 1 contains door to room 2, room 2 contains door to room 1, etc.) Is there anything in particular I should be looking for?

Is it one particular door that causes the problem? Or is it failing with all doors?

If it’s just one door, do you have any code affecting that door specially? Can you as the player go both ways through the door without a problem?

I can’t think of anything else off-hand. Feel free to post your code.

It’s just this door (as of some other changes I made). So, I tried moving up all the room and door declarations and relations to make sure they were before this code, and I thought that would solve the problem (maybe it did for one door, I don’t remember) but I continued having trouble. (This door was inside/outside, not sure if it made a difference.) Of course, when I dumped the sample code in a new document and ran it, it worked just fine, so THEN I tried commenting out bits of the full source bit by bit, and it’s some leftover unused code from the tutorial that’s messing things up for reasons I cannot fathom.

The screen door is lockable, closed and locked

Now, this door was a door to nowhere from a room two rooms over and inside from the one that “Dracula” wasn’t following the PC into, so who knows!

Hey Kit,

I figured out what you did, but in the future it would help if you posted the smallest complete example of code which reproduces your problem. If you’re worried about posting a long bit of code – don’t. (Worry, that is.) If you’re still worried, put the code box inside a spoiler box like this:[spoiler]I think you did something like this:[code]“Van Helsing”

The Drawbridge is a room.
[Took out this:]
[North of the Drawbridge is the Immensely Enormous Entry Hall. West of the Entry Hall is the Vast Dining Area.]
North of the Vast Dining Area is the Colossal Kitchen. The Spooky Guano-filled Attic is above the Entry Hall.

Count Dracula is a man in the Attic.

Every turn:
if the location of Count Dracula is not the location of the player:
let the way be the best route from the location of Count Dracula to the location of the player, using doors;
say “Going [the way] from [the location of Dracula]”;
try Count Dracula going the way;
otherwise:
say “‘Muhahaha,’ says Count Dracula.”

[Added this:]
The Immensely Enormous Entry Hall is a room.
The screen door is a door. It is inside from the Drawbridge and outside from the Entry Hall. The screen door is lockable, closed and locked.[/code]
resulting in this:

Try changing your every turn rule to this:Every turn: if the location of Count Dracula is not the location of the player: let the way be the best route from the location of Count Dracula to the location of the player, using even locked doors; say "Going [way] from [the location of Dracula]"; try Count Dracula going the way; otherwise: say "'Muhahaha,' says Count Dracula."
and you get this:

That “even locked doors” bit will get you every time. (It’s in the phrasebook part of the index under “route-finding” FYI.) Notice I also changed “[the way]” to just [way]" but since you just put that in for debugging purposes, it wasn’t really necessary. Having “the down” in the output just bugged me. :slight_smile:[/spoiler]
HTH

[edit] PS - Oh yeah – the reason “the way” showed up as “nothing” is because there is no route using (unlocked) doors in the original code, so nothing is the correct result.

So it was giving me this error because a locked door existed, even though the route from Dracula to me wouldn’t have gone through it? I’m still not sure I can follow the logic of that. What if I want to have locked doors in my game but I don’t want someone to be able to follow the player through them?

No, there was probably some ambiguous declaration that caused the compiler to think the screen door was the same as some other door.

Thanks!

Just to add, it’s generally a good idea to add an “if the way is a direction:” check to code like that. Just in case, for example, the player locks themself into a room on their own, and some code that expects “going” to always take a direction suddenly finds itself confronted with “nothing”.

Ah, cool.