Here's yet another scan command: ------------------------------- const char *how_far[] = { "immediate area", "close by", "a ways off", "far to the", "way far to the", "way way far to the", "a damn long ways off to the", "\n" }; int list_scanned_chars_to_char( struct char_data *list, struct char_data *ch, int dist, int dir) { struct char_data *i; int count = 0; for(i = list; i; i=i->next_in_room) if(CAN_SEE(ch, i) && (i!=ch)) count++; if(!count) return 0; sprintf(buf, "\r"); for(i = list; i; i=i->next_in_room) { if(!CAN_SEE(ch, i) || (i==ch)) continue; sprintf(buf + strlen(buf), "%-38.35s %s %s\r\n", GET_NAME(i), how_far[dist], (dir >= 0) ? dirs[dir] : ""); } buf[strlen(buf)-2] = '\0'; /* strip trailing return */ act(buf,FALSE, ch, 0,0, TO_CHAR); return count; } void block_view(struct char_data *ch, char *str, int dir, int dist) { if((str == NULL) || (*str == '\0')) return; sprintf(buf1, "\r"); sprintf(buf1, "A %-12.12s %-23.16s %s %s", str, "BLOCKS your view", (dist<=1) ? "immediately" : how_far[dist-1], (dir==5)? "below" :dirs[dir]); act(buf1,FALSE, ch, 0,0, TO_CHAR); } ACMD(do_scan) { int direction, distance, count= 0; int was_in = IN_ROOM(ch); if(IS_AFFECTED(ch, AFF_BLIND)) { send_to_char("You can't see a damn thing, you're blind!\r\n", ch); return; } act("You quickly scan the area.", FALSE, ch, 0, 0, TO_CHAR); act("$n quickly scans the area.", TRUE, ch, 0, 0, TO_ROOM); /* Show the people in the immediate room */ count += list_scanned_chars_to_char(world[IN_ROOM(ch)].people, ch, 0, -1); /* Find and show the people in neighboring rooms */ for(direction = 0; direction < NUM_OF_DIRS; direction++) { IN_ROOM(ch) = was_in; for(distance = 1; distance <= GET_SCAN_DIST(ch); distance++) { if(EXIT(ch, direction) && (EXIT(ch, direction)->to_room != NOWHERE) && !IS_SET(EXIT(ch, direction)->exit_info, EX_SECRET)) { /* Okay, there is an exit in that direction, check to see if its open */ if(!IS_SET(EXIT(ch, direction)->exit_info, EX_CLOSED)) { /* Generate a scan list for that room */ count += list_scanned_chars_to_char(world[EXIT(ch, direction)->to_room].people, \ ch, distance, direction); /* Continue the scan in that direction */ IN_ROOM(ch) = EXIT(ch, direction)->to_room; } else { /* There is something in the way, list it to the char */ block_view(ch,world[IN_ROOM(ch)].dir_option[direction]->keyword, direction,distance); break; } } else /* No exit that way, so stop scan in that direction */ break; } } /* Restore the character to original room */ IN_ROOM(ch) = was_in; if (count == 0) send_to_char("You don't see anyone nearby.\r\n", ch); }