GetDistance
Returns the distance in tiles from the current character to the object with ObjID.
Returns -1 if the object does not exist. Otherwise returns the distance in tiles.
Unlike Dist (which takes two arbitrary coordinate pairs), this method always measures from the current character’s position.
Возвращает расстояние в тайлах от текущего персонажа до объекта с ObjID.
Возвращает -1, если объект не существует. Иначе возвращает расстояние в тайлах.
В отличие от Dist (который принимает две произвольные пары координат), этот метод всегда измеряет от позиции текущего персонажа.
function GetDistance(ObjID: Cardinal): Integer;
Parameters:
- ObjID — ID of the target object.
def GetDistance(ObjID: int) -> int: ...
begin
if GetDistance(chest_id) > 1 then
begin
AddToSystemJournal('Proceeding to chest');
MoveXY(GetX(chest_id), GetY(chest_id), True, 1, True);
Wait(1000);
end;
end.
if GetDistance(chest_id) > 1:
AddToSystemJournal('Proceeding to chest')
MoveXY(GetX(chest_id), GetY(chest_id), True, 1, True)
Wait(1000)