SRL Archive - OSR Help

Can't make it click a color


denart5

2013-05-29 13:34:57

I'm kinda stuck with finding color or clicking it. I viewed some giudes but half of them had functions that don't even exist in Simba anymore.

I used auto color aid v2 to generate the color function.

Here is the code
function Color: Integer;
var
arP: TPointArray;
arC: TIntegerArray;
tmpCTS, i, arL: Integer;
begin
tmpCTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.00, 0.30);

if not (FindColorsTolerance(arP, 1316117, MSX1, MSY1, MSX2, MSY2, 2)) 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
Result := arC[i];
Writeln('AutoColor = ' + IntToStr(arC[i]));
Break;
end;

ColorToleranceSpeed(tmpCTS);
SetColorSpeed2Modifiers(0.2, 0.2);

if (i = arL + 1) then
Writeln('AutoColor failed in finding the color.');
end;

procedure Click;
var
x, y : Integer;
begin
if FindColor(x, y, Color, MMX1, MMY1, MMX2, MMY2) then
MMouse(x, y, 4, 4)


end;

All it does is write "AutoColor = 1447703" in the debug but no clicking or mouse movement. I tried Mouse instead of MMouse but it didn't work. (and yes its added to the main loop)

Sjoe

2013-05-29 13:52:27

Try a slightly higher tolerance. I always up the tolerance ACA gives with 2-3

also your coords on function color says Mainscreen, while you're findcolor one is using Minimap.

denart5

2013-05-29 14:29:43

From: Sjoe
Try a slightly higher tolerance. I always up the tolerance ACA gives with 2-3

also your coords on function color says Mainscreen, while you're findcolor one is using Minimap.

Thanks, it works now :D