Reply-To: "Kent Tessman" <kent@remove-to-reply.generalcoffee.com>
From: "Kent Tessman" <kent@remove-to-reply.generalcoffee.com>
Newsgroups: rec.arts.int-fiction
References: <feri6us1jpulb61i059b6ig2p1u159pfo2@4ax.com>
Subject: Re: [HUGO] How to allow inspection of room components
Lines: 68
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2600.0000
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000
Message-ID: <VQpa8.16730$NP4.2197073@news20.bellglobal.com>
Date: Wed, 13 Feb 2002 03:54:15 -0500
NNTP-Posting-Host: 65.92.69.189
X-Complaints-To: abuse@sympatico.ca
X-Trace: news20.bellglobal.com 1013590453 65.92.69.189 (Wed, 13 Feb 2002 03:54:13 EST)
NNTP-Posting-Date: Wed, 13 Feb 2002 03:54:13 EST
Organization: Bell Sympatico
Path: news.duke.edu!newsgate.duke.edu!news-hog.berkeley.edu!ucberkeley!sunqbc.risq.qc.ca!torn!webster!nf1.bellglobal.com!nf2.bellglobal.com!news20.bellglobal.com.POSTED!not-for-mail
Xref: news.duke.edu rec.arts.int-fiction:99572

"Dana Clarke" <joeynipp@bellsouth.net> wrote in message
news:feri6us1jpulb61i059b6ig2p1u159pfo2@4ax.com...
> In general, I am interested in how others (not just HUGO users) have
> handled situations where you wish the character to be able to (for
> instance) inspect one wall independant of the others.  As far as I can
> tell (in HUGO) the walls are just assumed parts of the class 'room'
> and not really dealt with.  Does one make a scenery item called "west
> wall" (for instance) and then redirect inspections to that object?

I would recommend something like that.  More specifically, I've personally
done something along the lines of:

attribute inside

room interior
{
    is inside
}

room exterior
{}

! Then you can derive your rooms from 'interior' and 'exterior',
! rather than the one 'room' class.

scenery west_wall "west wall"
{
    found_in
    {
        if location is inside
            return location
        else
            return nothing
    }
    ...
}

This will let you refer to the west wall as an object in the current
location whenever the location is an interior.  Otherwise, the wall won't be
present (i.e., it will be found_in 'nothing').

You could abstract this one step further into an interior wall class by
doing instead:

scenery interior_wall
{
    found_in
    {
        if location is inside
            return location
        else
            return nothing
    }
    ...
}

interior_wall west_wall "west wall"
{
    ...
}

which will save you from having to implement found_in on each interior wall
object.

--Kent



