shadowrecon Posted January 26, 2012 Share Posted January 26, 2012 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 ? Quote Link to comment Share on other sites More sharing options...
Wanted Posted January 27, 2012 Share Posted January 27, 2012 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. Quote Link to comment Share on other sites More sharing options...
shadowrecon Posted January 27, 2012 Author Share Posted January 27, 2012 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 ? Quote Link to comment Share on other sites More sharing options...
Wanted Posted January 27, 2012 Share Posted January 27, 2012 Why wouldn't you just do SortATPAByMiddle or SortATPASize? Quote Link to comment Share on other sites More sharing options...
mormonman Posted January 27, 2012 Share Posted January 27, 2012 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. Quote Link to comment Share on other sites More sharing options...
Wanted Posted January 27, 2012 Share Posted January 27, 2012 ^ Yea use Debug.scar or DebugSMART.scar to see what your TPAs look like before splitting them, and then your ATPAs after splitting/sorting them. Quote Link to comment Share on other sites More sharing options...
shadowrecon Posted January 27, 2012 Author Share Posted January 27, 2012 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. Quote Link to comment Share on other sites More sharing options...
mormonman Posted January 27, 2012 Share Posted January 27, 2012 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; Quote Link to comment Share on other sites More sharing options...
shadowrecon Posted January 27, 2012 Author Share Posted January 27, 2012 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 Quote Link to comment Share on other sites More sharing options...
mormonman Posted January 27, 2012 Share Posted January 27, 2012 What object are you searching for? I'll show you how I would find it. Quote Link to comment Share on other sites More sharing options...
shadowrecon Posted January 28, 2012 Author Share Posted January 28, 2012 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] Quote Link to comment Share on other sites More sharing options...
Wanted Posted January 28, 2012 Share Posted January 28, 2012 I have said this and will always say this. "Universal" functions (especially when it comes to object finding) is not the way to go. Quote Link to comment Share on other sites More sharing options...
shadowrecon Posted January 28, 2012 Author Share Posted January 28, 2012 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. Quote Link to comment Share on other sites More sharing options...