Shoplift Command Help

From: Alex Mann (
Date: 12/13/00


I and trying to write a shoplift command, so what I did was to hack a copy
of the buy stuff in shop.c to remove the gold checks and what ever, and the
shopkeeper stuff, so now it basicly works like buy but you get the stuff for
free. i am then going to write ACMD_shoplift  with a complex success check,
including weight value and stats.

This is my problem: the shoplfit stuff seems to work fine, but rather then
getting jsut one of the items you specify, you egt everysingle one until the
point where you can't carry any more, where it stops. it seems I have
removed something which controls the number of the itesm you are buying. I
have not been able to work out from buy, which bit it is!

Here is the code for my shoplift, can someone take a look and see what it's

void shoplift(char *arg, struct char_data * ch, struct char_data * keeper,
int shop_nr)
  char tempstr[200], buf[MAX_STRING_LENGTH];
  struct obj_data *obj, *last_obj = NULL;
  int goldamt = 0, buynum, bought = 0;

  if (!(is_ok(keeper, ch, shop_nr)))

  if (SHOP_SORT(shop_nr) < IS_CARRYING_N(keeper))
    sort_keeper_objs(keeper, shop_nr);

  if (!(*arg) || !(buynum)) {
    send_to_char("What do you want to shoplift??\r\n", ch);
  if (!(obj = get_purchase_obj(ch, arg, keeper, shop_nr, TRUE)))

  if ((IS_CARRYING_N(ch) + 1 > CAN_CARRY_N(ch))) {
    sprintf(buf, "%s: You can't carry any more items.\r\n",
    send_to_char(buf, ch);
  if ((IS_CARRYING_W(ch) + GET_OBJ_WEIGHT(obj)) > CAN_CARRY_W(ch)) {
    sprintf(buf, "%s: You can't carry that much weight.\r\n",
    send_to_char(buf, ch);

  while ((obj) && (IS_CARRYING_N(ch) < CAN_CARRY_N(ch)) && (bought < buynum)
         && (IS_CARRYING_W(ch) + GET_OBJ_WEIGHT(obj) <= CAN_CARRY_W(ch))) {
    /* Test if producing shop ! */
    if (shop_producing(obj, shop_nr))
      obj = read_object(GET_OBJ_RNUM(obj), REAL);
    else {
    obj_to_char(obj, ch);

    last_obj = obj;
    obj = get_purchase_obj(ch, arg, keeper, shop_nr, FALSE);
    if (!same_obj(obj, last_obj))

  if (bought < buynum) {
    if (!obj || !same_obj(last_obj, obj))
      send_to_char("You can't shop lift what they don't have. \r\n", ch);
    else if (IS_CARRYING_N(ch) >= CAN_CARRY_N(ch))
      send_to_char("That item is too heavy.\r\n", ch);
    else if (IS_CARRYING_W(ch) + GET_OBJ_WEIGHT(obj) > CAN_CARRY_W(ch))
     send_to_char("That item is too heavy.\r\n", ch);
        send_to_char("Oops you have stolen the wrong item.\r\n", ch);

  sprintf(buf, "$n shoplifts %s whilst the shopkeeper isn't looking.",
  act(buf, FALSE, ch, obj, 0, TO_ROOM);
  send_to_char("You shoplifted it sucessfully!!", ch);
  send_to_char(buf, ch);


Alex 4445

Get more from the Web.  FREE MSN Explorer download :

   | FAQ: |
   | Archives: |

This archive was generated by hypermail 2b30 : 04/11/01 PDT