SRL Archive - SRL Archives

FindRockColor


noidea

2009-01-31 12:44:42

Old one was broken.
I made this one.

Function FindRockColor2: Integer;
var
Lengths, TestColor, Col, i: Integer;
Rockk: Array of TPoint;
begin
col := 3028286;
FindColorsSpiralTolerance(MMCX, MMCY, Rockk, Col, MMX1, MMY1, MMX2, MMY2, 25);
Lengths := GetarrayLength(Rockk);
for i := 0 to Lengths - 1 do
begin
TestColor := Getcolor(Rockk[i].x, Rockk[i].y);
if Getcolor(Rockk[i].x + 1, Rockk[i].y) = TestColor then
begin
Result := TestColor;
writeln('RockColor = '+inttostr(result));
exit;
end;
end;
writeln('[Error]Couldnt Find The Rock Color!');
Result := 0;
end;

Cazax

2009-01-31 12:46:52

That won't work… to fix it just expand the RGB ranges from SRL FindRockColor.

n3ss3s

2009-01-31 12:48:13

=


Rock colors aren't static. Which is the reason we even have autocolors for them.

noidea

2009-01-31 12:48:20

It works for me every time.

Shuttleu

2009-02-04 14:55:39

or this one
function FindRockColor: Integer;
var
GC, a, l, TestColor: integer;
var
P:array of Tpoint;
begin
GC := 5591394;
Flag;
FindColorsSpiralTolerance(MMCX,MMCY, P, GC, MMX1,MMY1,MMX2,MMY2, 80);
l:=GetArrayLength(P);
for a:= 0 to l-1 do
begin
TestColor := GetColor(P[a].x,P[a].y);
if (TestColor-GetColor(P[a].x+1,P[a].y)=1250837)then
begin
Result := TestColor;
WriteLn('Rock Color = ' + IntToStr(TestColor));
Exit;
end;
end;
WriteLn('Could not find Rock Color!');
Result := 0;
end;
could you test for me please
it works for me

~shut

noidea

2009-02-04 15:27:33

From: Shuttleu
or this one
function FindRockColor: Integer;
var
GC, a, l, TestColor: integer;
var
P:array of Tpoint;
begin
GC := 5591394;
Flag;
FindColorsSpiralTolerance(MMCX,MMCY, P, GC, MMX1,MMY1,MMX2,MMY2, 80);
l:=GetArrayLength(P);
for a:= 0 to l-1 do
begin
TestColor := GetColor(P[a].x,P[a].y);
if (TestColor-GetColor(P[a].x+1,P[a].y)=1250837)then
begin
Result := TestColor;
WriteLn('Rock Color = ' + IntToStr(TestColor));
Exit;
end;
end;
WriteLn('Could not find Rock Color!');
Result := 0;
end;

could you test for me please
it works for me

~shut



80 tolerance is way to much. The rock colour on hte MiniMap is the same colour as around the minimaps, like next to the Comapss. I really like DebugTPA, by Wizzup? to help find these things.

Cazax

2009-02-04 15:38:21

He checks the difference which makes it really accurate: if (TestColor-GetColor(P[a].x+1,P[a].y)=1250837)then

That's how SRL FindRockColor works.

Shuttleu

2009-02-04 15:45:47

From: Cazax
He checks the difference which makes it really accurate: if (TestColor-GetColor(P[a].x+1,P[a].y)=1250837)then

That's how SRL FindRockColor works.


exactly so it will ONLY find the rock color not any other grey color ;)
by searching the color one pixel to the right it can check the differance between the two colors and if they are a certain differance then it will have found the color which is why its very accurate

~shut

gerauchert

2009-02-16 18:25:16

@Shut

Works great. Thanks man ;)

Markus

2009-03-06 09:54:08

Thanks :)
Added & closed

Wizzup?

2009-03-06 10:15:53

Few things:
-Was it not possible to use the constant RGB relation?
-Why spiral?