Message-ID: <3B4EF9F5.C8168B99@csi.com>
Date: Fri, 13 Jul 2001 09:39:01 -0400
From: John Colagioia <JColagioia@csi.com>
Organization: No Conspiracy Here...
X-Mailer: Mozilla 4.77 [en] (Win98; U)
X-Accept-Language: en,fr,ru,es,it,ga,de,ja,gd,eu
MIME-Version: 1.0
Newsgroups: rec.arts.int-fiction
Subject: Re: [Inform] Property Defaults and Infinite Hats
References: <3B4DFC2F.6CB18B6C@csi.com> <9ikvr6$p5t$1@news.panix.com>
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
NNTP-Posting-Host: 208.34.37.104
X-Original-NNTP-Posting-Host: 208.34.37.104
X-Trace: excalibur.gbmtech.net 995031400 208.34.37.104 (13 Jul 2001 09:36:40 EST)
Lines: 70
X-Authenticated-User: jnc
X-Original-NNTP-Posting-Host: 127.0.0.1
Path: news.duke.edu!newsgate.duke.edu!nntp-out.monmouth.com!newspeer.monmouth.com!howland.erols.net!netnews.com!newsfeed.nyc.globix.net!uunet!ash.uu.net!excalibur.gbmtech.net
Xref: news.duke.edu rec.arts.int-fiction:89741

Andrew Plotkin wrote:
[...]

> > So, I dig around in the library, and find a wonderful routine called
> > ChangeDefault() which, despite not being listed in the IDM, would
> > appear to also do the job I want.  Alas, this provides the same
> > reaction.
> Which is not a surprise, since they do the same thing.

I figured that might be the case, but was unwilling to commit to the idea until I
had verified it in the library.  I'll still have to take your word for it until I'm
keen enough on the technical details to know that:
   @loadw 0 5 -> a;
   b = prop-1;
   @storew a b val;
means "change the superclass's property"...


> I'm not sure what's going on, as I haven't tried it and traced through
> the code. But the library is calling PrintOrRun(i, cant_go). It looks
> like that works its way down to RunRoutines(), which gets confused
> because obj.&cant_go is zero. (Since the object doesn't actually
> provide cant_go.)

Oddly, no.  I did trace through this bit.  GoSub gets to this section, just fine.
 if (k==0 || j==0)
  {   if (i.cant_go ~= 0) PrintOrRun(i, cant_go);
      rfalse;
  }
I even, in fact, added a quick print statement before the cant_go condition, above:

    print "[The cant_go of ", (name) i, "(", i.cant_go, ") is an object of type ",
ZRegion (i.cant_go), "]^";
and, amazingly, I get the reply:
    [The cant_go of Dining Room(10324) is an object of type 2]
So, oddly, cant_go's address is valid, and is in fact a routine.  So everything is
in place, but something is going wrong.


> Cheap fix: hack the library (GoSub()) to do i.cant_go() instead. This
> will break one feature: the library will no longer substitute
> darkness.cant_go for the room's (or the default) cant_go.
>
> I think.

Odd.  I thought I tried this, already.  However, replacing the PrintOrRun() call
with:
    if ((i.cant_go ~= 0) && (metaclass (i.cant_go) == Routine)) i.cant_go();
actually works.

All right, let's look at this with this newfound information.  As you suspected, we
get down to RunRoutines(), and we do fail the obj.&prop test.  The & operation, of
course, denotes an array, and I assume it is there to handle additive properties,
like before().

However, cant_go, not being an array (perhaps due to the use of the ChangeDefault()
function?  player.capacity can be treated correctly, and it seems equivalent to
cant_go in this respect), cannot be accessed through the & operation, which causes
this to fail.

So, presumably, I can make this "all better" by changing:
    if (obj.&prop == 0) rfalse;
in RunRoutines() into:
    if (obj.&prop == 0 && obj.prop == 0) rfalse;
And, lo, it works!

Thanks very much for the pointers!  I doubt I would have gotten that deep without
someone pointing the approximate direction.


