Newsgroups: rec.arts.int-fiction
Path: news.duke.edu!newsgate.duke.edu!nntp-out.monmouth.com!newspeer.monmouth.com!news.maxwell.syr.edu!jfk3-feed1.news.digex.net!dca6-feed2.news.digex.net!intermedia!newsfeed1.cidera.com!news-reader.ntrnet.net!uunet!ash.uu.net!world!buzzard
From: buzzard@world.std.com (Sean T Barrett)
Subject: Re: [Inform] grammar scoping problems
Message-ID: <GH16Lo.2LB@world.std.com>
Date: Wed, 25 Jul 2001 13:24:59 GMT
References: <20010725015334.01946.00000915@ng-bd1.aol.com>
Organization: The World Public Access UNIX, Brookline, MA
Lines: 33
Xref: news.duke.edu rec.arts.int-fiction:90191

MFischer5 <mfischer5@aol.com> wrote:
>Verb 'xyzzy' * 'with' noun 'to' scope=AfbScope  -> DoSomething;
>
>The problem is that I need AfbScope to know what object was selected for noun
>so it can add the proper objects to scope. After reading DM4, and plowing
>through the library code, I'm pretty sure I can't do it, but I thought I'd ask
>the experts here as a last resort.

I've never done this, but I believe the following should work.
There may be better solutions--I'm pretty sure we've seen this
question before, but I don't know how to phrase a google query
to find it.

DM4 describes how to add a third object (e.g. from a
second prepositional phrase) by writing a custom grammar
routine (not a scope=blah), and storing the result in a global
variable. Hmm, what a pain to search for, since there's no keyword
associated with it. Ok, here you go. Exercise 91 on p 229, but
you might as well turn straight to the solution on p489 and
cut and paste that. (The detailed explanation of the technique
is on p226, but NounDomain() is only mentioned in the exercise
and is the crucial thing to making this easy.)

If you use that technique for your "'with' noun" above,
you can stick the "with" object into a global variable
that AfbScope can reference.

However, you will lose things like before/after behaviors
for the "with" object (I guess the AfbScope object becomes 'noun'),
but those can be manually implemented in DoSomethingSub if
they're needed.

SeanB
