Your Mother Doesn't Work Here
Example 437
★Suppose the player's mother is supposed to be cleaning the living room, but she can be interrupted by the need to pick up things the player has dropped. New tasks are added to the end of her "current plan" list; every turn, she attempts to do whatever is the last entry on that list.
"Your Mother Doesn't Work Here"
A person has a list of stored actions called the current plan.
Every turn:
repeat with culprit running through people who are not the player:
if the number of entries in current plan of the culprit is greater than 0:
let N be the number of entries in the current plan of the culprit;
try entry N of the current plan of the culprit;
remove entry N from the current plan of the culprit.
The Living Room is a room. It contains a somewhat muddy Persian rug. Your mother is a woman in the Living Room.
West of the Living Room is the Kitchen.
Instead of your mother rubbing the rug:
say "Your mother scrubs the stained areas of the rug, muttering to herself."
Instead of taking something:
say "Nah, Mom'll get that."
Report your mother taking something:
say "Your mother picks up [the noun][one of], sighing deeply[or], jaw tight[or], with assorted comments on your manners[or]; to judge from her comments, she is also indulging in a pleasant fantasy about Swiss boarding schools[stopping]." instead.
When play begins:
add mother going west to the current plan of mother;
add mother rubbing the rug to the current plan of mother.
Every turn:
if mother is not in the Living Room, end the story finally.
Carry out dropping something:
add mother taking the noun to the current plan of mother.
The player carries some dirty socks, some dirty shoes, a dirty hat, a pair of dirty trousers, and a backpack.
Test me with "drop socks / z / drop shoes / drop hat / drop all / z / z".
Test me with "drop socks / z / drop shoes / drop hat / drop all / z / z".
Living Room
You can see a somewhat muddy Persian rug and your mother here.
>(Testing.)
>[1] drop socks
Dropped.
Your mother picks up the dirty socks, sighing deeply.
>[2] z
Time passes.
Your mother scrubs the stained areas of the rug, muttering to herself.
>[3] drop shoes
Dropped.
Your mother picks up the dirty shoes, jaw tight.
>[4] drop hat
Dropped.
Your mother picks up the dirty hat, with assorted comments on your manners.
>[5] drop all
pair of dirty trousers: Dropped.
backpack: Dropped.
Your mother picks up the backpack; to judge from her comments, she is also indulging in a pleasant fantasy about Swiss boarding schools.
>[6] z
Time passes.
Your mother picks up the pair of dirty trousers; to judge from her comments, she is also indulging in a pleasant fantasy about Swiss boarding schools.
>[7] z
Time passes.
your mother goes west.
*** The End ***
You can see a somewhat muddy Persian rug and your mother here.
>(Testing.)
>[1] drop socks
Dropped.
Your mother picks up the dirty socks, sighing deeply.
>[2] z
Time passes.
Your mother scrubs the stained areas of the rug, muttering to herself.
>[3] drop shoes
Dropped.
Your mother picks up the dirty shoes, jaw tight.
>[4] drop hat
Dropped.
Your mother picks up the dirty hat, with assorted comments on your manners.
>[5] drop all
pair of dirty trousers: Dropped.
backpack: Dropped.
Your mother picks up the backpack; to judge from her comments, she is also indulging in a pleasant fantasy about Swiss boarding schools.
>[6] z
Time passes.
Your mother picks up the pair of dirty trousers; to judge from her comments, she is also indulging in a pleasant fantasy about Swiss boarding schools.
>[7] z
Time passes.
your mother goes west.
*** The End ***
As goal-seeking goes, this is fairly rudimentary; "Boston Cream" provides an alternative (and slightly more sophisticated approach), but for really complex goal-seeking characters, it is probably best to turn to the character extensions designed for Inform.