CODE

From: Cyanide (god@shadow.net)
Date: 10/02/96


Question, I was looking thru the code snippets at fletchers home page the
other day and found one that put olist, mlist, and rlist on your MUD.  The
only problem was, the file didn't tell me exactly where to put it ...here is
what the code looks like:

ACMD(do_rlist)
{
  extern struct room_data *world;
  extern int top_of_world;

  int first, last, nr, found = 0;

  two_arguments(argument, buf, buf2);

  if (!*buf || !*buf2) {
    send_to_char("Usage: rlist <begining number> <ending
number>\r\n", ch);
    return;
  }

  first = atoi(buf);
  last = atoi(buf2);

  if ((first < 0) || (first > 99999) || (last < 0) || (last >
99999)) {
    send_to_char("Values must be between 0 and 99999.\n\r", ch);
    return;
  }

  if (first >= last) {
   send_to_char("Second value must be greater than first.\n\r", ch);
    return;
  }

  for (nr = 0; nr <= top_of_world && (world[nr].number <= last); nr++) {
    if (world[nr].number >= first) {
      sprintf(buf, "%5d. [%5d] (%3d) %s\r\n", ++found,
              world[nr].number, world[nr].zone,
              world[nr].name);
      send_to_char(buf, ch);
    }
  }

  if (!found)
    send_to_char("No rooms were found in those parameters.\n\r", ch);
}


ACMD(do_mlist)
{
  extern struct index_data *mob_index;
  extern struct char_data *mob_proto;
  extern int top_of_mobt;

  int first, last, nr, found = 0;
  two_arguments(argument, buf, buf2);

  if (!*buf || !*buf2) {
    send_to_char("Usage: mlist <begining number> <ending
number>\r\n", ch);
    return;
  }

  first = atoi(buf);
  last = atoi(buf2);

  if ((first < 0) || (first > 99999) || (last < 0) || (last >
99999)) {
    send_to_char("Values must be between 0 and 99999.\n\r", ch);
    return;
  }

  if (first >= last) {
    send_to_char("Second value must be greater than first.\n\r", ch);
    return;
  }

  for (nr = 0; nr <= top_of_mobt && (mob_index[nr].virtual <= last);
nr++) {
    if (mob_index[nr].virtual >= first) {
      sprintf(buf, "%5d. [%5d] %s\r\n", ++found,
              mob_index[nr].virtual,
              mob_proto[nr].player.short_descr);
      send_to_char(buf, ch);
    }
  }

  if (!found)
    send_to_char("No mobiles were found in those parameters.\n\r", ch);
}


ACMD(do_olist)
{
  extern struct index_data *obj_index;
  extern struct obj_data *obj_proto;
  extern int top_of_objt;

  int first, last, nr, found = 0;

  two_arguments(argument, buf, buf2);

  if (!*buf || !*buf2) {
    send_to_char("Usage: olist <begining number> <ending
number>\r\n", ch);
    return;
  }
  first = atoi(buf);
  last = atoi(buf2);

  if ((first < 0) || (first > 99999) || (last < 0) || (last >
99999)) {
    send_to_char("Values must be between 0 and 99999.\n\r", ch);
    return;
  }

  if (first >= last) {
    send_to_char("Second value must be greater than first.\n\r", ch);
    return;
  }

  for (nr = 0; nr <= top_of_objt && (obj_index[nr].virtual <= last);
nr++) {
    if (obj_index[nr].virtual >= first) {
      sprintf(buf, "%5d. [%5d] %s\r\n", ++found,
              obj_index[nr].virtual,
              obj_proto[nr].short_description);
      send_to_char(buf, ch);
    }
  }

  if (!found)
    send_to_char("No objects were found in those parameters.\n\r", ch);
}


Does anybody have any idea what file I put this in, and where? ..thanks
~*-,._.,-*~'`^`'~*-,._.,-*~'`^`'~*-,._.,-*~'`^`'~*-,._.,-*~'`^`'~*-,._.,-*~
                       
                       [*] Cyanide <god@shadow.net> [*]

~*-,._.,-*~'`^`'~*-,._.,-*~'`^`'~*-,._.,-*~'`^`'~*-,._.,-*~'`^`'~*-,._.,-*~

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