"A Lighter in the Dark" by John Timmons
The story headline is "Working with Lighters".
The release number is 1.
The story creation year is 2009.
The story description is "This is a brief example of starting a game in a dark room and the player must use a lighter before they are allowed to leave. It also creates a lighter that will only work for a brief period (two turns at a time) and works as a 'pseudo-device' instead of a device. This was an idea given to me by two of my students in the Fall 2009 New Media Perspectives class."
Use American dialect, the serial comma, and no scoring.
Release along with the source text, a website, and an interpreter.
[The is creates a variable to contain numeric values.]
LighterCount is a number that varies.
[This every turn rule only comes into play if the player is carrying the lighter. It sets the parameters so that the player can only keep the lighter lit for only two (2) turns at a time. It checks first to see if the lighter is lit, then if the LighterCount value is 2 (meaning that the lighter has been lit for two turns) the lighter will be dropped, and an appropriate message will be displayed. If LighterCount is not 2, then its value is increased by 1 and play moves on.]
Every turn while the player carries the lighter:
if lighter is lit begin;
if LighterCount is 2 begin;
say "The heat of the lighter singes your thumb and you drop it.";
try silently dropping the lighter;
now LighterCount is 0;
otherwise;
increase LighterCount by 1;
end if;
end if.
[Our starting room.]
The Foyer is a room. It is dark. "The room is nothing but barren concrete but there is an exit to the north."
[The following before rule checks to see if the player is trying to go north while in the foyer. If they are, it checks to see if the room is in darkness and prevents traveling in that direction and provides an appropriate message.]
Before going north from the Foyer:
if in darkness begin;
say "Stumbling around in the dark will get you nowhere.";
stop the action;
otherwise;
continue the action;
end if.
[This is simply a default instead rule in case the player tries to go in a direction where there is no exit while in a dark room.]
Instead of going nowhere when in darkness:
say "Stumbling around in the dark will get you nowhere."
[The generic lighter will serve as our pseudo-device.]
The lighter is carried by the player. The description is "This one of those cheap plastic lighters."
[The following instead rule takes into account the player typing "light the lighter".]
Instead of burning the lighter:
try switching on the lighter.
[The following is where we create the pseudo-device behavior. The inclusion of a line break addresses a (minor) issue with our pseudo-device behavior. We use the instead rule here in case the player tries to turn on the lighter when it is already on. If the value of LighterCount is anything but 0, it means it is on.]
Instead of switching on the lighter:
if LighterCount > 0 begin;
say "It's already lit.";
otherwise;
now the lighter is lit;
say "[line break]";
end if.
[The following instead rule comes into play should the player turn off the lighter.]
Instead of switching off the lighter:
if LighterCount < 1 begin;
say "The lighter is not lit.";
otherwise;
now LighterCount is 0;
now the lighter is dark;
say "[line break]";
end if.
[This carry out rule comes into play should the player for some reason drop the lighter. It ensures that the lighter will go dark and resets LighterCount. Should the player drop this in a dark room, they'll be able to find it in the dark.]
Carry out dropping the lighter:
now the lighter is dark;
now LighterCount is 0.
After deciding the scope of the player while in darkness:[1]
place the lighter in scope.
After taking the lighter while in darkness: [2]
say "After an indeterminate amount of time feeling around in the dark on your hands and knees, you are lucky enough to retrieve [the noun]. You curse yourself for your stupidity."
[This is the room should the player go to the north from the foyer. Just here for completeness.]
The porch is north of the Foyer.
Notes
[1]. This is optional but if the player drops the lighter in a dark room; it's gone. This will keep the lighter available (in scope) should the player drop it in the darkness.
[2]. This after rule provides an appropriate response when the player takes the lighter after dropping it in the dark.