NPC Movement

Hello, all:

Once again I am tied up around the correct programming language to use for moving into rooms. The first part of my code works – that is, if the character is in the same room as the player and there is margarine spread on the floor then the character slips and falls upon entering:

if lucien is in location and location is smeared and player is in location:
		say "Lucien storms into the room but then slips and skids across the floor.[paragraph break]'Aiiigh!' Lucien yelps as he slams into a bookshelf.  'My back!  My back!'[paragraph break]Lucien is still screaming and yelling when a couple of library employees come to help him off the ground.  Draped between them, his arms over their shoulders, they walk him off to the infirmary.  You then notice the woman, the female librarian, standing to the side, smirking.  She spits on the floor and then leaves.  Another man quickly and quietly appears behind the lectern.";
		now lucienloc is 1;
		remove lucien from play;
		now magazinepickup is 0;
		now Wall Street Panic Snopes is in The_End_of_The_Stacks;
		now byelucien is 0;

The ‘otherwise’ portion – that is, if the player isn’t in the room, the character should still slip and unjure himself but he does not when the player is not around:

otherwise:
		if Lucien is in location and location is smeared and player is not in location:
			say "There is a yelp from another room and the sound of people running.  Then it is quiet again.";
			now lucienloc is 1;
			remove lucien from play;
			now magazinepickup is 0;
			now byelucien is 0;
			now Wall Street Panic Snopes is in The_End_of_The_Stacks;

Thank you for your support!

“The location” is a variable that means “the location where the player is”, so your “if the player is not in the location” condition will never be true. Is there a specific room where this will be happening, or can you cue to the location of the NPC?

Yes, I considered using separate rooms with separate code I was just thinking there was a shorter way to do it!

There probably is, but it’d be helpful to see how this code is actually being used - is this part of an every turn rule that’s moving the NPC(s) around? If so you I’d just have one if block checking whether the location of Lucien/the NPC is smeared, do all the logic to remove him from play or whatever, and then have a final if/otherwise toggle based on whether the player is in the location of the NPC to decide which say statement gets fired.