Re: receptionist actions

From: George Greer (greerga@circlemud.org)
Date: 02/08/02


On Thu, 7 Feb 2002, Daniel A. Koepke wrote:

>On Fri, 8 Feb 2002, Kras Kresh wrote:
>
>> >  if (!ch->desc || IS_NPC(ch))
>> >    return (FALSE);
>> >
>> >  if (!cmd && !number(0, 5)) {
>> >    do_action(recep, NULL, find_command(action_table[number(0, 8)]), 0);
>> >    return (FALSE);
>> >  }
>>
>> Ooo... I see now... The first check made it impossible to complete the
>> second.
>
>I'm obviously not seeing what you are.  The first check leaves the
>special procedure if the person calling it is an NPC or linkdead PC (as
>is the case with NPC/forced commands, or NPC activity calls); the second
>checks if the special procedure has been invoked by something other than
>a command or NPC activity (i.e., fighting).

I was a little confused too so I investigated:

Situation 1: Somebody typed a command.
  !ch->desc -> passes (as in: we continue the function)
  IS_NPC(ch) -> passes
  !cmd -> fails (as in: we don't do anything/abort the function)
So nothing gets done there.

Situation 2: Random mobile activity.
  !ch->desc -> fails
  IS_NPC(ch) -> fails

Why? Because a random mobile activity uses the mobile itself for the
victim (mobact.c):

    /* Examine call for special procedure */
    if (MOB_FLAGGED(ch, MOB_SPEC) && !no_specials) {
      if (mob_index[GET_MOB_RNUM(ch)].func == NULL) {
        log("SYSERR: %s (#%d): Attempting to call non-existing mob function.",
                GET_NAME(ch), GET_MOB_VNUM(ch));
        REMOVE_BIT(MOB_FLAGS(ch), MOB_SPEC);
      } else {
        char actbuf[MAX_INPUT_LENGTH] = "";
        if ((mob_index[GET_MOB_RNUM(ch)].func) (ch, ch, 0, actbuf))
          continue;             /* go to next char */
      }
    }

--
George Greer
greerga@circlemud.org

--
   +---------------------------------------------------------------+
   | FAQ: http://qsilver.queensu.ca/~fletchra/Circle/list-faq.html |
   | Archives: http://post.queensu.ca/listserv/wwwarch/circle.html |
   | Newbie List:  http://groups.yahoo.com/group/circle-newbies/   |
   +---------------------------------------------------------------+



This archive was generated by hypermail 2b30 : 06/25/03 PDT