Re: Inform Telephone


Mon, 21 Aug 1995 18:31:39 BST

lafrana@omni.voicenet.com (Arthur LaFrana) 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.
> Thanks for any suggestions, I'm sure the answer is easy but for some
> reason I have hit a blind spot as to the solution.

You can certainly do "dial <number>". You need to check the special_number
variable on entry. The only problem is that the numbers understood by the
library's number parsing code only go up to 10000 - anything higher comes
out as 10000. You could write your own parsing code by specifying a routine
in the grammar line, but that's getting a bit more complex.

Normally, the grammar is "dial <number> on phone" or somesuch. You'll need
to code up a VagueDial routine that works out the obvious candidate to dial
on, from things in scope at the moment.

What's fun to implement is talking to people who are on the other end of
the line.

Of course, you can talk to the phone:

>Ask phone about curses

and pass the "Hello" to whatever object's listening on the phone. And you
can allow the person on the phone to be referred to in speech by writing a
scope routine that adds someone on the other end of a phone to scope, by
changing some grammar lines to use it:

extend "ask" replace
* scope=speakscope "about" special ->Ask;

[ SpeakScope i;
if (scope_stage==1)
rfalse;
if (scope_stage==3)
"You seem to want to talk to someone, but I can't see whom.";
scopewithin(location);
objectloop (i in player)
{
if ((i has is_phonetop)&&(i.connectedto~=0))
placeinscope(i.connectedto);
}
objectloop (i near player)
{
if ((i has is_phonetop)&&(i.connectedto~=0))
placeinscope(i.connectedto);
}
];

>Ask directory enquiries about xallow

But you can't change it so that you can speak to things this way:

>operator, 57

because talking with a comma hasn't a grammar line!

At the moment, I'm adding things on the phone to scope using the global
InScope routine when the global "lookingforpeopletospeakto" is set, and
kludging the parser to set this. When looking for people to speak to.
Obviously.

Can anyone think of a more elegant way of doing this?

BCNU, AjC

PS. Hooray for the 'switch' statement in Inform 5.5! Ta very much, Graham!