View Full Version : stopping same colour searching
so there is a colour. if i right click it and its a false item, how can i make it to not search in a specific sized box around the false item next time? so it doesnt continuously right click the same colour
Runaway
06-12-2012, 04:55 AM
Are you using a TPA? It would make this much easier to do.
no im not lol, ill probably look into tpa later, but could you show me a quick example of what to do using tpa anyway? so i can refer back later.
thanks
Make a box, exclude said points.
program new;
{$i srl/srl.simba}
var
Box:Tbox; //Box we exlude
Where :Tpoint;//Where the mouse positon will be stored
begin
SetupSRL;
Box := IntToBox(100,100,-100,-100);//Where do we not want to search
Mouse(50,50,0,0,3);
GetMousePos(Where.x,Where.y); //Get Mouse position
Writeln(IntToStr(Where.x) + ' ' + IntToStr(Where.y)); //Writes X position of mouse
if((Where.x < Box.x1) and (Where.x> Box.x2) and (Where.y <Box.y1) and (Where.y > Box.y2)) then //Checks if in the box
Writeln('You`re in the box!');//In box
end.
Runaway
06-12-2012, 05:32 AM
no im not lol, ill probably look into tpa later, but could you show me a quick example of what to do using tpa anyway? so i can refer back later.
thanks
First you have to find the color and store it in a TPA, and then convert that to an ATPA:
var
ATPA: T2DPointArray;
TPA: TPointArray;
P: TPoint;
Box: TBox;
i: Integer;
// ^ Declare these as local vars
// ...
FindColorsTolerance(TPA, 12345, MIX1, MIY1, MIX2, MIY2, 5);
if (Length(TPA) < 1) then
Exit;
ATPA := SplitTPAEx(TPA, 20, 20);
// ^ Splits the found points into groupings with a max size of 20 x 20
then you use a for..to..do loop to go through the points that were stored in the ATPA:
var
ExcludeBox: TBoxArray;
e: Integer;
// ^ Declare these as global vars
// ...
for i := 0 to High(ATPA) do
begin
P := MiddleTPA(ATPA[i]); // Gets the middle of the points from the first TPA grouping
if InBox(P.x, P.y, ExcludeBox) then // Not sure what the actual function is :S
Continue;
MMouse(P.x, P.y, mouse_move);
if WaitUptext('uptext', 500) then
begin
// ...
end else
begin
Box := GetTPABounds(ATPA[i]);
SetLength(ExcludeBox, e + 1);
ExcludeBox[e] := Box;
Inc(e);
end;
end;
Sorry if it's vague, I'm not on my computer so I can't check anything. I know there's an "InBox" type function but I don't remember the name. Hopefully that helps.
Powered by vBulletin® Version 4.2.1 Copyright © 2024 vBulletin Solutions, Inc. All rights reserved.