This function is an alternative to the radial walk.
It finds colors using either a standard color and tolerance for CTS 1 or can use HSL modifiers for CTS 2. It finds all the instances of that color and clicks the closest point to the target tpoint that is within some distance defined by dist. The target tpoint is also rotated to compensate for camera rotation so the target point should be defined with a north compass angle.
Simba Code:
{*******************************************************************************
function TPAWalk(ColorInfo: TExtendedArray; Target: TPoint; Dist: Integer): Boolean;
By: Kanah
Description: Finds color based on colorinfo ( [color,Tolerance] or [color,Tolerance,HueMod,SatMod]
then finds the closest point to Target; if the distance between target and closest point
is less than dist then it walks there. All this is done on the minimap
The target point is also rotated to compensate for any deviation in compass
angle from north so Target should be defined for a north compass angle.
ColorInfo - [Color,Tolerance] or [color,Tolerance,HueMod,SatMod]
Target - The approximate place to click
Dist - the max distance from Target that would constitute a click there
*******************************************************************************}
function TPAWalk(ColorInfo: TExtendedArray; Target: TPoint; Dist: Integer): Boolean;
var
len,tmpCTS: integer;
ColorTPA: TPointArray;
Angle: Extended;
begin
CountItems
len := length(ColorInfo);
Result := false;
Angle := -1*rs_GetCompassAngleRadians;
Target := RotatePoint(Target,Angle,MMCX,MMCY);
//Decide which option we're using
if (len = 4) then
begin
//Set up the HueMod and SatMod
tmpCTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(ColorInfo[2], ColorInfo[3]);
end else if (len <> 2) then
begin
writeln('Wrong length for ColorInfo');
exit;
end;
//Perform the color finding
if (FindColorsTolerance(ColorTPA,Round(ColorInfo[0]),MMX1,MMY1,MMX2,MMY2,Round(ColorInfo[1]))) then
begin
//Sort from the Target
//SMART_DrawDots(ColorTPA);
SortTPAFrom(ColorTPA,Target);
//Check the distance
if (Distance(ColorTPA[0].x,ColorTPA[0].y,Target.x,Target.y)<dist) then
begin
//Now lets walk there
Mouse(ColorTPA[0].x,ColorTPA[0].y,2,2,true);
FFlag(5);
wait(random(300));
Result := true;
end else
writeln('Color not found in correct location on Minimap');
end else
writeln('Failed to find color on minimap');
if (len = 4) then
begin
ColorToleranceSpeed(tmpCTS);
SetColorSpeed2Modifiers(0.2, 0.2);
end;
end;