Re: Inform Telephone


18 Aug 1995 20:02:51 GMT

Arthur LaFrana <lafrana@omni.voicenet.com> wrote:
> Is it possible to create a telephone type device with Inform? I am
> trying to create a situation where a player can type in 'dial 7654321'
> but I am always told that dictionary words must start with a letter.

How about code like this?

Attribute is_telephone;

[ DialSub;
if (second hasnt is_telephone) "You can't dial on that.";
<<Dial second 0>>;
];

Verb "dial" * number "on" is_telephone -> Dial
* number "on" noun -> Dial;

Object Telephone "telephone"
has is_telephone
with name "telephone" "phone",
before [ i;
Dial:
switch (special_number) {
999: "~We'll be right over,~ says the policeman.";
911: "~We'll be right over,~ says the cop.";
100: "There's no operator service on this phone.";
}
];

The `is_telephone' attribute allows the parser to deduce which object
you mean when you type `dial 100' in a room with a telephone, rather
than having to ask you `what you want to dial that on?'.

--
Gareth Rees