I7 - Help NPC walk through door!

I feel this is a bit of a classic - detecting an adjacent room when there is a door in the way. Is it one of the cases where I’m just missing one or two words, or do it need some crazy-ass coding?

If selected-space-alien is in a room (called the current-space) which is adjacent to a room: Let next-space be a random room which is adjacent to the current-space; If selected-space-alien is visible, say "[selected-space-alien] heads to [the next-space]."; Move selected-space-alien to next-space; If selected-space-alien is visible, say "[selected-space-alien] arrives from [the current-space].";

You’re saying that code works, and asking how to update it to check for doors between rooms?

yes, exactly! The code worked quite well, and I liked it … and then I updated the invironment with some doors, and then the code was suddenly useless.

Admittedly, my intension was a quite unclear - sorry about that!

You can let X be the best route from the location of npc to [something], using doors.

Calculate that every turn when npc cannot see [something]. Then Try NPC going X.

Thanks - this pushed me to finally get my NPC to finally travel with (some) purpose!