Message-ID: <3CDAA146.A03E1B91@attNOSPAMglobal.net>
Date: Thu, 09 May 2002 09:18:15 -0700
From: Chip Hayes <chiphayes@attNOSPAMglobal.net>
X-Mailer: Mozilla 4.72 (Macintosh; U; PPC)
X-Accept-Language: en
MIME-Version: 1.0
Newsgroups: rec.arts.int-fiction
Subject: Re: [Inform] Problems with sticky label example?
References: <20020419114145.26402.00002333@mb-ff.aol.com> <3CC0415F.60B7D3D5@attNOSPAMglobal.net> <e6fc9551.0205090801.e0e0e44@posting.google.com>
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
NNTP-Posting-Host: 32.101.251.59
X-Trace: 9 May 2002 16:12:04 GMT, 32.101.251.59
Organization: Global Network Services - Remote Access Mail & News Services
Lines: 53
X-Complaints-To: abuse@prserv.net
Path: news.duke.edu!newsgate.duke.edu!news-hog.berkeley.edu!ucberkeley!news.maxwell.syr.edu!newsfeed.us.prserv.net!prserv.net!news3.prserv.net!32.101.251.59
Xref: news.duke.edu rec.arts.int-fiction:104084



Kathleen wrote:

> Finally got things such that I could give it a try, and it worked
> (Thanks for the pointer!!!!)
>
> Well, sort of worked. <sigh> What I discovered late last night (and
> it's always possible it could be a side effect of other bits of code,
> of course) is that the hook.saystuck() bit prints BEFORE the
> description of the object it's attached to.
>
> That is, if (using the example from 498) hook.saystuck() prints: "^A
> Wiggly Worm is attached to the fishing hat.^"  (^ use as dictated by
> the example code), and the description for the fishing hat is "A
> filthier scrap of cloth would be hard to find.", I ended up with:
>
> >X HAT
>            <-- note space from "^" in saystuck()
> A Wiggly Worm is attached to the fishing hat.
> A filthier scrap of cloth would be hard to find.
>
> ... hmmm.  Perhaps react_before's Examine should be moved to
> react_after?  (I ran out of time last night to give it a try.)
>
> Kathleen (... unless one of my superclasses is causing wierdness)
>

Kathleen...

No, I had to mess around with the code a bit to make it work as well
(and my game has yet to be beta-tested, so I'm sure I'll find some
problems of my own.) I ended up using a react_after on the object.
Here's the react_after routine from my object's code (call my object
"red label" for example purposes):

react_after
	[ x; x=self.number; if (x==0) rfalse;
		Examine, Look: if (TestScope(x, player))
				print "^A red label is stuck to ", (the) x, ".^";
		Inv:  if (x in player)
				print "^A red label is stuck to ", (the) x, ".^";
	],

The label's number property, as in the DM's example, holds the object
number it is stuck to, or 0 if it's not stuck to anything.

Now, this isn't elegant, as it prints a seperate line at the bottom of a
room description, object description, or inventory listing, but it does
get the point across, and in the proper order. Placement of the new_line
carats are a matter of personal taste.

Chip
