Getmobmob Room Opts

     getmob - syntax: getmob(name|key,[room],[options]) 

Prog Types: Mob, Object, Room

Getmob is used to find a character in the game or a specific room and, if found, returns a CH type variable pointing to that character. The real power of this function is once you have the 'CH' type result, you can perform any other lua prog action on it.

Getmob does not require an actor, which means there are no visiblity checks. It is safe to use from object and room progs.

The first argument can either be a name or a mob key. Wherever possible, use a mob key as this is more efficient - only the internal list of instances for that mob is searched. It also avoids keyword issues.

The second argument is optional and can either be a ROOM type variable, or a room key. If either are set, only that room is searched.

The options available for the third argument are:

  LP_PLRONLY Useful only when searching by name - restrict to player only. 
  LP_MOBONLY Useful only when searching by name - restrict to mob only. 
  LP_ACTIVEONLY Useful only on players - only return player if that are actively playing - not linkdead, in editors, etc. 
  LP_EXACT Require exact match on name, no abbreviations. 

Some examples:

   --- If lasher is on, send him a debug message.
   local tmob = getmob("Lasher",nil,LP_PLRONLY)
   if tmob ~= nil then
      send(tmob,"TOL-49 is executing!")
   end

   --- See if we there's an elite yurgach guard anywhere.
   tmob = getmob("elite yurgach huge")
   if tmob ~= nil then
      say("There is a huge guard in " .. tmob.roomkey)
   end

   --- See if there's a forge worker at aylor recall.
   --- If not, see if there's one anywhere.
   tmob = getmob("aylor-20","aylor-0")
      if tmob ~= nil then
      say("There is an instance of aylor-20 at aylor-0!")
   else
      say("There is no aylor-20 in aylor-0")
      tmob = getmob("aylor-20")
      if tmob ~= nil then
         say("But I did find one at " .. tmob.roomkey)
      end
   end