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.
Логирует ошибку в системный журнал, если объект не найден.
function UseFromGround(ObjType: Word; Color: Word): Cardinal;
def UseFromGround(ObjType: int, Color: int) -> int: ...
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.
MOONGATE_TYPE = 0x0F6C
SetFindDistance(5)
result = UseFromGround(MOONGATE_TYPE, 0xFFFF)
if result > 0:
AddToSystemJournal('Used moongate')
else:
AddToSystemJournal('No moongate nearby')
SetFindDistance(2)