[CODE IDEA] Object Timers

From: Mark A. Heilpern (heilpern@MINDSPRING.COM)
Date: 04/22/98


I imped what I'm about to describe in perhaps a total of 8 hours
of coding. I'm not planning to create a patch for it, and this
isn't entended to be a snippet, more of an idea instead - one
you can implement if so desired.

The GET_OBJ_TIMER() field, as gest as I could see, was only
being used for corpse removal (and, most portal spells make use
of it to remove them as well). I started out my changes by creating
a ITEM_DISAPPEARS flag, and in point_update() {limits.c, where
corpse removal is handled} I search all objects, and those with this
flag have the timer decremented and, upon zero, the item is extracted.

This led me to a small problem. After setting the timer value in OasisOLC,
I noticed the value was reset to zero each boot. It turns out the stock
parse_object() does not account for initializing this field. That was a
simple fix.

I have added a timer trigger for DG scripts, (and an otimer command for
them) so the rest of what I did was probably unneccesary. Guess I'm a
coder with too much time on his hands :)

I decided to allow the following actions to happen each time an object
timer reaches zero: load-mob, load-obj, send message, reset timer,
disappear, and damage holder. Any combination of these may occur,
tho not all combinations make sense. (For example, reset timer +
disappear is rediculous.)

When the timer loads another object, if a mob was loaded, the mob gets
the new object. Otherwise, if the object was on a mob/player, that char
gets it. If the object was in something, the new object is in the same thing.
Coupled with disappear, this gives the illusion of one object replacing
another.
So... you tired of bread that never goes bad? Have your bread object replace
itself with a moldy bread object after some number of hours.

Want to create a "dragon egg" which hatches? No problem.

I'm interested in hearing if anyone decides to imp this for themselves, and
in suggestions for other things that should be able to happen upon
timer expiration.

Mark (Sammy @ eQuoria.com 4000)


     +------------------------------------------------------------+
     | Ensure that you have read the CircleMUD Mailing List FAQ:  |
     | http://democracy.queensu.ca/~fletcher/Circle/list-faq.html |
     +------------------------------------------------------------+



This archive was generated by hypermail 2b30 : 12/15/00 PST