MOO-cows Mailing List Archive
[Prev][Next][Index][Thread]
[pravn@mvp.com: Re: parents and locking, listening etc]
------- Start of forwarded message -------
Return-Path: moo-cows-errors@parc.xerox.com
From: Petrea Mitchell <pravn@mvp.com>
Subject: Re: parents and locking, listening etc
To: tim@itchen.hants.gov.uk
Date: Mon, 10 Mar 1997 14:19:58 PST
Cc: moo-cows@parc.xerox.com
In-Reply-To: <332443A8.46A9@itchen.hants.gov.uk> from Tim MacLachlan at "Mar 10, 97 09:23:52 am"
X-Mailer: ELM [version 2.4ME+ PL22 (25)]
MIME-Version: 1.0
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit
Sender: MOO-Cows-Errors@parc.xerox.com
Precedence: bulk
> I have an object which is a parent 'generic beer'#380. An object
> 'barmaid' creates() a child of the generic beer when a player
> asks for a beer. The child beer emotes messages 4 times then recycles
> itself. However, if the player doesnt drink the beer enough so that
> the object recycles itself I dont want the player to be able to
> leave the tavern if they still have the child beer object on them.
> (Else my quota will run out!).
[...]
You can't lock an exit with classes, and you're forgetting that people
can teleport out anyway. But there are ways around this.
Solution #1: @verb <room>:exitfunc tnt rxd
Have exitfunc check args[1].contents (or, if you're really paranoid, use
$object_utils:all_contents()) for children of the generic beer. Call
$recycler:_recycle (<beer>) when you find one. (If your MOO doesn't use
the LambdaCore, then just use "recycle (<beer>)".) If your generic beer
is fertile, then make sure to check that the beers you're recycling are
really yours first.
Solution #2: @verb <beer>:create tnt rxd
Use fork() (or, better, your local in-db scheduler if you have one) here
to spawn a task to recycle the beer after a certain amount of time. This
code will be activated every time a child of the generic beer is brought
into being through any means-- @create, @chparent, function calls, whatever.
Two potential problems here: if the beer is fertile, your code won't be
able to recycle the beers that other people create unless you're a wizard
(and even then, do you necessarily want to recycle them?), and if a lot of
beers are created, that means a lot of forked tasks lying around. You could
set up the barmaid as a rudimentary scheduler if you're worried about this.
In this and the next solution, you'll also need to modify <beer>:recycle
to somehow kill the forked task if the beer is recycled before its time.
Solution #3: Modify the barmaid
Essentially the same as #2, only add the fork to the code on the barmaid
that produces the beer, thereby recycling only the beers that she creates.
Make sure to add a "pass (@args)" somewhere when you modify :create,
:recycle, or :exitfunc, to avoid the possibility of Bad Things happening.
> Also, I want to create an object that 'listens' in a room and runs
> a verb when a certain string is matched...I'm wondering what the best
> way of doing this is. I hacked the #0:notify verb so that it
> also sent the message to the object in a room if it is a child of
> a generic 'puppet' (an object that will listen).
I think you're getting too complicated here-- in the LambdaCore at least,
$room:announce(), :announce_all, and :announce_all_but don't discriminate
between players and other objects. Put your string-matching code in
<object>:tell().
Or am I missing something here...
Mitchell aka Spindizzy aka the Information Overload Wizard
- --
/
Petrea Mitchell <|> <|> <pravn@mvp.com> <pem4958@is.nyu.edu>
"What sort of man takes the `frau' out of Jungfrau, Lewis?"
"The sort who gets strangled for his jokes, sir?" ---Mystery!
------- End of forwarded message -------
Home |
Subject Index |
Thread Index