FindTypeEx
Searches for objects with the specified type ObjType and color Color in the given Container.
ObjType — graphic (type) of the object to search for. Use $FFFF (65535) to match any type.
Color — color (hue) of the object. Use $FFFF (65535) to match any color.
Container — where to search:
| Value | Meaning |
|---|---|
| Backpack | Character’s backpack |
Ground ($FFFFFFFF) |
Objects on the ground within FindDistance / FindVertical radius |
| Object ID | A specific container. If the container does not exist, the search falls back to Backpack |
InSub — if True, search includes subcontainers recursively. If False, only the top level of the container is searched.
Returns the ID of the last found object, or 0 if nothing was found or the character is disconnected.
Search radius (for ground searches) is controlled by FindDistance (horizontal, default 2, max 90) and FindVertical (vertical, default 2, max 120).
After a successful search, the following are updated:
- FindItem — ID of the last found object (same as the return value).
- FindCount — number of found objects (without stack contents).
- FindFullQuantity — total quantity including stack contents.
- FindQuantity — quantity (stack size) of the last found object.
- GetFindedList — full list of found object IDs.
Objects added to the ignore list via Ignore are excluded from results.
Ищет объекты с указанным типом ObjType и цветом Color в заданном контейнере Container.
ObjType — graphic (тип) искомого объекта. $FFFF (65535) — любой тип.
Color — цвет объекта. $FFFF (65535) — любой цвет.
Container — где искать: Backpack (рюкзак), Ground / $FFFFFFFF (земля в радиусе FindDistance / FindVertical), или ID конкретного контейнера.
InSub — True для рекурсивного поиска по вложенным контейнерам.
Возвращает ID последнего найденного объекта, или 0 если ничего не найдено или персонаж не подключён.
Радиус поиска задаётся FindDistance (по горизонтали, макс. 90) и FindVertical (по вертикали, макс. 120).
После успешного поиска обновляются: FindItem, FindCount, FindFullQuantity, FindQuantity, GetFindedList.
Объекты, добавленные в список игнорирования через Ignore, исключаются из результатов.
function FindTypeEx(ObjType: Word; Color: Word; Container: Cardinal; InSub: Boolean): Cardinal;
def FindTypeEx(ObjType: int, Color: int, Container: int, InSub: bool) -> int: ...
const
BANDAGE_TYPE = $0E21;
begin
// Search for bandages of any color in backpack, including bags
if FindTypeEx(BANDAGE_TYPE, $FFFF, Backpack, True) > 0 then
begin
AddToSystemJournal('Found ' + IntToStr(FindCount) + ' bandage stacks');
AddToSystemJournal('Total bandages: ' + IntToStr(FindFullQuantity));
UseObject(FindItem);
end
else
AddToSystemJournal('No bandages found');
// Search for any item on the ground within range
FindDistance := 10;
if FindTypeEx($FFFF, $FFFF, Ground, False) > 0 then
AddToSystemJournal('Items on ground: ' + IntToStr(FindCount));
FindDistance := 2; // restore default
end.
BANDAGE_TYPE = 0x0E21
if FindTypeEx(BANDAGE_TYPE, 0xFFFF, Backpack(), True) > 0:
AddToSystemJournal(f'Found {FindCount()} bandage stacks')
AddToSystemJournal(f'Total bandages: {FindFullQuantity()}')
UseObject(FindItem())
else:
AddToSystemJournal('No bandages found')
SetFindDistance(10)
if FindTypeEx(0xFFFF, 0xFFFF, Ground(), False) > 0:
AddToSystemJournal(f'Items on ground: {FindCount()}')
SetFindDistance(2)
FindType, FindTypesArrayEx, FindItem, FindCount, FindFullQuantity, FindDistance, FindVertical, Ignore