Inform: Following the player


6 Dec 1995 09:28:44 GMT

Does anyone know how we should go about programming a creature that follows
the player? I've had a go, and the best I could come up with was:

Nearby dog "dog"
with name "dog", article "your",
describe [;
"Your dog is panting here.^";
],
daemon [;
give self ~concealed;
if (TestScope(self,player)~=0) print "Your dog lollops in.^";
StopDaemon(self);
],
react_before [;
Go: if (ZRegion(parent(self).(noun.door_dir))==1)
{
move self to (parent(self).(noun.door_dir));
give self concealed;
StartDaemon(self);
};
rfalse;
],
has animate;

This works, but it seems like a bit of a messy way of doing things. Surely
there must be a more elegant solution?

All help gratefully recieved,

JJF.

-- 
*******************************************************************************
* JJF's Homepage URL :                * "Yay, what a CRASH!"                  *
*    http://www.cs.bham.ac.uk/~jjf/   * JJF, while using Windows 3.1 in 1994. *
*******************************************************************************