A telephone with phone numbers of the standard American seven-digit length.

Seven-digit telephone numbers are too long for Inform to handle when compiling to the Z-Machine, but they will work under Glulx. To have this example succeed, make sure that you have selected the Glulx option in your settings menu.

"Alias"
A telephone is a kind of thing. Understand "phone" or "telephone" as a telephone.
A phone number is a kind of value. 999-9999 specifies a phone number.

Now we borrow some techniques from the Understanding chapter to set up dialing actions:

Understand "dial [phone number] on [telephone]" as dialing it on. Understand "dial [phone number] on [something]" as dialing it on.
Understand the commands "phone" or "telephone" or "call" as "dial".
Understand "call [text]" or "phone [text]" or "dial [text]" or "telephone [text]" as a mistake ("That's not a number you know.").
Dialing it on is an action applying to one phone number and one thing.
Report dialing it on:
   say "You dial [the phone number understood]."

This much is enough to let us dial telephone numbers and have Inform report that we've done so; it doesn't actually provide a telephone system such that we could reach and converse with other characters (but see the other telephone examples in the recipe book for more on how one might do that).

We'll set up a little political espionage scenario from which our player can make calls:

The Senator's Junior Suite is a room. "The Senator appears, unfortunately, to have very precise habits: little in the room has been moved from its usual place; the trash can is empty; the bed has been remade[if the blue paper is unexamined]. There may in fact be nothing to find here[end if]."
The bed is an enterable scenery supporter in the Junior Suite.
The player is wearing a housekeeping uniform and a brunette wig. The player carries a telephone called a Nokia.

Borrowing again from the chapter on Understanding, we might arrange things so that the player knows and can call a few standard numbers with such syntax as CALL HOME:

Understand "home" as 555-9200.

And what if we'd like to have the player learn some phone numbers during the game?

A thing can be examined or unexamined. Carry out examining something: now the noun is examined.
Understand "Stephen" as 555-2513 when the blue paper is examined.

This will understand CALL STEPHEN once the paper is examined; before that, the player will just get the "That's not a number you know" response that Inform uses for all attempts to call unknown names.

We'd better plant this paper for the player to find:

The blue paper is in the drawer. The description of the blue paper is "It reads: 'Call Stephen - 555-2513'."
The drawer is part of the dresser. It is closed and openable. The dresser is in The Senator's Junior Suite. The lamp is on the dresser. The description of the dresser is "The single drawer is [if the drawer is open]open[otherwise]shut[end if]."
Test me with "dial 555-9999 / call home on the telephone / phone the president / call stephen / open drawer / read paper / call stephen / put phone in drawer / close drawer / call stephen".
Test me with "dial 555-9999 / call home on the telephone / phone the president / call stephen / open drawer / read paper / call stephen / put phone in drawer / close drawer / call stephen".
Senator's Junior Suite
The Senator appears, unfortunately, to have very precise habits: little in the room has been moved from its usual place; the trash can is empty; the bed has been remade. There may in fact be nothing to find here.

You can see a dresser (on which is a lamp) here.

>(Testing.)

>[1] dial 555-9999
(on the Nokia)
You dial 555-9999.

>[2] call home on the telephone
You dial 555-9200.

>[3] phone the president
That's not a number you know.

>[4] call stephen
That's not a number you know.

>[5] open drawer
You open the drawer, revealing a blue paper.

>[6] read paper
It reads: "Call Stephen - 555-2513".

>[7] call stephen
(on the Nokia)
You dial 555-2513.

>[8] put phone in drawer
You put the Nokia into the drawer.

>[9] close drawer
You close the drawer.

>[10] call stephen
What do you want to call that on?