> um..make that '\n'..*shakes his head in winderment* uhh..wonderment even..if that truly is a word.. ObCircle: here's a new scan command that will stack mobs with the same names, in the same rooms..i wrote it based on some scan code that chuck reed sent me (don't know who the original author was), and the mob stacking code from the snippet site (don't know who the original author was).. may need some modification, but i think it should be basically plug and go..and of course you'll have to add scan to your command table in interpreter.c.. siv _____________________________ #define R_EXIT(n, door) (world[n].dir_option[door]) int clearpath(int room, int dir) { if (R_EXIT(room, dir) && (R_EXIT(room, dir)->to_room != NOWHERE) && (!IS_SET(R_EXIT(room, dir)->exit_info, EX_CLOSED)) && (!IS_SET(R_EXIT(room, dir)->exit_info, EX_HIDDEN))) return (TRUE); return (FALSE); } ACMD(do_scan) { struct char_data *plr_list[100], *spud; int num = 0, counter, found = FALSE; int smin = -1, swt = 3, i, maxrange = 4, range = -1; sh_int in_room; struct scan_info { int num_counted; int distance; int direction; } scanned[100]; char *dir_desc[] = { "shoud never see", "to the north", "to the east", "to the south", "to the west", "upwards", "downwards" }; char *rng_desc[] = { "right here", "immediately", "nearby", "a ways", "far", "very far" }; sprintf(buf,"$n scans intensly all around."); sprintf(buf2,"You scan intensely all around, and see :\n\r"); act(buf, FALSE, ch,0, 0, TO_ROOM); send_to_char(buf2,ch); for (i = smin; i < NUM_OF_DIRS && num < 100; i++, range = 0) { in_room = ch->in_room; while (range < maxrange) { if (i == -1 || clearpath(in_room, i)) { if (range != -1) in_room = world[in_room].dir_option[i]->to_room; for (spud=world[in_room].people;spud;spud=spud->next_in_room) { if (CAN_SEE(ch,spud) && (spud != ch)) { if (num < 100) { found = FALSE; for (counter = 0; (counter < num && !found); counter++) { if (spud->nr == plr_list[counter]->nr && scanned[counter].direction == i && scanned[counter].distance == range && !strcmp(GET_NAME(spud), GET_NAME(plr_list[counter]))) { scanned[counter].num_counted += 1; found = TRUE; } } if (!found) { plr_list[num] = spud; scanned[num].distance = range; scanned[num].direction = i; scanned[num].num_counted = 1; num++; } } else { range = maxrange+1; break; } } } } else range = maxrange+1; if (i == -1) range = maxrange+1; else range++; } } *buf = '\0'; if (num==0) send_to_char("Absolutely no-one anywhere\n\r",ch); else { for (i = 0; i < num; i++) { sprintf(buf,"%s%30s : %s %s ", buf, GET_NAME(plr_list[i]), rng_desc[scanned[i].distance+1], (scanned[i].direction == -1 ? "" : dir_desc[scanned[i].direction+1])); if (scanned[i].num_counted > 1) { sprintf(buf1, "[%d]\r\n", scanned[i].num_counted); strcat(buf, buf1); } else strcat(buf, "\r\n"); if (strlen(buf) >= MAX_STRING_LENGTH - 32) { strcat(buf, "**OVERFLOW**\r\n"); break; } } page_string(ch->desc, buf, 1); } WAIT_STATE(ch,swt); } +------------------------------------------------------------+ | Ensure that you have read the CircleMUD Mailing List FAQ: | | http://democracy.queensu.ca/~fletcher/Circle/list-faq.html | +------------------------------------------------------------+
This archive was generated by hypermail 2b30 : 12/15/00 PST