Message-ID: <3B4DFC2F.6CB18B6C@csi.com>
Date: Thu, 12 Jul 2001 15:36:15 -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: [Inform] Property Defaults and Infinite Hats
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 994966216 208.34.37.104 (12 Jul 2001 15:30:16 EST)
Lines: 72
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!news.maxwell.syr.edu!netnews.com!newsfeed.nyc.globix.net!uunet!ash.uu.net!excalibur.gbmtech.net
Xref: news.duke.edu rec.arts.int-fiction:89702

OK, technically, there are two questions, but here goes:

First, changing defaults for objects.  Let's say I don't like "You
can't go that way" as an no-exit response to a room.  Fine.  I look in
the library, and the library says that "PrintOrRun()" is executed on
loc.cant_go.  Good, good.  That means I can use a routine and maybe
mock the player at random, remember how many times he's bumped his
head, start dealing damage if this idiocy becomes excessive, or
whatever.  And, yes, I can set loc.cant_go to any string or routine I
want.  That's the good news.

The bad news is that I want this to happen everywhere.  All right,
fine.  I look in the Designer's Manual.  Section 3.13 has a nifty
example which does exactly what I want.  I set loc.Object::cant_go, and
life should be good, right?  Well, no.  That works fine with constant
strings, but fails rather...oddly for functions.  Specifically, if I
make cant_go a function, nothing prints at all.  That is, I get:
    > n

    >
as a transcript.

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.

My question, therefore, is:  Does anybody have any ideas (other than
creating a "locations" class, which I'm not yet sure I want to do, for
rather obscure reasons--but which DOES work, however) as to how one
might be able to use a function to handle cant_go?

OK, now the second question.  In a "Freakazoid!" cartoon, once,
Freakazoid was trapped in 1941, and summed up the era with "all men
wear hats."  Ignore, for the moment, the argument of whether or not
this is an accurate depiction of anything.  So, let's say I'm modelling
this environment (I'm not, but it makes a handy example).

Assume I have a dozen or so NPCs, each of which (being a man in 1941 in
that particular cartoon) is wearing a hat.  For space efficiency
reasons, and also clarity of code, I would rather not create a hat for
each NPC, especially since the player wouldn't, presumably, be allowed
to wander around collecting people's hats.  A military installation
where everyone wears an identification badge would be similar, of
course.

This seems logical enough, of course.  For every NPC, add the hat (or
fingerprint, or badge, or Kirlian aura, etc.) to his scope.  Poof.
Every man now wears a hat.

Except that, without some majorly ugly programming with they're all the
same hat.  I mean, sure, I can probably hack up a parse_name to read
who's hat we're looking at, then set a flag, and read the flag during
all reaction properties (describe, before, etc.).  However, the
resulting code is pretty much guaranteed to be nightmarish, I suspect.
Probably worse to read than write, but that certainly won't make
bugfixes any easier.

Looking at parent(hat) would be nice and simple, obviously, but alas
hasn't the foggiest chance of working, since the parent of the hat
isn't any particular NPC.

My inclination is that there must be a way, without resorting to
unreadable parsing gimmicks, to determine whose hat I'm examining.
Surely, I'm missing some facility already in the Inform library that
can be exploited or neatly leveraged, rather than trying to parse
something so ugly "by hand."  Is there such a facility lurking in the
depths of Inform?

Thanks to anyone who might be able to deceipher all that...


