Here is a different approach using kinds and relations.
This method will work for an arbitrary number of rooms and persons. Note that in this example, Shemp does not give off a scent, but Larry, Moe, and Curly do. To make Shemp leave a scent trail behind, just add “Shemp leaves behind ten scents”.
Note that the player leaves scent objects behind also, but we only see messages for NPC scents. This is partly because the message for the player’s scent would pretty much always be useless information (since you know where you are), and partly because conjugating verbs is a pain. So I coded it that way.
[code]“More Test Stuffs” by Troy Jones III
Section - Defining Scents
A scent is a kind of thing. A scent is always scenery.
A scent has a number called age. The age of a scent is usually zero.
Instead of doing something with a scent, say “It’s a scent trail left behind by [random thing that leaves behind the noun], [age of noun in words] minutes old. You can’t really do anything with it.”
Leaving behind relates one person to various scents.
The verb to leave behind (it leaves behind, they leave behind, it left behind, it is left behind, it is leaving behind) implies the leaving behind relation.
Definition: a scent is NPC if it is not left behind by the player.
Section - Dramatis Personae
The player leaves behind ten scents.
Larry leaves behind ten scents.
Curly leaves behind ten scents.
Moe leaves behind ten scents.
The description of yourself is “Four paws and brown and white fur. You also have a keen nose, though you can’t see it very well without crossing your eyes.”
Section - For some reason we perceive scents by looking-- just go with it
After looking:
say “Exits: [exit list][smell list]”;
Instead of smelling:
say “You sniff the air[smell list]”.
To say smell list:
if an NPC scent is in the location:
let 1st-item be true;
repeat with stink running through NPC scents in the location:
if 1st-item is true:
say “.[paragraph break]You can smell [stink]”;
now 1st-item is false;
otherwise:
say “, and [stink]”;
say “.”
Rule for printing the name of a scent (called odor):
say “that [random thing that leaves behind odor] was here [age of odor in words] minute[if age of odor is not one]s[end if] ago”.
To say exit list:
let place be location;
let first-in-list be true;
repeat with way running through directions:
let place be the room way from the location;
if place is a room:
if first-in-list is true:
say " [way]";
now first-in-list is false;
otherwise:
say “, [way]”.
Section - ET rule that distributes and recycles scents and moves the NPCs randomly
Every turn:
repeat with mover running through persons that are not the player:
let destination be a random room;
let thataway be the best route from the location of the mover to the destination, using doors;
if thataway is a direction:
try mover going thataway;
repeat with stinker running through persons that leave behind something:
if the location of stinker encloses something left behind by stinker:
repeat with reek running through scents in the location of stinker:
if reek is left behind by stinker:
now the age of reek is zero;
otherwise:
move a random off-stage thing left behind by stinker to the location of stinker;
repeat with stench running through scents:
if stench is not off-stage:
increment age of stench;
if age of stench > 9:
now age of stench is zero;
now stench is off-stage.
Section - Rooms
Front Porch is a room. “The front porch of your house.”
Driveway is southeast from Front Porch. “Your driveway slopes down to the north and curves left into the garage in back of the house.”
Front Lawn is south from Front Porch and west from Driveway.
Street by Your House is south from Driveway and southeast from Front Lawn.
Foyer is northeast from Front Porch. “A lot of rooms connect to the Foyer so a lot of NPCs will pass through here.”
Master Bedroom is south from Foyer.
Master Bathroom is northeast from Master Bedroom.
Guest Bathroom is southeast from Foyer and southwest from Guest Bedroom.
Guest Bedroom is east from Foyer.
Laundry Room is northeast from Foyer.
Garage is down from Laundry Room and north from driveway.
The Den is north from the Foyer.
The Living Room is west from the Foyer and southwest from the Den.
The Attic is up from the Foyer. “Remember that the Every Turn rule doesn’t fire on turn one, so there won’t be any scents here at first.”
The Family Room is down from the Den and east from the Garage.
The Backyard is north from the Family Room.
Larry is in Attic.
Curly is in Attic.
Moe is in Attic.
Shemp is a man in Attic.
test me with “ne / l / l / smell / l / l / l / n / l / l”.[/code]
Output looks like this (illustrating one scent disappearing after ten turns, and another scent being refreshed before it expires):
[rant]>l
Den
You can see Curly here.
Exits: south, southwest, down.
You can smell that Larry was here two minutes ago, and that Moe was here seven minutes ago, and that Curly was here one minute ago.
Curly goes down.
l
Den
Exits: south, southwest, down.
You can smell that Larry was here three minutes ago, and that Moe was here eight minutes ago, and that Curly was here two minutes ago.
l
Den
Exits: south, southwest, down.
You can smell that Larry was here four minutes ago, and that Moe was here nine minutes ago, and that Curly was here three minutes ago.
smell
You sniff the air.
You can smell that Larry was here five minutes ago, and that Curly was here four minutes ago.
l
Den
Exits: south, southwest, down.
You can smell that Larry was here six minutes ago, and that Curly was here five minutes ago.
Curly arrives from the south.
l
Den
You can see Curly here.
Exits: south, southwest, down.
You can smell that Larry was here seven minutes ago, and that Curly was here one minute ago.
Curly goes down.
Moe arrives from the south.[/rant]