Simba Code:
Function FindRock(Var X,Y: Integer): Boolean;
var
B: TBox;
TPA,TPA2: TPointArray;
Hmod,Smod: Extended;
i,Tol,CTS,Col: Integer;
ATPA: T2DPointArray;
begin
Result := False;
CTS := GetColorToleranceSpeed;
ColorToleranceSpeed(3);
{Search the mainscreen area for a color starting at the center, TPA will be the found points}
FindColorsSpiralTolerance(MSCX, MSCY, TPA, 9095162, MSX1, MSY1, MSX2, MSY2, 3);
{No colors found so let's reset our CTS and exit this function (result := False)}
if (Length(TPA) < 1) then
begin
ColorToleranceSpeed(CTS);
Exit;
end;
{Of our HUGE TPA let's split each section into 30x30 boxes}
ATPA := TPAToATPAEx(TPA, 30, 30);
{Now, let's sort those boxes from the middle of the main screen}
SortATPAFromFirstpoint(ATPA, Point(MSCX, MSCY));
{'i' will represent which box we're observing, so start from 0 to the max # of boxes}
for i := 0 to High(ATPA) do
begin
B := GetTPABounds(ATPA[i]); //This isn't really needed, but it's my own style...
with B do //Within this specific box do whatever
begin
ColorToleranceSpeed(2);
ReturnValues(RockCols, Hmod, Smod, Col, Tol);
SetColorSpeed2Modifiers(Hmod, SMod);
FindColorsSpiralTolerance(MSCX, MSCY, TPA2, Col, B.X1, B.Y1, B.X2, B.Y2, Tol)
ColorToleranceSpeed(CTS);
if (Length(TPA2) > 0) then
begin
MiddleTPAEx(ATPA[i], X, Y); //The middle of this TPA (box)
Result := True;
HumanMMouse(X, Y, 5, 5);
if WaitUpTextMulti(['Mine','Rocks'], 555) then
begin
Result := True;
GetMousePos(X, Y);
Exit;
end else
Result := False;
end;
end;
end;
end;