I am trying to write a function that opens Lumbridge Chest Bank if you're standing next to it.
I wrote a function that's derived from an autocolor. it basically takes what is one square east of player and uses it as a center of spiral for a FindColorsSpiralTolerance. Then, it does something I didn't understand (part with ColorXYZ, automatically generated by ACAv2) before returning each working color as a TIntegerArray.
My questions are : is it any use to have more than one color? Second, how do I make sure the function is not clicking at the same spot on the chest everytime it runs?
Thank yall and good scripting 
SCAR Code:
function ChestFind_ColorFinder : TIntegerArray;
var
OneSqEast: TPoint;
ArrayOfPoints: TPointArray;
ArrayOfColors: TIntegerArray;
i, ArrayLength: Integer;
X, Y, Z: Extended;
begin
OneSqEast.x := MSCX + Round(50 * Cos(rs_GetCompassAngleRadians));
OneSqEast.y := MSCY - Round(50 * Sin(rs_GetCompassAngleRadians));
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.08, 0.76);
FindColorsSpiralTolerance(OneSqEast.x, OneSqEast.y, ArrayOfPoints, 6190467, MSX1, MSY1, MSX2, MSY2, 5);
if (Length(ArrayOfPoints) = 0) then
begin
Writeln('Failed to find the color, no result.');
Exit;
end;
ArrayOfColors := GetColors(ArrayOfPoints);
ClearSameIntegers(ArrayOfColors);
ArrayLength := High(ArrayOfColors);
for i := 0 to ArrayLength do
begin
ColorToXYZ(ArrayOfColors[i], X, Y, Z);
if (X >= 14.70) and (X <= 20.91) and (Y >= 15.24) and (Y <= 21.75) and (Z >= 10.13) and (Z <= 17.02) then
begin
Writeln(IntToStr(i));
Result[i] := ArrayOfColors[i];
end;
end;
end;