Newsgroups: rec.arts.int-fiction
Path: nntp.gmd.de!news.ruhr-uni-bochum.de!news.rhrz.uni-bonn.de!RRZ.Uni-Koeln.DE!news.duesseldorf.ecrc.net!news.ecrc.de!02-newsfeed.univie.ac.at!01-newsfeed.univie.ac.at!swidir.switch.ch!in2p3.fr!univ-lyon1.fr!howland.erols.net!www.nntp.primenet.com!nntp.primenet.com!netcom.com!erkyrath
From: erkyrath@netcom.com (Andrew Plotkin)
Subject: Re: (Inform) Creating vehicles
Message-ID: <erkyrathDxv3J9.GAn@netcom.com>
Organization: NETCOM On-line Communication Services (408 261-4700 guest)
X-Newsreader: TIN [version 1.2 PL1]
References: <51knn6$6kp@linux.cpsc.ucalgary.ca>
Date: Tue, 17 Sep 1996 05:35:33 GMT
Lines: 45
Sender: erkyrath@netcom10.netcom.com

Brendan Lane (laneb@cpsc.ucalgary.ca) wrote:
> | Vroom!  Vroom!
> | You can't go that way.
>
> which seems rather stupid to me.  I've gotten around the problem with
> the following bit of code:
>
> Object freeway_1 "Freeway"
>   with  ...
>         e_to
>         [;
>         if (player in car) print "You move your car up the freeway.^";
>         return freeway_2;
>         ];

>  The problem is that I have to fiddle with
> the e_to, etc. of every location the car can possibly be (which
> could be a lot of locations).  Is there a way to fix this so that
> I can make the game act like above, but have the code contained
> entirely in the car object?

Yes, but I can't think of it immediately. :-)

I tend to use the format

  e_to [; return CarCanGo(freeway_2); ],

with a function
[ CarCanGo dest;
  if (player in car) 
    print "You move your car up the freeway.^";
  return dest;
];

This is equivalent to what you have, but it's easier to type. And it's 
elegant enough that I probably wouldn't search for a better solution.

You could also write a OnlyCarCanGo() function, of course.

--Z

-- 

"And Aholibamah bare Jeush, and Jaalam, and Korah: these were the
borogoves..."
