SCAR Code:
program AutoColor;
{.include SRL\SRL.scar}
function AutoColor: Integer;
var
arP: TPointArray;
arC: TIntegerArray;
tmpCTS, i, arL: Integer;
H, S, L: Extended;
X, Y, Z: Extended;
x, y, Willow : Integer;
begin
tmpCTS := GetColorToleranceSpeed;
ColorToleranceSpeed(1);
if not (FindColorsTolerance(arP, 2254936, MSX1, MSY1, MSX2, MSY2, 38)) 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 >= 20.14) and (H <= 20.97) and (S >= 30.41) and (S <= 66.06) and (L >= 22.53) and (L <= 31.20) then
begin
ColorToXYZ(arC[i], X, Y, Z);
if (X >= 5.13) and (X <= 14.90) and (Y >= 6.32) and (Y <= 19.92) and (Z >= 2.94) and (Z <= 4.11) 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;
begin
SetupSRL;
AutoColor;
end.
This is an example if i Auto Colored a Willow tree. So how do i use it ? Like what do i do to make it work in my script. I tried multiple things, for one its like this
SCAR Code:
procedure ClickColor;
begin
Willow := AutoColor;
if (FindColorTolerance(Willow, x, y, MSX1, MSY1, MSX2, MSY2, 25)) then
Writeln('Found Color, now clicking');
Mouse(x, y, 2, 2, true);
end;
begin
if (not (FindColorTolerance(Willow, x, y, MSX1, MSY1, MSX2, MSY2, 25))) then
Writeln('Color did not work, go ask for help because we dont even know how to use this yet');
TerminateScript;
end;
begin
ActivateClient;
Wait(2000); //Because RS tends to lag and the AutoColor procedure will not work. So we wait like 2 seconds for RS to not turn white.
AutoColor;
ClickColor;
end.
Thanks. (BTW i did read some guides and they only showed me this. Except for the Click procedure, that was my guess.
Also that CLickColor procedure was made in like, 3minuites. so dun yell at me pl0x k?