Newsgroups: rec.arts.int-fiction
Path: nntp.gmd.de!Dortmund.Germany.EU.net!Germany.EU.net!wizard.pn.com!news.zeitgeist.net!bdt.com!fsc.fujitsu.com!agate!howland.erols.net!netcom.com!erkyrath
From: erkyrath@netcom.com (Andrew Plotkin)
Subject: Re: [Inform] Changing found_in in code
Message-ID: <erkyrathE1nor1.Cpv@netcom.com>
Organization: NETCOM On-line Communication Services (408 261-4700 guest)
X-Newsreader: TIN [version 1.2 PL1]
References: <329ded88@beachyhd.demon.co.uk>
Date: Fri, 29 Nov 1996 23:47:24 GMT
Lines: 55
Sender: erkyrath@netcom23.netcom.com

Adam@beachyhd.demon.co.uk wrote:
> I'm wondering how you set the found_in property, in code, to a number of
> locations rather than just one...

> Consider this object:

>  Object fence "fence"
>     with
>        name "fence",
>        found_in room1 room2 room3
>     has static;


> The fence is quite clearly in room1, room2 and room3. But now let's say that I
> want to write a piece of code that changes it to be in room4, room5 and room6
> -- how do I do that? I've tried:

>     fence.found_in = room4 room5 room6;

> ..but (unsurprisingly) I get the error:

>   Expected ';' but found room5

> How /can/ I write code to set the found_in property to several locations?

You can change the contents of a multi-value property with syntax like

(fence.&found_in)-->0 = room4;
(fence.&found_in)-->1 = room5;
(fence.&found_in)-->2 = room6;

Of course, it's a nuisance to change the number of entries. I think you 
can probably pad with 0 if you want to reduce the number of entries, but 
there's no way to stick more entries in. You'd have to start with some 
padding, like
  with found_in room1 room2 room3 0 0 0,

The real solution is to make the found_in property a function:

with found_in [;
  if (self hasnt general)
    if (location == room1 or room2 or room3)
      rtrue;
  else
    if (location == room4 or room5 or room6)
      rtrue;
  rfalse
],

--Z

-- 

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