Help me with my movement algorithms

My NPC movement algorithms have been producing runtime errors and anyway are rather clumsy. Could I get some help, please? Each character may have several possible locations and the path cannot go through certain doors. (The action delay is just a number that increments each turn.) For instance:

Every turn: if the player is not Gail: if Gail is not in a pod: if the action delay of Gail > 4: if the location of Jake is not the location of Gail: let the current direction be the best route from the location of Gail to the location of Jake, using doors; if the door the current direction from the location of Gail is forbidden: stop the action; otherwise: try Gail going the current direction; if the location of Gail is the computer room: now the action delay of Gail is 0.

I haven’t actually messed with stuff like this before, so this is probably a dumb suggestion, but maybe look at what exactly the “stop the action” command is doing. Is it possibly stopping the entire “every turn” rulebook, in which case some necessary things that need to get done every turn aren’t getting done?

-Kevin

I might look at the assumption that there is a door the forbidden direction from Gail. Mightn’t it just be a connection - ie a room? If you strip out each line individually, which one is giving you the crash problem?
I dunno. I guess it’s not entirely clear what you want to do. Move Gail towards Jake?
What’s the action delay?