SCAR Code:
function AutoColor: Integer;
var
arP: TPointArray;
arC: TIntegerArray;
tmpCTS, i, arL: Integer;
H, S, L: Extended;
X, Y, Z: Extended;
begin
tmpCTS := GetColorToleranceSpeed;
ColorToleranceSpeed(1);
FindColorsSpiralTolerance(MMCX, MMCY, arP, 5789018, MMX1, MMY1, MMX2, MMY2, 40);
if (Length(arP) = 0) then
begin
Writeln('Failed to find the color, no result.');
ColorToleranceSpeed(tmpCTS);
Exit;
end;
arC := GetColors(arP);
ClearSameIntegers(arC);
arL := High(arC);
for i := 0 to arL do
begin
ColorToHSL(arC[i], H, S, L);
if (H >= 0.00) and (H <= 93.77) and (S >= 0.72) and (S <= 10.16) and (L >= 26.45) and (L <= 41.39) then
begin
ColorToXYZ(arC[i], X, Y, Z);
if (X >= 5.35) and (X <= 14.18) and (Y >= 5.60) and (Y <= 13.46) and (Z >= 5.37) and (Z <= 17.49) then
begin
Result := arC[i];
Writeln('AutoColor = ' + IntToStr(arC[i]));
Break;
end;
end;
end;
ColorToleranceSpeed(tmpCTS);
if (i = arL + 1) then
Writeln('AutoColor failed in finding the color.');
end;
function WalkWillowRadial(XOffSet, YOffSet: Integer): TPoint;
var
TPA: TPointArray;
i, CTS: Integer;
ATPA: T2DPointArray;
TB: TBox;
begin
CTS := GetColorToleranceSpeed;
ColorToleranceSpeed(1);
RadialWalkEx(TPA, MMCX, MMCY + 20, 1455939, 50, 200, 250, 50);
if Length(TPA) = 0 then Exit;
ATPA := SplitTPAEx(TPA, 20, 20);
SortATPAFrom(ATPA, Point(MMCX, MMCY));
TB := GetATPABounds(ATPA);
for i := 0 to High(TPA) do
if (PointInBox(TPA[i], TB)) then
begin
Result.x := ((TB.x1 + TB.x2) / 2) - XOffSet;
Result.y := ((TB.y1 + TB.y2) / 2) - YOffSet;
Break;
end;
ColorToleranceSpeed(CTS);
end;
function WalkToDB: Boolean;
var
x, y, i, Failsaves: Integer;
TPA: TPointArray;
ATPA: T2DPointArray;
begin
Failsaves := 1;
Loads := Loads + 1;
for i := 0 to Failsaves do
begin
case i of
0:
begin
FindSymbol(X, Y, 'bank');
Mouse(X, Y, 5, 5, True);
DBDTM := DTMFromString('78DA636C67626008644001FFFFFD63F80FA41' +
'9416C2060AC01AAF182C8B140D5FCF9C304A619A17CB09A204C35' +
'22E86AC2F09B0300F8811153');
if DTMRotated(DBDTM, x, y, MMX1, MMY1, MMX2, MMY2) then
begin
Result := True;
Mouse(x, y, 3, 3, True);
Flag;
AntiRandom;
Exit;
end;
begin
FreeDTM(DBDTM);
end;
end;
1:
begin
RadialWalkEx(TPA, MMCX, MMCY, 195836, 3, 360, 30, 30);
if Length(TPA) = 0 then Exit;
SortTPAFrom(TPA, Point(MMCX, MMCY));
ATPA := SplitTPAEx(TPA, 10, 10);
SortATPASize(ATPA, True);
MiddleTPAEx(ATPA[0], x, y);
Mouse(x, y, 3, 3, True);
Result := True;
AntiRandom;
Flag;
AntiRandom;
Exit;
end;
end;
end;
function WalkToDWillows: boolean;
var
u,x,y,m: Integer;
P: TPoint;
begin
if (not(loggedin)) then exit;
U := findwatercolor;
P := WalkWillowRadial(3, 3);
if (PointSet(P)) then
begin
Result := True;
Mouse(P.x, P.y, 3, 3, True);
AntiRandom;
Flag;
Exit;
end;
if (DTMRotated(RockDTM, x, y, MMX1, MMY1, MMX2, MMY2)) then // Found DDTM
begin
Result := True;
Mouse(x, y, 5, 5, True);
AntiRandom;
Flag;
Wait(RandomRange(100, 500));
Exit;
end;
if RadialWalk(AutoColor, 160, 200, 60, -10, -10) then
Result := True
else
Result := RadialWalk(FindWaterColor, 260, 280, 40, 70, 5);
if Result then
begin
AntiRandom;
Exit;
end;
if Findsymbol(x,y,'fish') then
begin
M := GetColor(x - 20, y);
if M = U Then
begin
Mouse(x,y,5,5, true);
wait(250+random(250));
FFlag(10);
If Distance(mmcx,mmcy,x,y) < 7 then
begin
result := true;
AntiRandom;
Exit;
end;
end;
end;
end;