Here is the code for one of the examples I demonstrated last class:
“Scenes and Regions 01″ by John Timmons
The story headline is “A Brief and Simple Demonstration of Using Regions and Scenes”
The Hotel Lobby is a room. “To the north is the bottom of the stairs.”
Bottom of the Stairs is north of the Hotel Lobby.
[NormalPlace is an area that will include all rooms where nothing spooky will happen.]
NormalPlace is a region. Hotel Lobby is in NormalPlace.[SpookyPlace is a region that will include all rooms where the spooky stuff will happen.]
SpookyPlace is a region. Bottom of the Stairs is in SpookyPlace.Part 1 – Spooky Scene Stuff
[Here we create the scene and how it will begin and how it will end.]
Spooky is a scene. Spooky begins when the player is in SpookyPlace. Spooky ends when the player is in NormalPlace.[This checks to see if the player is in the a SpookyPlace region and if they are will print out something out 50% of the time.]
Every turn when a random chance of 1 in 2 succeeds:
if player is in SpookyPlace begin;
choose a random row in the Table of Spooky Events;
say “[event entry][paragraph break]“;
otherwise;
do nothing;
end if.
[Here are the messages that may be printed when the player is a SpookyPlace region.]
Table of Spooky Events
event
“An ice cold draft plays across the back of your neck.”
“You hear the sound of a child whispering.”
“Something moves out of the corner of your eye. But when you look it is gone.”
