1
0
Fork 0
mirror of https://github.com/ganelson/inform.git synced 2024-07-05 08:34:22 +03:00
inform7/resources/Documentation/Examples/VanHelsing.txt
2019-03-16 13:12:11 +00:00

25 lines
1.5 KiB
Plaintext

** The location of something
(Person who follows the player; Van Helsing)
A character who approaches the player, then follows him from room to room.
Suppose we want to write a character who tries to be in the same room as the player. We will do this by testing every turn whether the character's location and the player's location are the same; if the answer is no, the character will look for a path to the player's location, then try to move along that path. (We will learn more about finding paths and giving characters instructions later.)
The result will be that if the player ever moves to another location, the character will automatically pursue him.
{*}"Van Helsing"
The Drawbridge is a room. North of the Drawbridge is the Immensely Enormous Entry Hall. West of the Entry Hall is the Vast Dining Area. North of the Vast Dining Area is the Colossal Kitchen. The Spooky Guano-filled Attic is above the Entry Hall.
Count Dracula is a man in the Attic.
In the following condition, we could also have written "if the location of Count Dracula is not the location", because "location" by itself is always understood to be the player's location. But it seemed better for clarity to write it this way:
{**}Every turn:
if the location of Count Dracula is not the location of the player:
let the way be the best route from the location of Count Dracula to the location of the player, using doors;
try Count Dracula going the way;
otherwise:
say "'Muhahaha,' says Count Dracula."
Test me with "z / z / n / w / e / u / z / d".