rsutton Posted January 18, 2012 Share Posted January 18, 2012 What im trying to do is there is 2 symbols on the MM. I want to get all the co-ords for those symbols ( both use same colors and are found on same MM screen ) then find the middle of those symbols x,y which lands me between the two symbols with a X and Y click. Not too familiar with tpas yet about storing them and retrieving. Any advice or such would be nice. Quote Link to comment Share on other sites More sharing options...
FHannes Posted January 18, 2012 Share Posted January 18, 2012 [wiki=TPAMiddle]TPAMiddle[/wiki] calculates the average value of each coordinate. Quote Link to comment Share on other sites More sharing options...
rsutton Posted January 18, 2012 Author Share Posted January 18, 2012 ok so literally look for Find colors MM , set them in array. No need to split them or anything. just throw a middletpa out there and then .x and .y them ? sounds easy in theory lets give this a go Quote Link to comment Share on other sites More sharing options...
FHannes Posted January 18, 2012 Share Posted January 18, 2012 Well, TPAMiddle won't return the middlepoint, if yo have more points to the left of the middle for example, the coordinate returned by the function would be more to the left. To achieve what you want you should use [wiki=TPABounds]TPABounds[/wiki] to get the boundaries of the area that contain the colors, basically the rectangle that surrounds them. Then use that TBox to calculate the middle point it should be something like: Point.X := Box.X1 + (Box.X2 - Box.X1 + 1) div 2; Point.Y := Box.Y1 + (Box.Y2 - Box.Y1 + 1) div 2; Quote Link to comment Share on other sites More sharing options...
FHannes Posted January 18, 2012 Share Posted January 18, 2012 These functions work, you must be doing something wrong... Also, didn't I tell you not to use TPAMiddle (and you shouldn't use MittleTPA because it will be removed soon). TPAMiddle calculates the arithmetic mean of the coordinates, not the center. Quote Link to comment Share on other sites More sharing options...
rsutton Posted January 19, 2012 Author Share Posted January 19, 2012 (edited) TIP FOR EVERYONE, MAKE SURE YOU HAVE THE BOX CO-ORDS RIGHT lol !!! This woiuld have worked of rme hours ago. Least I learned alot about atpa and stuff lol Edited January 19, 2012 by rsutton Quote Link to comment Share on other sites More sharing options...
Bixby Sayz Posted January 19, 2012 Share Posted January 19, 2012 How many points in the tpa? If you aren't finding all the points you think you are, nothing will work "right" from there on. Fallen victim to this more than once myself. Quote Link to comment Share on other sites More sharing options...
rsutton Posted January 19, 2012 Author Share Posted January 19, 2012 (edited) Nah man keep MiddleTPA at least it is useful Dont throw out good script code bro please. or could you pass it on to me so I can use it personally or add it in an include myself. Bib thanks for the addition bud. But it was only not working cause the co-ords were set wrong... geezus that was retarded... Edited January 19, 2012 by rsutton Quote Link to comment Share on other sites More sharing options...
Wanted Posted January 19, 2012 Share Posted January 19, 2012 Not the way to do that, you need the middletpa of both symbols and then the midpoint between those two points. Quote Link to comment Share on other sites More sharing options...
FHannes Posted January 19, 2012 Share Posted January 19, 2012 Nah man keep MiddleTPA at least it is useful Dont throw out good script code bro please. or could you pass it on to me so I can use it personally or add it in an include myself. MiddleTPA is an alias for TPAMiddle, you should know by now I don't remove functionality. Only the alias is being removed as I announced moths ago. That's why it's in here: http://wiki.scar-divi.com/index.php?title=Category:Deprecated_Functions Quote Link to comment Share on other sites More sharing options...
shadowrecon Posted January 19, 2012 Share Posted January 19, 2012 (edited) Well, TPAMiddle won't return the middlepoint, if yo have more points to the left of the middle for example, the coordinate returned by the function would be more to the left. To achieve what you want you should use [wiki=TPABounds]TPABounds[/wiki] to get the boundaries of the area that contain the colors, basically the rectangle that surrounds them. Then use that TBox to calculate the middle point it should be something like: Point.X := Box.X1 + (Box.X2 - Box.X1 + 1) div 2; Point.Y := Box.Y1 + (Box.Y2 - Box.Y1 + 1) div 2; how would i go about throwing out numbers that were to high or to low from the box so it would stay in a general area? (if it was to pick up like one pixel like from a random place but the majority of the points were within the same x and y general area) Edit: I went searching around and found the function TPAFilterBoxes(); whish will take car of my problem =) Edited January 19, 2012 by shadowrecon Quote Link to comment Share on other sites More sharing options...
Wanted Posted January 19, 2012 Share Posted January 19, 2012 SplitTPA/TPAChain. MiddleTPA averages points so a few oddballs don't make much a difference Quote Link to comment Share on other sites More sharing options...
rsutton Posted January 19, 2012 Author Share Posted January 19, 2012 TPAChain ill have to readup on that oner Quote Link to comment Share on other sites More sharing options...
FHannes Posted January 19, 2012 Share Posted January 19, 2012 TPAChain is an alias that will be removed, use SplitTPA. Quote Link to comment Share on other sites More sharing options...
shadowrecon Posted January 20, 2012 Share Posted January 20, 2012 SplitTPA/TPAChain. MiddleTPA averages points so a few oddballs don't make much a difference Now SplitTPA just cuts the TPA in half and takes the middle? and yeah, but u know if you dont account for them oddballs make murphys law has a greater chance of happening =) Quote Link to comment Share on other sites More sharing options...