Jump to content
rsutton

TPA Middle

Recommended Posts

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.

Link to comment
Share on other sites

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;

Link to comment
Share on other sites

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 by rsutton
Link to comment
Share on other sites

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

Link to comment
Share on other sites

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 by shadowrecon
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...