Re: [Code][MobProc][Help][Question] Banker Proc

From: Jared Buckley (jaredb@TI.COM)
Date: 03/19/98


Lethal,

        One of the things that was difficult for me to understand
when I first tried this was how the SPECIALs for MOBs are really
called.  (Someone please stop me if I've got this wrong.)  Basically
there are four situations when the MOBs special proc might be called:

    1)  As a result of mobile_activity() in mobact.c
    2)  A player takes some action in the same room.
    3)  Another MOB does something in the room.
    4)  During a fight.  (perform_violence in fight.c)

As you can see from below, from structs.h:
#define SPECIAL(name) \
   int (name)(struct char_data *ch, void *me, int cmd, char *argument)

when the SPECIAL is called, there is only one char_data structure
passed to the special proc.  The second parameter, me, is a void
pointer to the "owner" of the special proc.  (I'm assuming this is
true because SPECIAL can theoretically be called for a MOB, a room,
or an object.)  To use the second parameter, you've got to either
cast the void pointer to the appropriate structure type, or set a
pointer of the appropriate type (char_data, etc) to point to me.

Anyway, to answer your question specifically, under any of the
four conditions above, the parameter ch is always the entity that
caused the SPECIAL to be called.  For instance, in case 1,
both ch and me point to the "owner" of the special proc.
In case 2, ch points to the player character; in case 3, it points
the other MOB in the room that caused the action.  You'll have to
verify case 4 for yourself because I haven't tested it extensively.

So, in this case to refer to the player, you'd use ch.  Remember though
that your SPECIAL is going to get called more often than it would
at first appear.  Hope this helps,

Jared

Lethal Access wrote:
>
> This is driving me crazy.. does anyone have a viable solution to this?
> Has anyone
> tried incorporating something like this with Circle3.0bpl+ ???
>
> How would I go about telling the banker that tch is the person who said
> the
> command? I've tried several different things. Either they diddn't
> compile, they
> diddn't work, or they crashed on me... here's what I started out
> with....
> [snip]


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