Denaa
2014-03-26 21:13:46
Basically I'm trying to do nothing more than have the bot do the following things: Recognize 3 colors
thats literally all it needs to do, click 3 colors. it should be so simple, right? BUT…this is my first day of ever actually coding anything (or trying to) and I can't seem to get it to work. also I dont know how to make it right click and recognize the names of objects or anything "advanced" (in my mind), anyway I just want to know what i've done wrong xd it only has 3 jobs
Program Autocolor;
{$i srl-6/srl.simba}
begin
clearDebug();
setupSRL();
end.
function AutoColor: Integer;
var
arP: TPointArray;
arC: TIntegerArray;
tmpCTS, i, arL: Integer;
X, Y, Z: Extended;
begin
tmpCTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.25, 0.17);
FindColorsSpiralTolerance(MMCX, MMCY, arP, 5989745, MMX1, MMY1, MMX2, MMY2, 16);
if (Length(arP) = 0) then
begin
Writeln('Failed to find the color, no result.');
ColorToleranceSpeed(tmpCTS);
SetColorSpeed2Modifiers(0.2, 0.2);
Exit;
end;
arC := GetColors(arP);
ClearSameIntegers(arC);
arL := High(arC);
for i := 0 to arL do
begin
ColorToXYZ(arC, X, Y, Z);
if (X >= 5.06) and (X <= 26.27) and (Y >= 5.33) and (Y <= 26.35) and (Z >= 4.23) and (Z <= 25.54) then
begin
Result := arC;
Writeln('AutoColor = ' + IntToStr(arC));
Break;
end;
end;
ColorToleranceSpeed(tmpCTS);
SetColorSpeed2Modifiers(0.2, 0.2);
if (i = arL + 1) then
Writeln('AutoColor failed in finding the color.');
end;
begin
SetupSRL;
AutoColor;
end.
thats literally all it needs to do, click 3 colors. it should be so simple, right? BUT…this is my first day of ever actually coding anything (or trying to) and I can't seem to get it to work. also I dont know how to make it right click and recognize the names of objects or anything "advanced" (in my mind), anyway I just want to know what i've done wrong xd it only has 3 jobs
Program Autocolor;
{$i srl-6/srl.simba}
begin
clearDebug();
setupSRL();
end.
function AutoColor: Integer;
var
arP: TPointArray;
arC: TIntegerArray;
tmpCTS, i, arL: Integer;
X, Y, Z: Extended;
begin
tmpCTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.25, 0.17);
FindColorsSpiralTolerance(MMCX, MMCY, arP, 5989745, MMX1, MMY1, MMX2, MMY2, 16);
if (Length(arP) = 0) then
begin
Writeln('Failed to find the color, no result.');
ColorToleranceSpeed(tmpCTS);
SetColorSpeed2Modifiers(0.2, 0.2);
Exit;
end;
arC := GetColors(arP);
ClearSameIntegers(arC);
arL := High(arC);
for i := 0 to arL do
begin
ColorToXYZ(arC, X, Y, Z);
if (X >= 5.06) and (X <= 26.27) and (Y >= 5.33) and (Y <= 26.35) and (Z >= 4.23) and (Z <= 25.54) then
begin
Result := arC;
Writeln('AutoColor = ' + IntToStr(arC));
Break;
end;
end;
ColorToleranceSpeed(tmpCTS);
SetColorSpeed2Modifiers(0.2, 0.2);
if (i = arL + 1) then
Writeln('AutoColor failed in finding the color.');
end;
begin
SetupSRL;
AutoColor;
end.