Re: [Newbie] VLIST

From: Kras Kresh (kras_kresh@hotmail.com)
Date: 02/26/02


>Has anyone else used The vlist snippet?
>It appears to be created to list obj,
>mob and world files in a specified zone.
>
>Obj and Mob work great.
>
>World doesn't seem to work correctly.

This is my code for the vlist command... modified from the one I found in
the contrib. The fix for the vlist room is in there, but some variable names
changed. I also added shops. Email me if you want the shop part. If you use
the following, but you don't want the shops, then just remove the shop
parts.

ACMD(do_vlist)
{
  int i, tarzone, nr = 0, found = 0, choice = 0;
  zone_vnum j;

  two_arguments(argument, buf, buf2);

  if      (is_abbrev(buf, "obj"))  choice = 1;
  else if (is_abbrev(buf, "mob"))  choice = 2;
  else if (is_abbrev(buf, "room")) choice = 3;
  else if (is_abbrev(buf, "shop")) choice = 4;

  if (!choice || !*buf2) {
    send_to_char("Usage: vlist { obj | mob | room | shop } <zone>\r\n", ch);
    return;
  }

  j = atoi(buf2);
  for (tarzone = 0; tarzone <= top_of_zone_table; tarzone++)
    if (zone_table[tarzone].number == j)
      break;

  if (tarzone < 0 || tarzone > top_of_zone_table) {
    send_to_char("Value must be a valid zone.\r\n", ch);
    return;
  }
  tarzone = atoi(buf2);
  i = tarzone*100+99;

  switch (choice) {
  case 1:
    for (; nr <= top_of_objt && obj_index[nr].vnum <= i; nr++)
      if (obj_index[nr].vnum >= (tarzone*100)) {
      if (obj_index[nr].vnum >= (tarzone*100)) {
        sprintf(buf, "%5d. [%5d] %s\r\n", ++found,
                obj_index[nr].vnum, obj_proto[nr].short_description);
        send_to_char(buf, ch);
      }
    if (!found)
      send_to_char("There were no objects created under that zone.\r\n",
ch);
    break;

  case 2:
    for (; nr <= top_of_mobt && mob_index[nr].vnum <= i; nr++)
      if (mob_index[nr].vnum >= (tarzone*100)) {
        sprintf(buf, "%5d. [%5d] %s\r\n", ++found,
                mob_index[nr].vnum, mob_proto[nr].player.short_descr);
        send_to_char(buf, ch);
      }
    if (!found)
      send_to_char("There were no mobiles created under that zone.\r\n",
ch);
    break;

  case 3:
    for (; nr <= top_of_world && world[nr].number <= i; nr++)
      if (world[nr].number >= (tarzone*100)) {
        sprintf(buf, "%5d. [%5d] %s\r\n", ++found,
                world[nr].number, world[nr].name);
        send_to_char(buf, ch);
      }
    if (!found)
      send_to_char("There were no rooms created under that zone.\r\n", ch);
   break;

  case 4:
    print_shops(tarzone, ch);
    break;

  default:
    mudlog("SYSERR: Vlist command not found!", BRF, LVL_IMMORT, TRUE);
  }
}


_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp.

--
   +---------------------------------------------------------------+
   | 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