Character Movement Coding

Hello,

I have been using Playfic for my interactive fiction and I wanted to make a character follow the player for only 1 turn. Here is a snippet of my code. When I use this code, it says You must supply a noun, and I am pretty sure this does not make the Old Man follow for 1 turn, so could I get some help? Tell me if you need more context for this.

Old Man Training is a scene. Old Man Training begins when Old Man is happy.

Every turn when Old Man Training is happening:
if the location of Old Man is not the location of the player:
let the way be the best route from the location of Old Man to the location of the player;
try Old Man going the way;

Your code worked for me.

[code]Right Wing is a room.
Hallway is west of Right Wing.
Left Wing is west of Hallway.
Old Man is a man in Left Wing.

Every turn:
if the location of Old Man is not the location of the player:
let the way be the best route from the location of Old Man to the location of the player;
try Old Man going the way;[/code]

Hi, I would like for the Old Man not to move, until a condition is triggered, which is when the player arrives at the same room as the Old Man. Then I would like the character to follow the player for only one move. I am not sure how to code that. Thank you very much.

[code]The old man can be active or inactive. He is inactive.

Every turn when the old man is active:
[move the old man];
now the old man is inactive.

Every turn when the old man is in the location:
now the old man is active.[/code]

The “You must supply a noun” error comes when there’s no route from the location of the Old Man to the location of the player–this means “the way” gets set to nothing (that is, the nothing object), so “try Old Man going the way” results in trying the Old Man going nothing, which gives that error message.

This can happen when the Old Man is in the location of the player, or when there’s no map path between the rooms for whatever reason.

The way to do that is to check that you’ve picked a direction before you try the Old Man going:

[code]Right Wing is a room.
Hallway is west of Right Wing.
Left Wing is west of Hallway.
Old Man is a man in Left Wing.

Every turn:
if the location of Old Man is not the location of the player:
let the way be the best route from the location of Old Man to the location of the player;
if the way is a direction:
try Old Man going the way;[/code]

Hi, this is the description of the room that the Old Man is in.

West of Dirt Path is Shack. Shack is a room. The table is in Shack. The table is scenery. A man called Old Man is here. Old Man can be happy, calm, or angry. Old Man is calm. Understand "Old", "old", "man", "Man", and "old man" as Old Man. The description of Old Man is "He is a wise old man plotting for revenge against the bandits. He is critical for your training in order to rescue your precious".

For some reason, the other code that those who have replied does not work. Also, I would not like the character to follow the player. I would like it to start following after the player enters the shack and that the Old Man only follows for the next room that the player goes into and then stops following.

I think you can go with something that only triggers when the Old Man is in the Left Wing by using an After, Before, or Instead rule.
Something like this:

After going from Left Wing:
	If Old Man is in Left Wing:
		say "The old man totters after you!";
		move Old Man to the location of the player;
	Continue the action.

Sidebar:

Creating an NPC called Old Man automatically understands “old/man/Old/Man” and “old man” and “Old Man” and “old man” and “old Man” and “OlD mAn” as synonyms by the object name. The parser does not observe case sensitivity regarding what the player types. You only need an understand if you want the parser to understand things other than “old man” and it’s variations as the Old Man - a good rule is to set an understand for any other synonym you write in a text description.

[code]Understand “codger/coot/Barnaby” as the Old Man.

A broken watch is here. The description is “The stupid thing is broken.” Understand “stupid thing” as the broken watch. [/code]