MOO-cows Mailing List Archive

[Prev][Next][Index][Thread]

Re: object dating



On Mon, 11 Sep 1995, Linda Polin wrote:

> Is there a way to tell the date/time a player's objects were created or
> last modified? Obj#'s recycle and so numerical order doesn't work.
> 
> Linda

The best way I can think of, even though it may take a while to do, is this:

1) If you don't have $server_options, then create it (simply @create #1 
named Server Options, and put its # in a property on #0 called 
'server_options')

2) Make a property on #1 called 'created'.  Ofcourse, make sure that it's -c.

3) Add a property to it, called 'protect_create'.  This'll wiz-only the 
'create' builtin.

4) Make your own create() verb in-database, #0:create.  It'll just return 
$server_options:create(@args).

5) Make $server_options:create.  Put all your code in there to put time() 
in each object's .created property, after it calls the create() builtin 
with the caller permissions and checks for errors.  You can also put any 
other restrictions on create() in here.

	(NOTE:  if the object being created is not a descendant of #1, 
you may want to return E_PERM or E_INVARG, since it wouldn't inherit the 
.created property)

6) Change every reference to create() in the database to #0:create().  
I'm not sure how many times it's called in the database.  It may be only 
a couple or it may be a lot.

If you're going to do this, I also would suggest protecting the 
'chparent' builtin and making it check to see if the object is being 
chparented to something that doesn't have the .created property (ie #-1), 
and return E_PERM or E_INVARG if so.

Ofcourse, unless you're an accomplished MOO programmer, you would 
probably find the task of making date/time stamps a little imposing.  
Never fear, there are other ways to do it, even though I don't think that 
they are as foolproof and accurate as this one.  For instance, anyone 
can get around the #1:initialize fix by simply programming their own 
:initialize verb on the parent object.  If you do choose to try 
programming it this way, you just may learn something. :-)

Phantom


References:

Home | Subject Index | Thread Index