If It Hadn't Been For...

Example 273

A sound recording device that records the noises made by player and non-player actions, then plays them back on demand.

We start out by giving ourselves a capacious recording device:

"If It Hadn't Been For..."
The digital recorder is a device. The description is "A noise-activated recorder, which time-stamps each recording segment. It has space for about 60 short recordings."
Every turn:
   if the digital recorder is switched on and the number of blank rows in the Table of Recorded Content is 0, now the recorder is switched off.
Table of Recorded Content
time stampsound
a timesome text
with 60 blank rows.

And most of what follows is attaching sounds to various events. (We could have made noises associated with all the actions, but for simplicity we stuck to a few.)

The thing to note here is that the recording happens as part of Carry out, not as part of Report, so sounds will be recorded even when they are the result of non-player action when the player is not even in the room.

Carry out opening something in the presence of the switched on recorder:
   record "A creaking noise, as of something being opened."
Carry out someone opening something when the switched on recorder can see the noun:
   record "A creaking noise, as of something being opened."
Carry out closing something in the presence of the switched on recorder:
   record "A creaking followed by a slam."
Carry out someone closing something in the presence of the switched on recorder:
   record "A creaking followed by a slam."
Carry out someone going to a room (called destination) in the presence of the switched on recorder:
   if the destination is the holder of the recorder, record "Footsteps, growing louder.";
   otherwise record "Footsteps, fading out."
Carry out going to a room (called destination) in the presence of the switched on recorder:
   if the destination is the holder of the recorder, record "Footsteps, growing louder.";
   otherwise record "Footsteps, fading out."
Carry out someone eating something in the presence of the switched on recorder:
   record "Loud uncouth chewing sounds."
Carry out eating something in the presence of the switched on recorder:
   record "Distant muffled chewing sounds."
To record (noise - some text):
   if the number of blank rows in the Table of Recorded Content is 0, rule succeeds;
   choose a blank row in the Table of Recorded Content;
   now time stamp entry is the time of day;
   now sound entry is noise.
Understand "play [something]" as listening.
Instead of listening to the recorder:
   if the number of filled rows in the Table of Recorded Content is 0, say "The recorder remains blank." instead;
   repeat through the Table of Recorded Content:
      say "[line break][time stamp entry]: [sound entry]";
   say paragraph break.
The Haunted House is a room. The squeaky cupboard is an openable enterable closed fixed in place container in the House. The ghost is a man in the cupboard. The Lawn is outside from the Haunted House.
Instead of opening the closed cupboard when the ghost is in the cupboard: say "The cupboard stubbornly refuses to open."
Every turn when the player is not in the House:
   if the ghost is in the cupboard:
      try the ghost exiting;
   otherwise if the cupboard is open:
      try the ghost closing the cupboard.
Before someone exiting when the person asked is in a closed container (called the trap):
   try the person asked opening the trap.
Before someone entering a closed container: try the person asked opening the noun.
Before going to the House when the House contains the ghost:
   try the ghost entering the cupboard;
   try the ghost closing the cupboard.
The player carries the recorder, chips, and a sandwich. The sandwich is edible. The chips are edible.
Carry out someone eating the chips in the presence of the switched on recorder: record "An incredible racket of a packet being opened." Carry out eating the chips in the presence of the switched on recorder: record "An incredible racket of a packet being opened."
Test me with "open cupboard / drop recorder / switch it on / eat chips / out / wait / wait / wait / in / switch recorder off / play recorder".
Test me with "open cupboard / drop recorder / switch it on / eat chips / out / wait / wait / wait / in / switch recorder off / play recorder".
Haunted House
You can see a squeaky cupboard (closed) here.

>(Testing.)

>[1] open cupboard
The cupboard stubbornly refuses to open.

>[2] drop recorder
Dropped.

>[3] switch it on
You switch the digital recorder on.

>[4] eat chips
You eat chips. Not bad.

>[5] out

Lawn

>[6] wait
Time passes.

>[7] wait
Time passes.

>[8] wait
Time passes.

>[9] in

Haunted House
You can see a digital recorder and a squeaky cupboard (closed) here.

>[10] switch recorder off
You switch the digital recorder off.

>[11] play recorder

9:03 am: An incredible racket of a packet being opened.
9:03 am: Distant muffled chewing sounds.
9:04 am: Footsteps, fading out.
9:04 am: A creaking noise, as of something being opened.
9:05 am: A creaking followed by a slam.
9:08 am: A creaking noise, as of something being opened.
9:08 am: A creaking followed by a slam.

Now we're at liberty to record evidence of the ghost getting out of the cupboard and getting back in, while we ourselves stand about on the lawn.