Here are 3 immortal commands that I have written and used in several muds I have coded for. All 3 commands are useful building tools that find the loading locations of things that exist in your world. whereload: Finds where an object or mobile loads to. It goes through the zone commands for each zone and shows you all commands that would load the object or mobile specified and all relevant information. findkey: Finds the key that goes to the door in the direction specified, and sends the vnum to the whereload command. finddoor: Finds the door(s) that a key goes to. To install, put everything below the line into act.wizard.c, and don't forget to add the commands "whereload", "findkey", and "finddoor" to interpreter.c. NOTE: This was designed and tested for 3.0b pl14, but shouldn't take much work if you are running a different version. A few notables for older versions are to change mob_rnum and room_rnum to int, and on some old versions xxx_index[].vnum is .virtual instead. For more recent versions of circle (e.g. 3.1), send_to_char's arguments are reversed. Send all bug reports and ponderings to tdowling@drix.net, flames will be ignored. -Adrian (bloodlust.darktech.org:4000, cities.of.glory.eu.org:4000) Special thanks to Alexei Svitkine for a bugfix. ----- #define ZCMD zone_table[zone].cmd[cmd_no] /* do_whereload, finds where an object or mobile loads to using the zone * commands */ ACMD(do_whereload) { int cmd_no, zone, room = -1, number, found = 0; mob_rnum mob; char arg1[MAX_INPUT_LENGTH], arg2[MAX_INPUT_LENGTH]; char buf[MAX_STRING_LENGTH] = {0}; two_arguments(argument, arg1, arg2); if (!*arg2 || !is_number(arg2)) { send_to_char("Format: whereload { mob | obj } \r\n", ch); return; } number = atoi(arg2); if (is_abbrev(arg1, "mobile")) { number = real_mobile(number); /* we only have to search the zone files for 'M' lines */ for (zone = 0; zone < top_of_zone_table; zone++) for (cmd_no = 0; ZCMD.command != 'S'; cmd_no++) if (ZCMD.command == 'M') if (ZCMD.arg1 == number) sprintf(buf + strlen(buf), "[%3.3d] Room %d (max %d)\r\n", ++found, world[ZCMD.arg3].number, ZCMD.arg2); if (!found) strcat(buf, "No mobiles with that vnum load.\r\n"); } else if (is_abbrev(arg1, "object")) { number = real_object(number); /* but this one needs a ton of them :( */ for (zone = 0, mob = -1; zone < top_of_zone_table; zone++, mob = -1) for (cmd_no = 0; ZCMD.command != 'S'; cmd_no++) switch (ZCMD.command) { case 'M': /* this is needed just to set mob */ mob = ZCMD.arg1; room = world[ZCMD.arg3].number; break; case 'O': room = world[ZCMD.arg3].number; if (ZCMD.arg1 == number) sprintf(buf + strlen(buf), "[%3.3d] In room %d (max %d)\r\n", ++found, room, ZCMD.arg2); break; case 'G': if (mob < 0) continue; if (ZCMD.arg1 == number) sprintf(buf + strlen(buf), "[%3.3d] On mob %d (%s) in room %d (max %d)\r\n", ++found, mob_index[mob].vnum, mob_proto[mob].player.short_descr, room, ZCMD.arg2); break; case 'P': if (ZCMD.arg1 == number) sprintf(buf + strlen(buf), "[%3.3d] In obj %d (%s) in room %d (max %d)\r\n", ++found, obj_index[ZCMD.arg3].vnum, obj_proto[ZCMD.arg3].short_description, room, ZCMD.arg2); break; case 'E': if (mob < 0) continue; if (ZCMD.arg1 == number) sprintf(buf + strlen(buf), "[%3.3d] On mob %d (%s) [%s] in room %d (max %d)\r\n", ++found, mob_index[mob].vnum, mob_proto[mob].player.short_descr, equipment_types[ZCMD.arg3], room, ZCMD.arg2); break; default: break; } if (!found) strcat(buf, "No objects with that vnum load.\r\n"); } else { send_to_char("Format: whereload { mob | obj } \r\n", ch); return; } page_string(ch->desc, buf, 1); } /* do_findkey, finds where the key to a door loads to using do_whereload() */ ACMD(do_findkey) { int dir, key, rkey; char arg[MAX_INPUT_LENGTH]; char buf[MAX_STRING_LENGTH]; one_argument(argument, arg); if (!*arg) { send_to_char("Format: findkey \r\n", ch); return; } switch (*arg) { case 'n': dir = NORTH; break; case 'e': dir = EAST; break; case 's': dir = SOUTH; break; case 'w': dir = WEST; break; case 'u': dir = UP; break; case 'd': dir = DOWN; break; default: send_to_char("What direction is that?!?\r\n", ch); return; } if (!EXIT(ch, dir)) { send_to_char("There's no exit in that direction!\r\n", ch); return; } if ((key = EXIT(ch, dir)->key) <= 0) { send_to_char("There's no key for that exit.\r\n", ch); return; } sprintf(buf, "Vnum: %d (%s).\r\n", key, (rkey = real_object(key)) > -1 ? obj_proto[rkey].short_description : "doesn't exist"); send_to_char(buf, ch); sprintf(buf, "obj %d", key); do_whereload(ch, buf, 0, 0); } /* do_finddoor, finds the door(s) that a key goes to */ ACMD(do_finddoor) { int d, vnum = 0, num = 0; room_rnum i; char arg[MAX_INPUT_LENGTH]; char buf[MAX_STRING_LENGTH] = {0}; struct char_data *tmp_char; struct obj_data *obj; one_argument(argument, arg); if (!*arg) { send_to_char("Format: finddoor \r\n", ch); return; } if (is_number(arg)) { /* must be a vnum - easy */ vnum = atoi(arg); } else { generic_find(arg, FIND_OBJ_INV | FIND_OBJ_ROOM | FIND_OBJ_WORLD | FIND_OBJ_EQUIP, ch, &tmp_char, &obj); if (!obj) { send_to_char("What key do you want to find a door for?\r\n", ch); return; } if (GET_OBJ_TYPE(obj) != ITEM_KEY) { act("$p isn't a key, it seems.", FALSE, ch, obj, 0, TO_CHAR); return; } vnum = GET_OBJ_VNUM(obj); } if (real_object(vnum) == NOTHING) { send_to_char("There is no object with that vnum found.\r\n", ch); return; } for (i = 0; i <= top_of_world; i++) for (d = 0; d < NUM_OF_DIRS; d++) if (world[i].dir_option[d] && world[i].dir_option[d]->key && world[i].dir_option[d]->key == vnum) sprintf(buf + strlen(buf), "[%3d] Room %d, %s (%s)\r\n", ++num, world[i].number, dirs[d], world[i].dir_option[d]->keyword); page_string(ch->desc, buf, 1); }