[NEWBIE] Locate Object

From: Josh Smith (OnceOwnsYou@aol.com)
Date: 11/01/00


Yes I have been having quite a bit of problem with a code that was
implemented on my MUD since a little bit before my time. The Locate Object
spell I have pasted down below for whoever wishes to help to take a quick
look at, I was wondering if anyone had an idea of how to fix it, whenever
someone uses the spell it locates the thing with the keyword and then it
looks at the object with the keywords keyword and takes that one to. On my
MUD we have something called Mega Armor, so let me show you an instance:
 "
30000H 30000P 30000V > psi 'locate' mega
Okay.
A piece of bio armor is being worn by a mutating biomass.
Guges-D Power Armor is in Power Armor Bay.
Guges-D Power Armor is in Power Armor Bay.
Guges-D Power Armor is in Power Armor Bay.
Guges-D Power Armor is in Power Armor Bay.
Guges-D Power Armor is in Power Armor Bay.
RAC riot armor is being worn by a Rent-A-Cop.
RAC riot armor is being worn by a Rent-A-Cop.
RAC riot armor is being worn by a Rent-A-Cop.
RAC riot armor is being worn by a Rent-A-Cop.
RAC riot armor is being worn by a Rent-A-Cop.
RAC riot armor is being worn by a Rent-A-Cop.
Combat Armor is in The Edge of the Base Complex.
Mega-Armor is in On Eric's Computer (DT).
Some armor plates is in a crate.
RAC riot armor is being worn by a Rent-A-Cop.
RAC riot armor is being worn by a Rent-A-Cop.
RAC riot armor is being worn by a Rent-A-Cop.
Armor mesk padding is being carried by Senhair.
Terminator Plated Armor is being carried by a T101 Terminator.
Combat Armor is in Northeastern Corner of the Depot.
Mega-Armor is in Lost in the Phobos Anomaly.
X-AMP body armor is being worn by the X-AMP.
AMP body armor is being worn by a Mark II AMP.
AMP body armor is being worn by a Mark II AMP.
Red Combat Armor is being worn by Matic.
Heavy Composite Armor is being worn by a Heavy Trooper.
Riot armor is being carried by a Retired Veteran.
"
I was wondering if anyone knew how to fix this to where it ONLY located the
object keywords. And didn't do...well...that :)


ASPELL(spell_locate_object)
{
  struct obj_data *i, *container, *next_container;
  char name[MAX_INPUT_LENGTH];
  int j;
  bool check = FALSE;

  strcpy(name, fname(obj->name));
  j = GET_LEVEL(ch);

  for (i = object_list; i && (j > 0); i = i->next) {
    if (!isname(name, i->name))
      continue;

    if (i->carried_by)
     if (GET_LEVEL(i->carried_by) < LVL_IMMORT ||
       GET_LEVEL(ch) >= LVL_IMMORT)
      sprintf(buf, "%s is being carried by %s.\n\r",
              i->short_description, PERS(i->carried_by, ch));
     else check = TRUE;
    else if (i->in_room != NOWHERE)
      sprintf(buf, "%s is in %s.\n\r", i->short_description,
              world[i->in_room].name);
    else if (i->in_obj) {
     container = i->in_obj;
     next_container = container->in_obj;

     while(next_container != NULL) {
       container = next_container;
       next_container = container->in_obj;
     }

     if (container->carried_by) {
      if(GET_LEVEL(container->carried_by) < LVL_IMMORT ||
         GET_LEVEL(ch) >= LVL_IMMORT)
      sprintf(buf, "%s is in %s.\n\r", i->short_description,
              i->in_obj->short_description);
      else check = TRUE;
     }
    else
      sprintf(buf, "%s is in %s.\n\r", i->short_description,
              i->in_obj->short_description);
   }
    else if (i->worn_by)
if (GET_LEVEL(i->worn_by) < LVL_IMMORT ||
       GET_LEVEL(ch) >= LVL_IMMORT)
      sprintf(buf, "%s is being worn by %s.\n\r",
              i->short_description, PERS(i->worn_by, ch));
     else check = TRUE;
    else
      sprintf(buf, "%s's location is uncertain.\n\r",
              i->short_description);

    CAP(buf);
    if(!check) {
    send_to_char(buf, ch);
    j--;
    }

    check = FALSE;
  }

  if (j == (GET_LEVEL(ch) >> 1))
    send_to_char("You sense nothing.\n\r", ch);
  else if (j == GET_LEVEL(ch))
    send_to_char("You sense nothing.\r\n", ch);

}


     +------------------------------------------------------------+
     | 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 : 04/11/01 PDT