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

UseFromGround

Searches for an object of the specified type and color on the ground, then uses (double-clicks) it.

ObjType — graphic (type) of the object. Use $FFFF to match any type.

Color — color (hue) of the object. Use $FFFF to match any color.

Returns the serial (ID) of the found and used object, or 0 if no matching object was found on the ground.

The search uses FindTypeEx with Ground as the container and InSub = False. The search radius is controlled by FindDistance and FindVertical.

Logs an error to the system journal if no matching object is found.

Ищет объект указанного типа и цвета на земле, затем использует (double-click) его.

ObjType — graphic (тип) объекта. $FFFF — любой тип.

Color — цвет объекта. $FFFF — любой цвет.

Возвращает serial (ID) найденного и использованного объекта, или 0 если подходящий объект на земле не найден.

Поиск использует FindTypeEx с Ground в качестве контейнера и InSub = False. Радиус поиска управляется FindDistance и FindVertical.

Логирует ошибку в системный журнал, если объект не найден.

Pascal

function UseFromGround(ObjType: Word; Color: Word): Cardinal;

Python

def UseFromGround(ObjType: int, Color: int) -> int: ...

Pascal Example

const
  MOONGATE_TYPE = $0F6C;
begin
  FindDistance := 5;
  if UseFromGround(MOONGATE_TYPE, $FFFF) > 0 then
    AddToSystemJournal('Used moongate')
  else
    AddToSystemJournal('No moongate nearby');
  FindDistance := 2;
end.

Python Example

MOONGATE_TYPE = 0x0F6C
SetFindDistance(5)
result = UseFromGround(MOONGATE_TYPE, 0xFFFF)
if result > 0:
    AddToSystemJournal('Used moongate')
else:
    AddToSystemJournal('No moongate nearby')
SetFindDistance(2)

See Also

UseObject, UseType