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

GetWorldItems

Returns an array of all world items currently known to the client. Each element is a TWorldItemData record containing the item’s serial, graphic, color, coordinates, world number, stack count, and flags.

This provides a snapshot of items visible in the game world (not inside containers). For mobiles, use GetMobiles.

Возвращает массив всех предметов мира, известных клиенту на данный момент. Каждый элемент — запись TWorldItemData, содержащая серийный номер, графику, цвет, координаты, номер мира, количество в стопке и флаги.

Предоставляет снимок предметов, видимых в игровом мире (не внутри контейнеров). Для мобилов используйте GetMobiles.

DWS

function GetWorldItems: TArray<TWorldItemData>;

DWScript only. Not available in PascalScript in this form.

Pascal Script

function GetWorldItems: TWorldItemDataArray;

Type definition:

TWorldItemData = packed record
  Serial: Cardinal;
  Graphic: Word;
  Color: Word;
  X: Word;
  Y: Word;
  Z: ShortInt;
  World: Byte;
  Count: Word;
  Flags: Byte;
end;

TWorldItemDataArray = TArray<TWorldItemData>;

Python

def GetWorldItems() -> list[WorldItemData]: ...

Pascal Example

var
  Items: TArray<TWorldItemData>;
  i: Integer;
begin
  Items := GetWorldItems;
  AddToSystemJournal('World items count: ' + IntToStr(Length(Items)));
  for i := 0 to Min(Length(Items) - 1, 9) do
    AddToSystemJournal('  $' + IntToHex(Items[i].Serial, 8) +
      ' type=$' + IntToHex(Items[i].Graphic, 4) +
      ' at ' + IntToStr(Items[i].X) + ',' + IntToStr(Items[i].Y) + ',' + IntToStr(Items[i].Z));
end.

Python Example

items = GetWorldItems()
AddToSystemJournal(f'World items count: {len(items)}')
for item in items[:10]:
    AddToSystemJournal(f'  ${item.Serial:08X} type=${item.Graphic:04X}'
                       f' at {item.X},{item.Y},{item.Z}')

See Also

GetMobiles, FindTypeEx