[Code] [Help] special procedure doesn't work

From: Nathan Ridley (legendd@CYBERELECTRIC.NET.AU)
Date: 11/23/97


 I'm trying to make a special procedure for a goat which eats the first object
in the player's inventory. It doesn't work of course, so perhaps somebody
could
help me find what i'm doing wrong.

here's what i've done:

in spec_assign.c added:

  SPECIAL(snake);
  SPECIAL(thief);
  SPECIAL(magic_user);
+  SPECIAL(goat);


in spec_procs.c added:

SPECIAL(goat)
{
  struct char_data *cons;

  if (cmd)
    return FALSE;

  if (GET_POS(ch) != POS_STANDING)
    return FALSE;

  for (cons = world[ch->in_room].people; cons; cons = cons->next_in_room)
    if (!IS_NPC(cons) && (GET_LEVEL(cons) < LVL_IMMORT) && (!number(0, 4))) {
            npc_eatobj(ch, cons, ch->carrying);
      return TRUE;
    }
  return FALSE;
}

*and*

void npc_eatobj(struct char_data * ch, struct char_data * vict, struct
obj_data * obj)
{
  if (IS_NPC(vict))
    return;
  if (GET_LEVEL(vict) >= LVL_IMMORT)
    return;
  if (!obj)
    return;
  if (AWAKE(victim) && (number(0, GET_LEVEL(ch)) == 0)) {
    act("You grab your $p before the $n eats it.", FALSE, ch, 0, vict,
TO_VICT);
    act("The $n just tried to eat $N's $p!", TRUE, ch, 0, vict, TO_NOTVICT);
  } else {
    /* destroy the item */
    act("The $n just ate your $p!", FALSE, ch, 0, vict, TO_VICT);
    act("The $n just ate $N's $p!", FALSE, ch, obj, vict, TO_NOTVICT);
    obj_from_char(obj);
  }
}



I get this error during compile:

spec_procs.c: In function `goat':
spec_procs.c:243: warning: implicit declaration of function `npc_eatobj'
spec_procs.c: At top level:
spec_procs.c:350: warning: type mismatch with previous external decl
spec_procs.c:243: warning: previous external decl of `npc_eatobj'
spec_procs.c:350: warning: type mismatch with previous implicit declaration
spec_procs.c:243: warning: previous implicit declaration of `npc_eatobj'
spec_procs.c:350: warning: `npc_eatobj' was previously implicitly declared
to re
turn `int'
spec_procs.c: In function `npc_eatobj':
spec_procs.c:357: `victim' undeclared (first use this function)
spec_procs.c:357: (Each undeclared identifier is reported only once
spec_procs.c:357: for each function it appears in.)
make[1]: *** [spec_procs.o] Error 1
make[1]: Leaving directory `/home/legendd/circle30bpl12/src'
make: *** [all] Error 2


I, being a newbie coder, have no idea what to do.

thanks in advance for any help I get :)

Nathan Ridley


     +------------------------------------------------------------+
     | 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/08/00 PST