Welcome to the Builder Academy

Question Re-ordering equipment slots

More
12 Sep 2021 20:23 #9904 by Darklands
I wanted to re-order the order shown in the equipment command to make things flow a little better with the order in which you see them. Any new items created in OLC seem to work fine, but all of the old items now have the wrong item types, What once were helmets, are now equipped to the body, or what once was a necklace is now being worn in another position. The wear flags on the existing items have shifted/switched to another position. Maybe I'm overlooking something simple, I'll paste my changes.

Thanks!

CONSTANTS.C

//OLD
const char *wear_where[] = {
  "<used as light>      ",
  "<worn on finger>     ",
  "<worn on finger>     ",
  "<worn around neck>   ",
  "<worn around neck>   ",
  "<worn on body>       ",
  "<worn on head>       ",
  "<worn on legs>       ",
  "<worn on feet>       ",
  "<worn on hands>      ",
  "<worn on arms>       ",
  "<worn as shield>     ",
  "<worn about body>    ",
  "<worn about waist>   ",
  "<worn around wrist>  ",
  "<worn around wrist>  ",
  "<wielded>            ",
  "<held>               "
};


//NEW
const char *wear_where[] = {
  "[Worn on head        ]",
  "[Worn around neck    ]",
  "[Worn around neck    ]",
  "[Worn on body        ]",
  "[Worn about body     ]",
  "[Worn on waist       ]",
  "[Worn on arms        ]",
  "[Worn on hands       ]",
  "[Worn around wrist   ]",
  "[Worn around wrist   ]",
  "[Worn on finger      ]",
  "[Worn on finger      ]",
  "[Worn on legs        ]",
  "[Worn on feet        ]",
  "[Worn as shield      ]",
  "[Used as light       ]",
  "[Wielded             ]",
  "[Held                ]"
  };


//OLD
const char *equipment_types[] = {
  "Used as light",
  "Worn on right finger",
  "Worn on left finger",
  "First worn around Neck",
  "Second worn around Neck",
  "Worn on body",
  "Worn on head",
  "Worn on legs",
  "Worn on feet",
  "Worn on hands",
  "Worn on arms",
  "Worn as shield",
  "Worn about body",
  "Worn around waist",
  "Worn around right wrist",
  "Worn around left wrist",
  "Wielded",
  "Held",
  "\n"
};


//NEW
const char *equipment_types[] = {
  "Worn on head",
  "First worn around neck",
  "Second worn around neck",
  "Worn on body",
  "Worn about body",
  "Worn on waist",
  "Worn on arms",
  "Worn on hands",
  "Worn around right wrist",
  "Worn around left wrist",
  "Worn on right finger",
  "Worn on left finger",
  "Worn on legs",
  "Worn on feet",
  "Worn as shield",
  "Used as light",
  "Wielded",
  "Held",
  "\n"
  };

 

  //OLD
  const char *wear_bits[] = {
  "TAKE",
  "FINGER",
  "NECK",
  "BODY",
  "HEAD",
  "LEGS",
  "FEET",
  "HANDS",
  "ARMS",
  "SHIELD",
  "ABOUT",
  "WAIST",
  "WRIST",
  "WIELD",
  "HOLD",
  "\n"
};


//NEW

  const char *wear_bits[] = {
  "HEAD",
  "NECK",
  "BODY",
  "ABOUT",
  "WAIST",
  "ARMS",
  "HANDS",
  "WRIST",
  "FINGER",
  "LEGS",
  "FEET",
  "SHIELD",
  "TAKE",
  "WIELD",
  "HOLD",
  "\n"
  };

 

  STRUCTS.H

 //OLD

#define WEAR_LIGHT      0  /**< Equipment Location Light */
#define WEAR_FINGER_R   1  /**< Equipment Location Right Finger */
#define WEAR_FINGER_L   2  /**< Equipment Location Left Finger */
#define WEAR_NECK_1     3  /**< Equipment Location Neck #1 */
#define WEAR_NECK_2     4  /**< Equipment Location Neck #2 */
#define WEAR_BODY       5  /**< Equipment Location Body */
#define WEAR_HEAD       6  /**< Equipment Location Head */
#define WEAR_LEGS       7  /**< Equipment Location Legs */
#define WEAR_FEET       8  /**< Equipment Location Feet */
#define WEAR_HANDS      9  /**< Equipment Location Hands */
#define WEAR_ARMS      10  /**< Equipment Location Arms */
#define WEAR_SHIELD    11  /**< Equipment Location Shield */
#define WEAR_ABOUT     12  /**< Equipment Location about body (like a cape)*/
#define WEAR_WAIST     13  /**< Equipment Location Waist */
#define WEAR_WRIST_R   14  /**< Equipment Location Right Wrist */
#define WEAR_WRIST_L   15  /**< Equipment Location Left Wrist */
#define WEAR_WIELD     16  /**< Equipment Location Weapon */
#define WEAR_HOLD      17  /**< Equipment Location held in offhand */
/** Total number of available equipment lcoations */
#define NUM_WEARS      18

//NEW

#define WEAR_HEAD       0
#define WEAR_NECK_1     1
#define WEAR_NECK_2     2
#define WEAR_BODY       3
#define WEAR_ABOUT      4
#define WEAR_WAIST      5
#define WEAR_ARMS       6
#define WEAR_HANDS      7
#define WEAR_WRIST_R    8
#define WEAR_WRIST_L    9
#define WEAR_FINGER_R   10
#define WEAR_FINGER_L   11
#define WEAR_LEGS       12
#define WEAR_FEET       13
#define WEAR_SHIELD     14
#define WEAR_LIGHT      15
#define WEAR_WIELD      16
#define WEAR_HOLD       17
/** Total eq slots currently */
#define NUM_WEARS       18


//OLD

#define ITEM_WEAR_TAKE      0   /**< Item can be taken */
#define ITEM_WEAR_FINGER    1   /**< Item can be worn on finger */
#define ITEM_WEAR_NECK      2   /**< Item can be worn around neck */
#define ITEM_WEAR_BODY      3   /**< Item can be worn on body */
#define ITEM_WEAR_HEAD      4   /**< Item can be worn on head */
#define ITEM_WEAR_LEGS      5   /**< Item can be worn on legs */
#define ITEM_WEAR_FEET      6   /**< Item can be worn on feet */
#define ITEM_WEAR_HANDS     7   /**< Item can be worn on hands  */
#define ITEM_WEAR_ARMS      8   /**< Item can be worn on arms */
#define ITEM_WEAR_SHIELD    9   /**< Item can be used as a shield */
#define ITEM_WEAR_ABOUT    10   /**< Item can be worn about body */
#define ITEM_WEAR_WAIST    11   /**< Item can be worn around waist */
#define ITEM_WEAR_WRIST    12   /**< Item can be worn on wrist */
#define ITEM_WEAR_WIELD    13   /**< Item can be wielded */
#define ITEM_WEAR_HOLD     14   /**< Item can be held */
/** Total number of item wears */
#define NUM_ITEM_WEARS    15

//NEW

#define ITEM_WEAR_HEAD      0
#define ITEM_WEAR_NECK      1
#define ITEM_WEAR_BODY      2
#define ITEM_WEAR_ABOUT     3
#define ITEM_WEAR_WAIST     4
#define ITEM_WEAR_ARMS      5
#define    ITEM_WEAR_HANDS     6
#define ITEM_WEAR_WRIST     7
#define ITEM_WEAR_FINGER    8
#define ITEM_WEAR_LEGS      9
#define ITEM_WEAR_FEET      10
#define ITEM_WEAR_SHIELD    11
#define ITEM_WEAR_TAKE      12
#define ITEM_WEAR_WIELD     13
#define ITEM_WEAR_HOLD      14
/** Total item wears        */
#define NUM_ITEM_WEARS      15


ACT.ITEM.C

//OLD
  
    {"$n lights $p and holds it.",
    "You light $p and hold it."},

    {"$n slides $p on to $s right ring finger.",
    "You slide $p on to your right ring finger."},

    {"$n slides $p on to $s left ring finger.",
    "You slide $p on to your left ring finger."},

    {"$n wears $p around $s neck.",
    "You wear $p around your neck."},

    {"$n wears $p around $s neck.",
    "You wear $p around your neck."},

    {"$n wears $p on $s body.",
    "You wear $p on your body."},

    {"$n wears $p on $s head.",
    "You wear $p on your head."},

    {"$n puts $p on $s legs.",
    "You put $p on your legs."},

    {"$n wears $p on $s feet.",
    "You wear $p on your feet."},

    {"$n puts $p on $s hands.",
    "You put $p on your hands."},

    {"$n wears $p on $s arms.",
    "You wear $p on your arms."},

    {"$n straps $p around $s arm as a shield.",
    "You start to use $p as a shield."},

    {"$n wears $p about $s body.",
    "You wear $p around your body."},

    {"$n wears $p on $s head.",
    "You wear $p on your head."},

    {"$n puts $p on $s legs.",
    "You put $p on your legs."},

    {"$n wears $p on $s feet.",
    "You wear $p on your feet."},

    {"$n puts $p on $s hands.",
    "You put $p on your hands."},

    {"$n wears $p on $s arms.",
    "You wear $p on your arms."},

    {"$n straps $p around $s arm as a shield.",
    "You start to use $p as a shield."},

    {"$n wears $p about $s body.",
    "You wear $p around your body."},

    {"$n wears $p around $s waist.",
    "You wear $p around your waist."},

    {"$n puts $p on around $s right wrist.",
    "You put $p on around your right wrist."},

    {"$n puts $p on around $s left wrist.",
    "You put $p on around your left wrist."},

    {"$n wields $p.",
    "You wield $p."},

    {"$n grabs $p.",
    "You grab $p."}
  };

  //NEW

    {"$n wears $p on $s head.",
    "You wear $p on your head."},

    {"$n wears $p around $s neck.",
    "You wear $p around your neck."},

    {"$n wears $p around $s neck.",
    "You wear $p around your neck."},

    {"$n wears $p on $s body.",
    "You wear $p on your body."},

    {"$n wears $p about $s body.",
    "You wear $p around your body."},

    {"$n wears $p around $s waist.",
    "You wear $p around your waist."},

    {"$n wears $p on $s arms.",
    "You wear $p on your arms."},

    {"$n puts $p on $s hands.",
    "You put $p on your hands."},

    {"$n puts $p on around $s right wrist.",
    "You put $p on around your right wrist."},

    {"$n puts $p on around $s left wrist.",
    "You put $p on around your left wrist."},

    {"$n slides $p on to $s right ring finger.",
    "You slide $p on to your right ring finger."},

    {"$n slides $p on to $s left ring finger.",
    "You slide $p on to your left ring finger."},

    {"$n puts $p on $s legs.",
    "You put $p on your legs."},

    {"$n wears $p on $s feet.",
    "You wear $p on your feet."},

    {"$n straps $p around $s arm as a shield.",
    "You start to use $p as a shield."},

    {"$n lights $p and holds it.",
    "You light $p and hold it."},

    {"$n wields $p.",
    "You wield $p."},

    {"$n grabs $p.",
    "You grab $p."}
  };


//OLD

  int wear_bitvectors[] = {
    ITEM_WEAR_TAKE, ITEM_WEAR_FINGER, ITEM_WEAR_FINGER, ITEM_WEAR_NECK,
    ITEM_WEAR_NECK, ITEM_WEAR_BODY, ITEM_WEAR_HEAD, ITEM_WEAR_LEGS,
    ITEM_WEAR_FEET, ITEM_WEAR_HANDS, ITEM_WEAR_ARMS, ITEM_WEAR_SHIELD,
    ITEM_WEAR_ABOUT, ITEM_WEAR_WAIST, ITEM_WEAR_WRIST, ITEM_WEAR_WRIST,
    ITEM_WEAR_WIELD, ITEM_WEAR_TAKE
  };

  const char *already_wearing[] = {
    "You're already using a light.\r\n",
    "YOU SHOULD NEVER SEE THIS MESSAGE.  PLEASE REPORT.\r\n",
    "You're already wearing something on both of your ring fingers.\r\n",
    "YOU SHOULD NEVER SEE THIS MESSAGE.  PLEASE REPORT.\r\n",
    "You can't wear anything else around your neck.\r\n",
    "You're already wearing something on your body.\r\n",
    "You're already wearing something on your head.\r\n",
    "You're already wearing something on your legs.\r\n",
    "You're already wearing something on your feet.\r\n",
    "You're already wearing something on your hands.\r\n",
    "You're already wearing something on your arms.\r\n",
    "You're already using a shield.\r\n",
    "You're already wearing something about your body.\r\n",
    "You already have something around your waist.\r\n",
    "YOU SHOULD NEVER SEE THIS MESSAGE.  PLEASE REPORT.\r\n",
    "You're already wearing something around both of your wrists.\r\n",
    "You're already wielding a weapon.\r\n",
    "You're already holding something.\r\n"
  };

 //NEW

   int wear_bitvectors[] = {
     ITEM_WEAR_HEAD, ITEM_WEAR_NECK, ITEM_WEAR_NECK, ITEM_WEAR_BODY,
     ITEM_WEAR_ABOUT, ITEM_WEAR_WAIST, ITEM_WEAR_ARMS, ITEM_WEAR_HANDS,
     ITEM_WEAR_WRIST, ITEM_WEAR_WRIST, ITEM_WEAR_FINGER, ITEM_WEAR_FINGER,
     ITEM_WEAR_LEGS, ITEM_WEAR_FEET, ITEM_WEAR_SHIELD, ITEM_WEAR_TAKE,
     ITEM_WEAR_WIELD, ITEM_WEAR_TAKE
     };

   const char *already_wearing[] = {
     "You're already wearing something on your head.\r\n",
     "ERROR\r\n",
     "You can't wear anything else around your neck.\r\n",
     "You're already wearing something on your body.\r\n",
     "You're already wearing something about your body.\r\n",
     "You're already wearing something on your waist.\r\n",
     "You're already wearing something on your arms.\r\n",
     "You're already wearing something on your hands.\r\n",
     "ERROR\r\n",
     "You're already wearing something around both of your wrists.\r\n", 
     "ERROR\r\n",
     "You're already wearing something on both of your ring fingers.\r\n",
     "You're already wearing something on your legs.\r\n",
     "You're already wearing something on your feet.\r\n",
     "You're already using a shield.\r\n",
     "You're already using a light.\r\n",
     "You're already wielding a weapon.\r\n",
     "You're already holding something in your off hand.\r\n"
     };

     

     //OLD

       const char *keywords[] = {
    "!RESERVED!",
    "finger",
    "!RESERVED!",
    "neck",
    "!RESERVED!",
    "body",
    "head",
    "legs",
    "feet",
    "hands",
    "arms",
    "shield",
    "about",
    "waist",
    "wrist",
    "!RESERVED!",
    "!RESERVED!",
    "!RESERVED!",
    "\n"
  };

  if (!arg || !*arg) {
    if (CAN_WEAR(obj, ITEM_WEAR_FINGER))      where = WEAR_FINGER_R;
    if (CAN_WEAR(obj, ITEM_WEAR_NECK))        where = WEAR_NECK_1;
    if (CAN_WEAR(obj, ITEM_WEAR_BODY))        where = WEAR_BODY;
    if (CAN_WEAR(obj, ITEM_WEAR_HEAD))        where = WEAR_HEAD;
    if (CAN_WEAR(obj, ITEM_WEAR_LEGS))        where = WEAR_LEGS;
    if (CAN_WEAR(obj, ITEM_WEAR_FEET))        where = WEAR_FEET;
    if (CAN_WEAR(obj, ITEM_WEAR_HANDS))       where = WEAR_HANDS;
    if (CAN_WEAR(obj, ITEM_WEAR_ARMS))        where = WEAR_ARMS;
    if (CAN_WEAR(obj, ITEM_WEAR_SHIELD))      where = WEAR_SHIELD;
    if (CAN_WEAR(obj, ITEM_WEAR_ABOUT))       where = WEAR_ABOUT;
    if (CAN_WEAR(obj, ITEM_WEAR_WAIST))       where = WEAR_WAIST;
    if (CAN_WEAR(obj, ITEM_WEAR_WRIST))       where = WEAR_WRIST_R;
  } else if ((where = search_block(arg, keywords, FALSE)) < 0)
    send_to_char(ch, "'%s'?  What part of your body is THAT?\r\n", arg);

  return (where);
}

  //NEW

  const char *keywords[] = {
  "head",
  "neck",
  "!RESERVED!",
  "body",
  "waist",
  "arms",
  "hands",
  "wrist",
  "!RESERVED!",
  "finger",
  "!RESERVED!",
  "legs",
  "feet",
  "shield",
  "!RESERVED!",
  "!RESERVED!",
  "!RESERVED!",
  "\n"
 };

  if (!arg || !*arg) {
    if (CAN_WEAR(obj, ITEM_WEAR_HEAD))     where = WEAR_HEAD;
    if (CAN_WEAR(obj, ITEM_WEAR_NECK))     where = WEAR_NECK_1;
    if (CAN_WEAR(obj, ITEM_WEAR_BODY))     where = WEAR_BODY;
    if (CAN_WEAR(obj, ITEM_WEAR_WAIST))    where = WEAR_WAIST;
    if (CAN_WEAR(obj, ITEM_WEAR_ARMS))     where = WEAR_ARMS;
    if (CAN_WEAR(obj, ITEM_WEAR_HANDS))    where = WEAR_HANDS;
    if (CAN_WEAR(obj, ITEM_WEAR_WRIST))    where = WEAR_WRIST_R;
    if (CAN_WEAR(obj, ITEM_WEAR_FINGER))   where = WEAR_FINGER_R;
    if (CAN_WEAR(obj, ITEM_WEAR_LEGS))     where = WEAR_LEGS;
    if (CAN_WEAR(obj, ITEM_WEAR_FEET))     where = WEAR_FEET;
    if (CAN_WEAR(obj, ITEM_WEAR_SHIELD))   where = WEAR_SHIELD;
  } else if ((where = search_block(arg, keywords, FALSE)) < 0)
    send_to_char(ch, "'%s'?  What part of your body is THAT?\r\n", arg);

  return (where);
  }





 

Please Log in or Create an account to join the conversation.

Time to create page: 0.368 seconds