Re: Inform: Pushing buttons..


18 Sep 95 10:10:28

Sam Hulick (shulick@apricot.ucs.indiana.edu) wrote:

> This is confusing. I just want to assume taht there is, say, a panel w/
> lettered buttons on it, and the player can press the buttons. I tried
> this:
>
> Object someroom "some room"
> with before [;
> PushIt: if (special_word == 's') "You pressed S.";
> "Nothing happens.";
> ],
> has light;
>
> [ PushItSut;
> "You can't push that.";
> ];
>
> Extend "push" replace
> * special -> PushIt;
>
> Why doesn't this work? It just says "You can't push that" every time I
> try "push s".

I think one problem (I don't know if there are others, as I don't have
the time to test it) is that 's' is *not* a dictionary word, as one
might expect; it's a character constant.

So the first step would be to change the test to something like

if (special_word == #n$s)

which seems to be the constant-form needed for one-letter dictionary
words, though I believe it can be used for longer words, as well, but
#n$foobar isn't as readable as 'foobar'. (See, for example, the
YesOrNo() function in VerbLib.)

_
Torbjorn Andersson