Re: [SPELL] Question about objects & owners.

From: Mark A. Heilpern (heilpern@MINDSPRING.COM)
Date: 08/19/98


At 03:50 PM 8/19/98 -0400, you wrote:
>  I made a clone spell, that clones a piece of EQ or a weapon, and then
>fires off an event, and after so many minutes, it extracts the object.
>Everything works fine, but I am curious how to resolve a few things. If
>someone were to give the object to another player, how would I switch the
>ch pointer to the new owner? I need to do this because as the item fades,
>it gives messages to the caster. If the caster gives it away and quits,
>MUD will probably crash (I have not tested this because I assume thats
>what will happen). Is there a way to check to make sure the person that is
>either wielding it or in its inventory is the same as the ch pointer in
>the event structure?

If the object is in a character's inventory, obj->carried_by is the ch. If the
object is being worn/wielded, obj->worn_by is the ch. If the object is inside
another object, obj->in_obj is the object it is in. If the object is in a
room,
in the open, obj->in_room is not -1.

On the event issue, keep in mind that extract_obj() is called for all
objects that
are rented when the player quits. (Non-rented objects will remain in the
game.)
Any decent event system allows events to be associated with objects and/or
characters and, in the extract() routine, terminates the event. Assuming yours
does this, what you need to consider is a) should the event pick up when the
object is un-rented? and b) if not, will quitting/restarting the game be a
loop-
hole to keeping the clone?   My personal thoughts would be to give any
cloned object the NORENT flag; this will alleviate the issue.


>OffTopic:
>  To help me with Circle programming, I am looking to pick up a book on
>Data Structures that is well written, and does not introduce multiple
>concepts in single examples. Could anyone point me in the right direction?

I learned C from Kerrighan and Ritchie.... and 10 years or so later I realized
that I finally understood pointers.


     +------------------------------------------------------------+
     | 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