CountEx
Searches for items with type ObjType and color Color in the specified Container (top level only, no subcontainers) and returns the total quantity including stack contents (FindFullQuantity).
Use $FFFF for ObjType to match any type, $FFFF for Color to match any color.
The method saves and restores the current find fields internally, so it does not affect an in-progress search.
Ищет предметы с типом ObjType и цветом Color в указанном контейнере Container (только верхний уровень, без подконтейнеров) и возвращает общее количество с учётом стеков (FindFullQuantity).
Используйте $FFFF для ObjType (любой тип) и $FFFF для Color (любой цвет).
Метод сохраняет и восстанавливает текущие поля поиска.
function CountEx(ObjType: Word; Color: Word; Container: Cardinal): Integer;
Parameters:
- ObjType — graphic (type) of the item.
$FFFF= any type. - Color — color (hue).
$FFFF= any color. - Container — container to search in.
def CountEx(obj_type: int, color: int, container: int) -> int: ...
begin
// Check if container is empty (any type, any color)
if not Dead and (CountEx($FFFF, $FFFF, chest_id) <= 0) then
UseObject(chest_id); // open the container first
end.
if not Dead() and CountEx(0xFFFF, 0xFFFF, chest_id) <= 0:
UseObject(chest_id)