Jump to content
shadowrecon

Randomly searching through a ATPA Group

Recommended Posts

I was Wondering what methods would be good to search through a ATPA Group, i started out with just calling a ATPA(random(LOW(ATPA),HIGH(ATPA))) within the for loop then running my checks with the points, but this wasnt even close to searching every point seemed to hit the same points, over and over, so i added the var from the for loop to the low atap but still seemed sketchy.

 

I was thinking maybe a Exponential growth equation of some sort but this could get big way to fast a skip alot of the center groups, whats a better way of doing this?

 

And is there a way to take the median of a ATPA Group ?

Link to comment
Share on other sites

Why would you want to search through an ATPA randomy? You would have to generate an array of numbers that includes all of them in a range and then mix up the order, then sort through them chronologically by their index using their value in the ATPA.

 

Please tell us what you're trying to actually accomplish with this instead of asking abstract hard to understand questions/requests.

Link to comment
Share on other sites

Why would you want to search through an ATPA randomy? You would have to generate an array of numbers that includes all of them in a range and then mix up the order, then sort through them chronologically by their index using their value in the ATPA.

 

Please tell us what you're trying to actually accomplish with this instead of asking abstract hard to understand questions/requests.

Finding objects on screen, is my goal, right now im sorting the tpa(Low to high) then grouping it into a ATPA but what this does it makes a shit load of groups, and while the for loop increases, it goes through ea ATPA[] index, but i would rather search randomly through the ATPA, I Guess it would make since to just mix the ATPA up then run the for loop, So i guess my question now, is there a way to randomly mix up a Grouped ATPA ?
Link to comment
Share on other sites

Finding objects on screen, is my goal, right now im sorting the tpa(Low to high) then grouping it into a ATPA but what this does it makes a shit load of groups, and while the for loop increases, it goes through ea ATPA[] index, but i would rather search randomly through the ATPA, I Guess it would make since to just mix the ATPA up then run the for loop, So i guess my question now, is there a way to randomly mix up a Grouped ATPA ?

 

Sounds like you need to group your ATPA's better.

Link to comment
Share on other sites

ive debugged the tpa's and sorted my tpa's before grouping, the problem is, that is that if there is a random point out in lala land, that point becomes its own group, and if it find s a couple of those points it could be searching lala land for a while, i want the function to jump a around a bit not just search 1 box then jump 10-20 pixels and search another. id rather it search through the ATPA Randomly instead of just going from low to high or high to low, i guess middle does work but thats only going to give me middle points.

 

The thing is its just causing a problem in one script where it takes an extra 1-2 seconds to find what im looking for, and its always because of the point being way out of range, and making a group of its own. Just looking for a more efficient way.

Link to comment
Share on other sites

ive debugged the tpa's and sorted my tpa's before grouping, the problem is, that is that if there is a random point out in lala land, that point becomes its own group, and if it find s a couple of those points it could be searching lala land for a while, i want the function to jump a around a bit not just search 1 box then jump 10-20 pixels and search another. id rather it search through the ATPA Randomly instead of just going from low to high or high to low, i guess middle does work but thats only going to give me middle points.

 

The thing is its just causing a problem in one script where it takes an extra 1-2 seconds to find what im looking for, and its always because of the point being way out of range, and making a group of its own. Just looking for a more efficient way.

 

Use length checks on your sorted ATPA.

 

for i := 0 to High(ATPA) do
 if (Length(ATPA[i]) < somenumber) then 
   Continue
 else
 begin
 //move mouse and check for uptext
 end;

Link to comment
Share on other sites

Use length checks on your sorted ATPA.

 

 

for i := 0 to High(ATPA) do
 if (Length(ATPA[i]) < somenumber) then 
   Continue
 else
 begin
 //move mouse and check for uptext
 end;

 

Ive Tried RandomSpot := RR(LOW(ATPA),HIGH(ATPA));

then TP := MiddleATPA(ATPA[RandomSpot);

but the thing is seems to go to about the same points, and the method u suggested is basicly the For lop just to a certain number which is what im currently doing which goes from low to high (in that case a certain number) the problem is i dont know how many groups where made so that would cause an out of bounds error more than likely

Link to comment
Share on other sites

Well im working on making a universal function heres what i have -->>

 

Function UBWaitFindObjAreaEx(UBColor,xs,ys,xe,ye:Integer;UBHue,UBSat:Extended;UBTol: Integer; UBUpText,UBOptions: TStringArray; IfOptionCancle: String; WaitMin, WaitMax, PixelX,PixelY: Integer):Boolean;
var
T, I: Integer;
TPA : TPointArray;
TP : TPoint;
ATPA: T2DPointArray;
Begin
result := False;
T := Getsystemtime + RR(WaitMin,WaitMax);
ColorToleranceSpeed(2);
SetColorspeed2Modifiers(UBHue, UBSat);
Repeat
if FindColorsTolerance(TPA,UBColor,xs,ys,xe,ye,UBTol) then
begin
SortTPA(TPA);
ATPA := GroupTPAEx(TPA, PixelX, PixelY);
for I := Low(ATPA) to High(ATPA) do
begin
if High(Atpa) <= 1 then
begin
result := False;
exit;
end;
TP := MiddleTpa(ATPA[i]);
MMouse(TP.x,TP.y,1,1);
If IsUpTextMulti(UBUpText) then
Begin
Mouse(TP.x,TP.y,0,0,False);
waitRR(250,400);
If (OptionExists(IfOptionCancle) = false) then
begin
If ChooseOptionMulti(UBOptions) then
begin
Result := True
ColorToleranceSpeed(1);
exit;
end;
end else
ChooseOptionMulti(['ncele','Cancle']);
end;
waitRR(250,400);
end;
end else
begin
Result := False;
ColorToleranceSpeed(1);
exit;
end;
Until (T < GetSystemTime) Or (Result = True);
End; [/Code]

Link to comment
Share on other sites

Well thats why there are so many different setting when using the function, as you can change screensize,wait time,area, Color, hue, sat ,tol, uptext,options, cancel options ect.. all on one line instead of 40. and if your finding more than one item then this cuts the scripts size down. As of now this function does a good job at what it is meant to do, but id like to optimize it a bit and try to make it more random.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
  • Create New...