|
Liblist Commands: Rlist, Mlist, Olist Commands [by Myrddin] |
|
|
|
Posted Wednesday, August 12th @ 11:29:53 PM, by George Greer in the Wizard dept.
. Click the link below to read it or download it.
RLIST, MLIST, OLIST COMMANDS
These commands should server to list rooms, mobiles and objects on
your mud in the range given.
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 \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 \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 \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);
}
<< Language Addition [by Frollo] | Reply | View as text | Threaded | Liblist: Room/Object/Mob listing [by Stormrider] >> |
|
Related Links |
|
|
|
CircleMUD Snippets |
|
|
Note: Not all of these snippets will work perfectly with
your version of code, so be prepared to fix one
or two bugs that may arise, and please let me know
what you needed to do to fix it. Sending a corrected
version is always welcome.
|
Finally, if you wish to use any of the snippets from this
page, you are more than welcome, just mention the
authors in your credits. If you wish to release any
of these snippets to the public on another site,
contact me FIRST.
|
|
|
|
|
|
|