[CODE] [LONG] need help with spec proc

From: Sliver (sliver@lightspeed.bc.ca)
Date: 09/28/96


I tried sending this before, but I guess it didn't get through,
so I'll try again.
I'm writing a spec_proc for a mob that does implants, but I'm having a
wierd problem
The mud crashes whenever mix up the arguments, heres an example:
You have an object:

Name: 'a pair of cybernetic legs (implated)', Aliases: leg boosters
cybernetic 2020
VNum: [ 3847], RNum: [  414], Type: IMPLANT, SpecProc: None
L-Des: A pair of bloody cybernetic legs lies here.
Can be worn on: TAKE IMPLALEGS 
Set char bits : NOBITS 
Extra flags   : !PALADIN 
Weight: 15, Value: 5000, Cost/day: 0, Timer: 0
In room: Nowhere, In object: None, Carried by: Nobody, Worn by: Nobody
Values 0-3: [0] [0] [0] [0]
Affections: +3 to DEX, +25 to MAXMOVE, +10 to ARMOR

and you type: implant legs
it crashes


first couple of things, there is no alias for it called "legs"
and the implant was never ment to go in ITEM_WEAR_LEGS

SPECIAL(implanter)
{
  char arg1[MAX_INPUT_LENGTH];
  char arg2[MAX_INPUT_LENGTH];
  struct obj_data *obj, *next_obj;
  int where, dotmode, items_worn = 0;
  extern int find_eq_pos(struct char_data * ch, struct obj_data * obj,
char *arg);
  void perform_wear(struct char_data * ch, struct obj_data * obj, int
where);

  if (CMD_IS("implant")) {
    two_arguments(argument, arg1, arg2);
  
    if (!*arg1) {
      send_to_char("What do you want implanted?\r\n", ch);
      return 1;
    }
    dotmode = find_all_dots(arg1);
  
    if (*arg2 && (dotmode != FIND_INDIV)) {
      send_to_char("You can't specify the same body location for more
than one item!\r\n", ch);
      return 1;
    }
    if (dotmode == FIND_ALL) {
      for (obj = ch->carrying; obj; obj = next_obj) {
        next_obj = obj->next_content;
        if (CAN_SEE_OBJ(ch, obj) && (where = find_eq_pos(ch, obj, 0)) >=
0 && GET_OBJ_TYPE(obj) == ITEM_IMPLANT) {
          items_worn++;
          if (GET_GOLD(ch) >= GET_OBJ_COST(obj) * 4) {
            perform_wear(ch, obj, where);
          } else {
            send_to_char("You don't have enough gold!\r\n", ch);      
            return 1;
          }
        }
      }
    if (!items_worn)
      send_to_char("You don't seem to have anything implantable.\r\n",
ch);
    } else if (dotmode == FIND_ALLDOT) {
      if (!*arg1) {
        send_to_char("Implant all of what?\r\n", ch);
        return 1;
      }
      if (!(obj = get_obj_in_list_vis(ch, arg1, ch->carrying))) {
        sprintf(buf, "You don't seem to have any %ss.\r\n", arg1);
        send_to_char(buf, ch);
      } else
        while (obj) {
          next_obj = get_obj_in_list_vis(ch, arg1, obj->next_content);
          if ((where = find_eq_pos(ch, obj, 0)) >= 0 &&
GET_OBJ_TYPE(obj) == ITEM_IMPLANT)
            if (GET_GOLD(ch) >= GET_OBJ_COST(obj) * 4) {
              perform_wear(ch, obj, where);
            } else {
              send_to_char("You don't have enough gold!\r\n", ch);      
              return 1;
            }
          else
            act("You can't implant $p.", FALSE, ch, obj, 0, TO_CHAR);
          obj = next_obj;
        }
    } else {
      if (!(obj = get_obj_in_list_vis(ch, arg1, ch->carrying)) &&
GET_OBJ_TYPE(obj) == ITEM_IMPLANT) {
        sprintf(buf, "You don't seem to have %s %s.\r\n", AN(arg1),
arg1);
        send_to_char(buf, ch);
      } else {
        if ((where = find_eq_pos(ch, obj, arg2)) >= 0)
            if (GET_GOLD(ch) >= GET_OBJ_COST(obj) * 4) {
              perform_wear(ch, obj, where);
            } else {
              send_to_char("You don't have enough gold!\r\n", ch);      
              return 1;
            }
        else if (!*arg2)
          act("You can't implant $p.", FALSE, ch, obj, 0, TO_CHAR);
      } 
    }
    return TRUE;
  }
  return 0;
}


-- 
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
SLiVER Implementor of
ArmadaMUD                    lightspeed.bc.ca 4000
EMail:                     sliver@lightspeed.bc.ca
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
+-----------------------------------------------------------+
| Ensure that you have read the CircleMUD Mailing List FAQ: |
|   http://cspo.queensu.ca/~fletcher/Circle/list_faq.html   |
+-----------------------------------------------------------+



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