Alias
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.
Now we borrow some techniques from the Understanding chapter to set up dialing actions:
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:
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:
And what if we'd like to have the player learn some phone numbers during the game?
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:
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".
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?