Hello,
I've recently been using the below newBankColorSetup procedure to find a bank chest. The overall script works fine when it locates 1 "potential bank", however there is an error when 2 "potential banks" are found. The error is as follows -> Error: Index out of range (index:1, low:0, high:0) at line 134. Execution failed.
Line 134 is p := ATPA[i].MidPnt;
I noticed in another script there was a similar issue when using ATPA[i].MidPnt as well, so I wonder if this has to do with the recent updates. I have just returned from a 4 month break so please bear with me. Any suggestions would be appreciated!
Code:procedure newBankColorSetup();
var
i, Angle : integer;
ourtestbank : TMSObject;
Pnts : TPointArray;
ATPA: T2DPointArray;
p : TPoint;
begin
with OurtestBank do
begin
ourtestbank.create('Chest', ['Chest','Bank chest'], [createCol(928570, 11, 0.07, 1.86)], [createCol(2566703, 7, 0.90, 0.87)], 150, 50, 70, 50);
if ourtestbank.findall(10, MSCP, Pnts) then
writeln('Found a possible '+toStr(length(Pnts))+ 'chests')
//Ourtestbank.find(Pnts)
else
begin
writeln('Failed to find the chest!');
Angle := round(getcompassangle);
setcompass(angle-randomrange(18,28));
Exit;
end;
for i := 0 to High(Pnts) do
begin
ATPA := FloodFillTPA(pnts);
p := ATPA[i].MidPnt;
custommouse(p);
end;
end;
end;

