From Stealth Client

Jump to: navigation, search


FindType

function FindType(ObjType:Word; Container:Cardinal):Cardinal

Searches for the specified object type ObjType in the container, Container.

It will NOT look in pouches (containers within the specified container). For such a search refer to Doc:Api/FindTypeEx; in fact, Findtype = FindTypeEx(ObjType, $FFFF, Container, false); If the object satisfies all the conditions, before adding it to FindedList its presence in the IgnoreList is verified. If the object is ignored - then then it won't be part of the selection. For more details, see Doc:Api/Ignore

Search results for:

  • A list of found objects is stored in the FindedList, which can be obtained trough the function Doc:Api/GetFindedList
  • The last object was found is recorded and can be obtained using Doc:Api/FindItem
  • The last object found is returned as result of this function
  • The Doc:Api/FindCount function record the count of found items (a pile of several stackable items is considered as one item!)
  • The Doc:Api/FindQuantity returns the ammount of stack if the latter is a pile
  • The Doc:Api/FindFullQuantity records the total number of items in all the found stacks (if there are no results, it will be equal to Doc:Api/FindCount

At the distance of the search depends on:

  • Doc:Api/FindDistance - specifies the search range for the horizontal cells. F.E.: 3 - then Stealth will look within a radius of three tiles. The default value is 2 (taken as the default on most servers as the maximum distance at which an ordinary player under normal conditions can interact with objects)
  • Doc:Api/FindVertical - specifies the search range for the vertical. The default is 5, so to avoid items in adjacent floors.

If nothing is found - return 0.

The parameter Container can be used:

If you specify a nonexistent container ID, the search is performed in the backpack of your character.

If ObjType = -1 - will be returned all objects in container\ground (with considering of FindDistance and FindVertical)

Example 1:

//Pascal Script
if FindType(bottle_type,Ground) > 0 then
begin
  UseObject(FindItem);
end;
#Python
if FindType(bottle_type, Ground()):
  UseObject(FindItem())

Example 2:

  //Pascal Script
  FindType(runes, backpack);
  AddAddToSystemJournal('Runes found:' + IntToStr(FindCount));
  #Python
  FindType(runes, Backpack())
  AddAddToSystemJournal('Runes found: {0}'.format(FindCount()))