§3.8. Sounds

It is too easily assumed that room descriptions are what the player sees, but as The Undertomb demonstrates, they might just as easily include ambient sounds.

So Inform's "listening to" action is the audio equivalent of "examining", rather than "looking". Despite this the player can type LISTEN, which Inform understands as listening to the everything in the location at once. A simple but effective way to handle this is shown in The Art of Noise.

Four Stars 2 adjusts the idea of "visibility" to make it behave differently for listening purposes: this introduces a formal idea of "audibility".

* See Lighting for heightened hearing in darkness, and the rest of "Four Stars"


arrow-up.pngStart of Chapter 3: Place
arrow-left.pngBack to §3.7. Lighting
arrow-right.pngOnward to §3.9. Passers-By, Weather and Astronomical Events

*ExampleThe Undertomb 1
A small map of dead ends, in which the sound of an underground river has different strengths in different caves.

*ExampleFour Stars 2
Using "deciding the scope" to change the content of lists such as "the list of audible things which can be touched by the player".

This example involves redesigning the LISTEN command, removing its built-in function and replacing that with something more ambitious. We will learn more about how to do this later on.

paste.png "The Art of Noise"

A thing has some text called sound. The sound of a thing is usually "silence".

The report listening rule is not listed in the report listening to rules.

Carry out listening to something:
    say "From [the noun] you hear [the sound of the noun]."

Instead of listening to a room:
    if an audible thing can be touched by the player, say "You hear [the list of audible things which can be touched by the player].";
    otherwise say "Nothing of note."

Definition: a thing is audible if the sound of it is not "silence".

Before printing the name of something audible while listening to a room:
    say "[sound] from the "

The Sharper Image is a room. The pet rock is a thing in the Sharper Image. The toy car is a thing in the Sharper Image. The sound of the car is "whirring and zooming". The plastic widget is a thing in the Sharper Image. The sound of the plastic widget is "bleeps and bloops". The pointless gadget is a thing in Sharper Image. The sound of the pointless gadget is "buzzbuzzbuzz".

The soundproof case is a transparent openable container in the Sharper Image. It is closed and fixed in place.

Test me with "listen / listen to rock / listen to car / get all / open case / put all in case / listen / close case / listen / listen to car".

***ExampleThe Art of Noise
Things are all assigned their own noise (or silence). Listening to the room in general reports on all the things that are currently audible.

This example involves redesigning the LISTEN command, removing its built-in function and replacing that with something more ambitious. We will learn more about how to do this later on.

paste.png "The Art of Noise"

A thing has some text called sound. The sound of a thing is usually "silence".

The report listening rule is not listed in the report listening to rules.

Carry out listening to something:
    say "From [the noun] you hear [the sound of the noun]."

Instead of listening to a room:
    if an audible thing can be touched by the player, say "You hear [the list of audible things which can be touched by the player].";
    otherwise say "Nothing of note."

Definition: a thing is audible if the sound of it is not "silence".

Before printing the name of something audible while listening to a room:
    say "[sound] from the "

The Sharper Image is a room. The pet rock is a thing in the Sharper Image. The toy car is a thing in the Sharper Image. The sound of the car is "whirring and zooming". The plastic widget is a thing in the Sharper Image. The sound of the plastic widget is "bleeps and bloops". The pointless gadget is a thing in Sharper Image. The sound of the pointless gadget is "buzzbuzzbuzz".

The soundproof case is a transparent openable container in the Sharper Image. It is closed and fixed in place.

Test me with "listen / listen to rock / listen to car / get all / open case / put all in case / listen / close case / listen / listen to car".