Home API Manuals About Forum
Toggle Dark/Light/Auto mode Toggle Dark/Light/Auto mode Toggle Dark/Light/Auto mode Back to homepage

GetContent

Returns the contents of the container with ID as an array of TContentItemData records.

Each record contains the item’s serial, graphic, color, position within the container, stack count, and parent container ID.

Возвращает содержимое контейнера с ID в виде массива записей TContentItemData.

Каждая запись содержит серийный номер предмета, его graphic, цвет, позицию внутри контейнера, количество в стеке и ID родительского контейнера.

DWS

function GetContent(ID: Cardinal): TArray<TContentItemData>;

Pascal Script

function GetContent(ID: Cardinal): TContentItemDataArray;

Type definition:

TScript_ContentItemData = packed record
  serial: Cardinal;
  graphic: Word;
  color: Word;
  x: Word;
  y: Word;
  count: Word;
  parent: Cardinal;
end;

Python

def GetContent(ObjID: int) -> list[ContentItemData]: ...

Pascal Example

var
  Items: TArray<TContentItemData>;
  i: Integer;
begin
  Items := GetContent(Backpack);
  for i := 0 to Length(Items) - 1 do
    AddToSystemJournal('Item $' + IntToHex(Items[i].serial, 8) +
      ' type=$' + IntToHex(Items[i].graphic, 4) +
      ' count=' + IntToStr(Items[i].count));
end.

Python Example

items = GetContent(Backpack())
for item in items:
    AddToSystemJournal(f'Item ${item.serial:08X} type=${item.graphic:04X} count={item.count}')

See Also

EmptyContainer, FindTypeEx, Backpack