Count
Searches for items with type ObjType in the character’s backpack (top level only, no subcontainers) and returns the total quantity including stack contents (FindFullQuantity).
This is a convenience wrapper around FindTypeEx with Color = $FFFF (any color), Container = Backpack, and InSub = False.
The method saves and restores the current find fields internally, so it does not affect an in-progress search started by FindType/FindTypeEx.
Ищет предметы с типом ObjType в рюкзаке персонажа (только верхний уровень, без подконтейнеров) и возвращает общее количество с учётом стеков (FindFullQuantity).
Удобная обёртка над FindTypeEx с Color = $FFFF, Container = Backpack, InSub = False.
Метод сохраняет и восстанавливает текущие поля поиска, поэтому не влияет на текущий поиск через FindType/FindTypeEx.
function Count(ObjType: Word): Integer;
Parameters:
- ObjType — graphic (type) of the item to count.
def Count(obj_type: int) -> int: ...
const
FOOD_TYPE = $09B7;
begin
if Count(FOOD_TYPE) < 10 then
AddToSystemJournal('Low on food: ' + IntToStr(Count(FOOD_TYPE)));
end.
FOOD_TYPE = 0x09B7
if Count(FOOD_TYPE) < 10:
AddToSystemJournal(f'Low on food: {Count(FOOD_TYPE)}')