§9.9. Televisions and Radios

IF authors often provide clues or background information to the player by means of radio broadcasts, TV shows or video tapes because they can talk to the player without needing to listen back, or to react to what the player does. The simplest radio set, like the one in Aftershock, really only has one thing to say: which is serendipitously being broadcast just at the moment the player tunes in (regardless of when that is). The next simplest approach is to spool a broadcast on an endless loop taking several turns to play through, as in Radio Daze.

Televisions come in all shapes and sizes, and Aspect allows their shape ("aspect ratio") to be described by the player.

In Channel 1, we can also refer to the television by what it is currently showing: thus WATCH CHANNEL 4 will work if the set is indeed tuned to 4. In Channel 2, numbered channel changing is taken further: we can now TUNE TV TO CHANNEL 3, as well. Channel 2 is a reasonable base implementation of a television for many purposes.


arrow-up.pngStart of Chapter 9: Props: Food, Clothing, Money, Toys, Books, Electronics
arrow-left.pngBack to §9.8. Simple Machines
arrow-right.pngOnward to §9.10. Telephones

*ExampleRadio Daze
A radio that produces a cycle of output using varying text.

*ExampleAspect
Understanding aspect ratios (a unit) in the names of televisions.

**ExampleChannel 1
Understanding channels (a number) in the names of televisions.

Our previous implementation of televisions ("Channel 1") doesn't allow the player to type things like

TUNE FIFTIES TELEVISION TO CHANNEL 4

nor does it deal with player input like

TUNE TO CHANNEL 4 ON FIFTIES TELEVISION

or

TUNE TO CHANNEL 4

where no television is specified. When we are designing commands which involve two elements (here, a television and a channel number), it's usually a good idea to allow the player to specify those elements in either order, as we saw demonstrated briefly in "New commands for old grammar".

We might, therefore, want to add a few refinements: first by defining a "[channel]" token that will accept input of the forms "[number]" and "channel [number]", and second by creating some additional "Understand" lines that will accept variant versions of the player's input.

paste.png "Channel 2"

Section 1 - Televisions in General

A television is a kind of device.

A television has a number called the channel. Understand the channel property as referring to a television. Understand "channel" as a television.

Changing the channel of it to is an action applying to one thing and one number.

Understand "tune [television] to [channel]" or "change channel of [television] to [channel]" as changing the channel of it to.

Understand "tune [something] to [channel]" or "change channel of [something] to [channel]" as changing the channel of it to.

Understand "tune to [channel] on [television]" or "change to [channel] on [television]" as changing the channel of it to (with nouns reversed).

Understand "tune to [channel] on [something]" or "change to [channel] on [something]" as changing the channel of it to (with nouns reversed).

Understand "[number]" or "channel [number]" as "[channel]".

Check changing the channel of something to:
    if the noun is not a television, say "[The noun] cannot be tuned to a channel." instead.

Carry out changing the channel of something to:
    now the channel of the noun is the number understood.

Report changing the channel of something to:
    say "You tune [the noun] to channel [number understood]."

Instead of examining a television:
    if the noun is switched off, say "[The noun] is currently turned off." instead;
    let the chosen channel be the channel of the noun;
    if the chosen channel is a current channel listed in the Table of Television Channels:
        choose row with current channel of the chosen channel in the Table of Television Channels;
        say "[output entry][paragraph break]";
    otherwise:
        say "Snow fills the screen of [the noun]."

Table of Television Channels

current channel

output

0

"The screen of [the noun] is completely black."

Section 2 - The Scenario

The Office is a room.

The widescreen TV is a television in the Office. The fifties TV is a television in the Office.

And we add the scenario-specific content to our Table of Television Channels; in the case of channel 13, we provide for a changing sequence of events using text variations.

Table of Television Channels (continued)

current channel

output

4

"A gloomy female news anchor describes the latest car bomb in Baghdad: 104 dead today, and no sign of change."

5

"A couple of contestants in spangled scarlet outfits are performing an energetic paso doble."

13

"[one of]On-screen, Ichiro is up to bat with one man on second and no outs.[or]Ichiro has singled to first and the other man is on third.[or]The next batter is in the middle of flying out.[or]Everything looks rosy until the men in black pull off a double-play and retire the side.[or]The channel has cut to a commercial.[stopping]"

Test me with "test one / test two".

Test one with "change channel of fifties tv to 4 / x channel 4 / switch on fifties / x channel 4 / switch on widescreen / tune fifties tv to channel 5 / x channel 5 / x fifties tv / x channel 4".

Test two with "tune to channel 13 / widescreen / tune channel 13 to channel 5 / tune channel 5 to channel 3 / widescreen / x channel 3".

***ExampleChannel 2
Understanding channels (a number) in the names of televisions, with more sophisticated parsing of the change channel action.

Our previous implementation of televisions ("Channel 1") doesn't allow the player to type things like

TUNE FIFTIES TELEVISION TO CHANNEL 4

nor does it deal with player input like

TUNE TO CHANNEL 4 ON FIFTIES TELEVISION

or

TUNE TO CHANNEL 4

where no television is specified. When we are designing commands which involve two elements (here, a television and a channel number), it's usually a good idea to allow the player to specify those elements in either order, as we saw demonstrated briefly in "New commands for old grammar".

We might, therefore, want to add a few refinements: first by defining a "[channel]" token that will accept input of the forms "[number]" and "channel [number]", and second by creating some additional "Understand" lines that will accept variant versions of the player's input.

paste.png "Channel 2"

Section 1 - Televisions in General

A television is a kind of device.

A television has a number called the channel. Understand the channel property as referring to a television. Understand "channel" as a television.

Changing the channel of it to is an action applying to one thing and one number.

Understand "tune [television] to [channel]" or "change channel of [television] to [channel]" as changing the channel of it to.

Understand "tune [something] to [channel]" or "change channel of [something] to [channel]" as changing the channel of it to.

Understand "tune to [channel] on [television]" or "change to [channel] on [television]" as changing the channel of it to (with nouns reversed).

Understand "tune to [channel] on [something]" or "change to [channel] on [something]" as changing the channel of it to (with nouns reversed).

Understand "[number]" or "channel [number]" as "[channel]".

Check changing the channel of something to:
    if the noun is not a television, say "[The noun] cannot be tuned to a channel." instead.

Carry out changing the channel of something to:
    now the channel of the noun is the number understood.

Report changing the channel of something to:
    say "You tune [the noun] to channel [number understood]."

Instead of examining a television:
    if the noun is switched off, say "[The noun] is currently turned off." instead;
    let the chosen channel be the channel of the noun;
    if the chosen channel is a current channel listed in the Table of Television Channels:
        choose row with current channel of the chosen channel in the Table of Television Channels;
        say "[output entry][paragraph break]";
    otherwise:
        say "Snow fills the screen of [the noun]."

Table of Television Channels

current channel

output

0

"The screen of [the noun] is completely black."

Section 2 - The Scenario

The Office is a room.

The widescreen TV is a television in the Office. The fifties TV is a television in the Office.

And we add the scenario-specific content to our Table of Television Channels; in the case of channel 13, we provide for a changing sequence of events using text variations.

Table of Television Channels (continued)

current channel

output

4

"A gloomy female news anchor describes the latest car bomb in Baghdad: 104 dead today, and no sign of change."

5

"A couple of contestants in spangled scarlet outfits are performing an energetic paso doble."

13

"[one of]On-screen, Ichiro is up to bat with one man on second and no outs.[or]Ichiro has singled to first and the other man is on third.[or]The next batter is in the middle of flying out.[or]Everything looks rosy until the men in black pull off a double-play and retire the side.[or]The channel has cut to a commercial.[stopping]"

Test me with "test one / test two".

Test one with "change channel of fifties tv to 4 / x channel 4 / switch on fifties / x channel 4 / switch on widescreen / tune fifties tv to channel 5 / x channel 5 / x fifties tv / x channel 4".

Test two with "tune to channel 13 / widescreen / tune channel 13 to channel 5 / tune channel 5 to channel 3 / widescreen / x channel 3".

***ExampleAftershock
Modifying the rules for examining a device so that all devices have some specific behavior when switched on, which is described at various times.