Re: [code] player/mob names snippet

From: Sammy (samedi@DHC.NET)
Date: 06/08/98

On Mon, 8 Jun 1998, Anthony Rye wrote:

>  Easier than that. I was messing around wiping midgaar and seem to have
> alot of guard mobs on mu mud, so i did a little test. I medited the city
> guard and the newbie guard. Since i use OasisOLC1.6 i changed the alias
> name to ne gua for the newbie guard and ci gu for city guard, works great.
> My suggestion would be try the same.

Works great if you 'kill gu', but if you ever get players you'll probably
gets complaints when people can't figure out why 'kill guard' doesn't

In the interest of putting this topic to rest, here's a drop-in
replacement for get_char_vis that will search for players before mobs when
doing a global character search.  It'll fix tell, goto, at, trans, etc.

struct char_data *get_char_vis(struct char_data * ch, char *name)
  struct char_data *i;
  struct descriptor_data *d;
  int j = 0, number;
  char tmpname[MAX_INPUT_LENGTH];
  char *tmp = tmpname;

  /* check the room first */
  if ((i = get_char_room_vis(ch, name)) != NULL)
    return i;

  strcpy(tmp, name);
  if (!(number = get_number(&tmp)))
    return get_player_vis(ch, tmp, 0);

  /* check players first */
  for (d = descriptor_list; d && (j <= number); d = d->next)
    if (d->character && isname(tmp, d->character->
        && CAN_SEE(ch, d->character))
      if (++j == number)
        return d->character;

  /* no player found, so check mobs */
  for (i = character_list; i && (j <= number); i = i->next)
    if (IS_NPC(i) && isname(tmp, i-> && CAN_SEE(ch, i))
      if (++j == number)
        return i;

  return NULL;


     | Ensure that you have read the CircleMUD Mailing List FAQ:  |
     | |

This archive was generated by hypermail 2b30 : 12/15/00 PST