SRL Archive - OSR Help

FindColorSpiralTolerance - Carry on searching!


NoUserName

2012-06-13 14:49:15

Hey all

im using FindColorSpiralTolerance to find the color of objects and am getting some negative matches [some very similar colors about] how would i make it carry on if the uptext is not one off the objects im searching for?

i know i could use a TPA but i just cant get them to do there stuff for me =[

Gucci

2012-06-13 15:55:35

You could use DTM's as in the case you're describing it seems like a DTM would be more accurate.

Or


procedure Find;
begin
repeat
FindColorsSpiralTolerance(stuff here);
until(IsUpText('text'))
end;

I'm sure that'll work

putonajonny

2012-06-13 16:15:32

Use FindColorsSpiralTolerance, which gives you an array of points, you can then search through, once you get good with arrays look into ATPAs which will make your object finding much more accurate / quicker, this is how you would use FindColorsSpiralTolerance

Function FindMyObject : Boolean;
Var
Points : array of TPoint;
i, H : integer;
begin

FindColorsSpiralTolerance(MSCX, MSCY, Points, 28492, MSX1, MSY1, MSX2, MSY2, 8);//Set the colour and tolerance here
//That searches for your colour, and stores all the instances of it in "Points"

H := high(Points);
for i := 0 to H do //This goes through all of the points stored
begin
MouseBox(Points[i].x - 5, Points[i].y - 5, Points[i].x + 5, Points[i].y + 5, mouse_Move); //It moves your mouse to each one
if(WaitUpTextMulti(['Uptext goes here'], 200+Random(500)))then //And checks the uptext
begin
Result := True;
ClickMouse2(mouse_Left);
exit;
end;
end;

end;

NoUserName

2012-06-13 18:19:17

From: putonajonny
Use FindColorsSpiralTolerance, which gives you an array of points, you can then search through, once you get good with arrays look into ATPAs which will make your object finding much more accurate / quicker, this is how you would use FindColorsSpiralTolerance

Function FindMyObject : Boolean;
Var
Points : array of TPoint;
i, H : integer;
begin

FindColorsSpiralTolerance(MSCX, MSCY, Points, 28492, MSX1, MSY1, MSX2, MSY2, 8);//Set the colour and tolerance here
//That searches for your colour, and stores all the instances of it in "Points"

H := high(Points);
for i := 0 to H do //This goes through all of the points stored
begin
MouseBox(Points[i].x - 5, Points[i].y - 5, Points[i].x + 5, Points[i].y + 5, mouse_Move); //It moves your mouse to each one
if(WaitUpTextMulti(['Uptext goes here'], 200+Random(500)))then //And checks the uptext
begin
Result := True;
ClickMouse2(mouse_Left);
exit;
end;
end;

end;



think i will go with something like this i just cant grasp TPA's yet stupid things any ideas on how i would make it not bother looking unless there was 10 pixels off color there?

[S]paz

2012-06-14 07:48:18

From: NoUserName
think i will go with something like this i just cant grasp TPA's yet stupid things any ideas on how i would make it not bother looking unless there was 10 pixels off color there?


DO you mean 10Px as an area or a tol of 10Px?

FindColorsSpiralTolerance(MSCX, MSCY, Points, 28492, MSX1, MSY1, MSX2, MSY2, 8); //The 8 is the tol for the color 28492

putonajonny

2012-06-14 07:52:57

From: NoUserName
think i will go with something like this i just cant grasp TPA's yet stupid things any ideas on how i would make it not bother looking unless there was 10 pixels off color there?


You would do this with ATPAs:

Function FindMyObject : Boolean;
Var
Points : array of TPoint;
ATPA : array of array of TPoint;
i, H : integer;
begin

FindColorsSpiralTolerance(MSCX, MSCY, Points, 28492, MSX1, MSY1, MSX2, MSY2, 8);//Set the colour and tolerance here
//That searches for your colour, and stores all the instances of it in "Points"

TPAToATPAWrap(Points, 40, ATPA);

SetArrayLength(Points, GetArrayLength(ATPA));

H := high(ATPA);
for i := 0 to H do //This goes through all of the points stored
begin
if(GetArrayLength(ATPA[i]) < 10)then
Continue;
Points[i] := MiddleTPA(TPA[i]);
MouseBox(Points[i].x - 5, Points[i].y - 5, Points[i].x + 5, Points[i].y + 5, mouse_Move); //It moves your mouse to each one
if(WaitUpTextMulti(['Uptext goes here'], 200+Random(500)))then //And checks the uptext
begin
Result := True;
ClickMouse2(mouse_Left);
exit;
end;
end;

end;