При поиске тайлов с водой рядом с берегом, скрипт находит все тайлы в радиусе видимости...
Но стоит чуть отплыть от берега, скрипт перестаёт видеть эти тайлы вообще!
Code: Select all
Program New;
const
FishingDistance = 3; // Дистанция поиска
type
TileRecord = Record
t,x,y : integer;
end;
var
TileCount : integer;
Tile : array [0..5000] of TileRecord;
uh, dh, enter, tab : String;
{$Include 'all.inc'}
procedure SetSayinfo;
begin
uh := #13#10#13#10#13#10#13#10#13#10#13#10#13#10#13#10#13#10#13#10#13#10#13#10#9#9#9#9;
dh := #13#10#13#10#13#10;
enter := #13#10;
tab := '#9';
end;
procedure CheckDuble;
var
i, i0 : integer;
begin
AddToSystemJournal('Отсееваем дубликаты и пустые тайлы...');
for i := 0 to TileCount do
begin
for i0 := i+1 to TileCount do
begin
if (Tile[i].x = Tile[i0].x) and (Tile[i].y = Tile[i0].y) and (Tile[i].x > 0) and (Tile[i].y > 0) then
begin
Tile[i0].x := 0;
Tile[i0].y := 0;
end;
end;
end;
for i := 0 to TileCount do
begin
if (Tile[i].x = 0) and (Tile[i].y = 0) then
begin
i0 := i;
while i0 <= TileCount do
begin
Tile[i0].x := Tile[i0+1].x;
Tile[i0].y := Tile[i0+1].y;
i0 := i0 + 1;
end;
TileCount := TileCount - 1;
end;
end;
AddToSystemJournal('После отсеевания осталось: '+IntToStr(TileCount-1)+'.');
end;
function SearchPoint : Boolean;
var
a : TFoundTilesArray;
TyleType : array [0..9] of cardinal;
b, i, i0, StartX, StartY, check : integer;
begin
TyleType[0] := 6039;
TyleType[1] := 6040;
TyleType[2] := 6041;
TyleType[3] := 6042;
TyleType[4] := 6043;
TyleType[5] := 6044;
TyleType[6] := 16368;
TyleType[7] := 16369;
TyleType[8] := 311;
TyleType[9] := 310;
AddToSystemJournal(dh);
AddToSystemJournal('Ищем тайлы с водой в радиусе '+IntToStr(FishingDistance)+'...');
StartX := GetX(Self);
StartY := GetY(Self);
for i := 0 to 9 do
begin
b:= GetStaticTilesArray(StartX-FishingDistance,StartY-FishingDistance,StartX+FishingDistance,StartY+FishingDistance, WorldNum, TyleType[i], a);
if b > 0 then
begin
for i0 := 0 to b do
begin
Tile[TileCount].t := a[i0].Tile;
Tile[TileCount].x := a[i0].X;
Tile[TileCount].y := a[i0].Y;
TileCount := TileCount + 1;
end;
end;
end;
if TileCount > 0 then check := TileCount + 1;
AddToSystemJournal('Нашли тайлов: '+IntToStr(check)+'.');
if TileCount <= 0 then exit;
CheckDuble;
result := True;
end;
{procedure StartFishing;
var
i, t, b : integer;
time : TDateTime;
begin
for i := 0 to b do
begin
CancelTarget;
CheckSave;
UseObject(ObjAtLayer(LhandLayer));
CheckTarget(5);
time := Now;
TargetToTile(a[i].Tile, a[i].X, a[i].Y, -254);
wait(100);
t := 0;
repeat
if InJournalBetweenTimes('Cancelled|That is too far away|You can|That location', time, Now) <> -1 then break;
wait(100);
t := t + 1;
CheckSave;
until (InJournalBetweenTimes('Points|That is too far away', time, Now) <> -1) or (t >= 200);
if FoundedParamID = 1 then AddToSystemJournal('X ' + IntToStr(a[0].X) + ' Y ' + IntToStr(a[0].Y) + ' Z ' + IntToStr(a[0].Z) + ' Tile ' + IntToStr(a[0].Tile));
end;
end;}
begin
SetSayinfo;
SearchPoint;
end.