I was too optimistic about finishing Frankenstein’s Ghost. Still got a problem.
My intention was to create a ghost who shows up randomly (1 in 4 chance), but not until a certain room is visited. However, the ghost in the source code I have written isn’t waiting for that.
Here’s the code:
The ghost is a person. The ghost is in Hallway.
The ghost counter is initially zero.
Every turn:
if the ghost counter is one:
end the story saying “It touced you. You have died.”;
otherwise if the ghost is in the location:
increment the ghost counter;
otherwise:
now the ghost counter is zero.
Every turn:
if a random chance of 1 in 4 succeeds:
now the ghost is in the location;
now the ghost counter is zero;
say “Holy haunt, Batman! There’s a presence here – an apparition! Jeepers, it’s the monster’s ghost! You’d better leave – if that thing touches you, you’re dead!”
I am a newbie and neophyte of every kind, but reading the code you have provided, I don’t see anything that makes the encounter dependent on visiting Hallway. There is probably a better way to do this, but perhaps you could make a condition that tracks whether Hallway has been visited and add that as the first requirement of the every-turn rule (before the random-chance success requirement)?
Non-neophytes, please regard this post as an attempt to practice/exercise.
…the trick there being that the adjective “visited” for rooms is actually built-in to Inform, so you don’t need to do any bookkeeping yourself.
EDIT: Whoops, I was trying to get in right after Draconis. lux: Yes! I think it’s actually introduced in Example 4 rather than in the main text of Writing with Inform.
Bumping rather than editing: Lux, I’m pretty sure there’s no built-in equivalent for examined things, but examples 90 and 111 of the documentation (Morning After and Y ask Y?) show you how to set up an “examined/unexamined” adjective.