It was a long time since I last asked about this thing. I have managed to get it to work, that is why I release this little snippet for all you MUD-admins who wishes to have an Automap in your MUD. Only one problem remains, color. I cannot seem to get color on the characters without getting them all scattered around, making the map unreadable. ---Begging of Snippet--- #define MAP_WIDTH 5 #define MAP_HEIGHT 5 #define MAP_ROOMS (MAP_WIDTH * MAP_HEIGHT) void show_map(struct char_data *ch) { char map_chars[MAP_ROOMS][5]; int map_rnum[MAP_ROOMS], i; const char *sector_symbols[] = { "#", ":", "*", "T", "^", "^", "~", "~", "~", ".", "*" }; for (i = 0; i < MAP_ROOMS; i++) { map_rnum[i] = 0; strcpy(map_chars[i], " "); } map_rnum[17] = IN_ROOM(ch); if (CAN_GO(ch, 0)) { map_rnum[12] = EXIT(ch, 0)->to_room; sprintf(map_chars[12], sector_symbols[SECT(map_rnum[12])]); if (CAN_GO2(EXIT(ch, 0)->to_room, 0)) { map_rnum[11] = EXIT2(EXIT(ch, 0)->to_room, 0)->to_room; sprintf(map_chars[11], sector_symbols[SECT(map_rnum[11])]); } if (CAN_GO2(EXIT(ch, 0)->to_room, 1)) { map_rnum[20] = EXIT2(EXIT(ch, 0)->to_room, 1)->to_room; sprintf(map_chars[20], sector_symbols[SECT(map_rnum[20])]); } if (CAN_GO2(EXIT(ch, 0)->to_room, 3)) { map_rnum[10] = EXIT2(EXIT(ch, 0)->to_room, 3)->to_room; sprintf(map_chars[10], sector_symbols[SECT(map_rnum[10])]); } } if (CAN_GO(ch, 1)) { map_rnum[18] = EXIT(ch, 1)->to_room; sprintf(map_chars[18], sector_symbols[SECT(map_rnum[18])]); if (CAN_GO2(EXIT(ch, 1)->to_room, 0)) { map_rnum[20] = EXIT2(EXIT(ch, 1)->to_room, 0)->to_room; sprintf(map_chars[20], sector_symbols[SECT(map_rnum[20])]); } if (CAN_GO2(EXIT(ch, 1)->to_room, 1)) { map_rnum[19] = EXIT2(EXIT(ch, 1)->to_room, 1)->to_room; sprintf(map_chars[19], sector_symbols[SECT(map_rnum[19])]); } if (CAN_GO2(EXIT(ch, 1)->to_room, 2)) { map_rnum[21] = EXIT2(EXIT(ch, 1)->to_room, 2)->to_room; sprintf(map_chars[21], sector_symbols[SECT(map_rnum[21])]); } } if (CAN_GO(ch, 2)) { map_rnum[22] = EXIT(ch, 2)->to_room; sprintf(map_chars[22], sector_symbols[SECT(map_rnum[22])]); if (CAN_GO2(EXIT(ch, 2)->to_room, 1)) { map_rnum[21] = EXIT2(EXIT(ch, 2)->to_room, 1)->to_room; sprintf(map_chars[21], sector_symbols[SECT(map_rnum[21])]); } if (CAN_GO2(EXIT(ch, 2)->to_room, 2)) { map_rnum[23] = EXIT2(EXIT(ch, 2)->to_room, 2)->to_room; sprintf(map_chars[23], sector_symbols[SECT(map_rnum[23])]); } if (CAN_GO2(EXIT(ch, 2)->to_room, 3)) { map_rnum[24] = EXIT2(EXIT(ch, 2)->to_room, 3)->to_room; sprintf(map_chars[24], sector_symbols[SECT(map_rnum[24])]); } } if (CAN_GO(ch, 3)) { map_rnum[17 - 1] = EXIT(ch, 3)->to_room; sprintf(map_chars[16], sector_symbols[SECT(map_rnum[16])]); if (CAN_GO2(EXIT(ch, 3)->to_room, 0)) { map_rnum[10] = EXIT2(EXIT(ch, 3)->to_room, 0)->to_room; sprintf(map_chars[10], sector_symbols[SECT(map_rnum[10])]); } if (CAN_GO2(EXIT(ch, 3)->to_room, 2)) { map_rnum[24] = EXIT2(EXIT(ch, 3)->to_room, 2)->to_room; sprintf(map_chars[24], sector_symbols[SECT(map_rnum[24])]); } if (CAN_GO2(EXIT(ch, 3)->to_room, 3)) { map_rnum[15] = EXIT2(EXIT(ch, 3)->to_room, 3)->to_room; sprintf(map_chars[15], sector_symbols[SECT(map_rnum[15])]); } } sprintf(buf, " &y===&rMAP&y===&n %s %s%s%s %s%sC%s%s %s%s%s %s &y=========&n\r\n\r\n", map_chars[11], map_chars[10], map_chars[12], map_chars[20], map_chars[15], map_chars[16], map_chars[18], map_chars[19], map_chars[24], map_chars[22], map_chars[21], map_chars[23]); send_to_char(buf, ch); } ---End of Snippet--- What can be wrong? This is the only remaining thing to do to get this little snippet to work 100%. > Christoffer < +------------------------------------------------------------+ | Ensure that you have read the CircleMUD Mailing List FAQ: | | http://qsilver.queensu.ca/~fletchra/Circle/list-faq.html | +------------------------------------------------------------+
This archive was generated by hypermail 2b30 : 12/15/00 PST