Results 1 to 4 of 4

Thread: Click only within the bound of a TPA?

  1. #1
    Join Date
    Jan 2012
    Location
    Long Island, NY
    Posts
    413
    Mentioned
    5 Post(s)
    Quoted
    95 Post(s)

    Default Click only within the bound of a TPA?

    I'm not sure how to do this. I would like to click on a specific area of an object, like in this picture.


    I can't split the TPA because the object color is not all that unique and is already separated from it's surroundings(not nearly as clean as the picture ) Changing the split size will not guarantee the object's clickable area is in a TPA of it's own.

    So let's say I create a TPoint called P and give it, which will return me 10,50.
    Simba Code:
    p := middleTPA(ObATPA[i]);

    Right now I edit the point with a static offset, but sometimes the colors change throwing off the y coordinate making it not hover where I want it to.

    How can I grab the Y position of the top border of the TPA. So in the picture I want to grab the Y coordinate of the highest border, in this case it would be 0. This way I can edit my point's Y value to always click say 10 points below that point no matter what. This way I will only move the mouse onto the clickable area.

  2. #2
    Join Date
    Sep 2010
    Posts
    5,762
    Mentioned
    136 Post(s)
    Quoted
    2739 Post(s)

    Default

    Y Position of top border:

    Simba Code:
    function getY(tpa:TPointArray):integer;
    var
      b:Tbox;
    begin
      b := getTpaBounds(tpa);
      result := b.y1;
    end;

    This function will click within a certain point inside the TPA:

    Simba Code:
    procedure clickPointInsideTPA(tpa:TPointArray;pnt:TPoint);
    var
      b:Tbox;
    begin
      b := getTpaBounds(tpa);
      mouse(b.x1 + pnt.x, b.y1 + pnt.y, 0, 0, mouse_left);
    end;

    So if you wanted to click the top left of the TPA you would do:

    Simba Code:
    clickPointInsideTPA(tpa, Point(0, 0));

    Or 10 points below the top Y

    Simba Code:
    clickPointInsideTPA(tpa, Point(0, 10));

  3. #3
    Join Date
    Dec 2011
    Location
    Toronto, Ontario
    Posts
    6,424
    Mentioned
    84 Post(s)
    Quoted
    863 Post(s)

    Default

    Alternatively, you can use MouseBox();
    MouseBox will click at a random point in the box provided. So you'd do something like

    Simba Code:
    MouseBox(getTPABounds(TPA).x1, getTPABounds(TPA).y1, getTPABounds(TPA).x2, getTPABounds(TPA).y2, mouse_Left);
    Clean it up of course, don't leave it like that.
    Last edited by Sin; 06-29-2014 at 06:02 PM.

  4. #4
    Join Date
    Jan 2012
    Location
    Long Island, NY
    Posts
    413
    Mentioned
    5 Post(s)
    Quoted
    95 Post(s)

    Default

    Quote Originally Posted by Robert View Post
    Y Position of top border:

    Simba Code:
    function getY(tpa:TPointArray):integer;
    var
      b:Tbox;
    begin
      b := getTpaBounds(tpa);
      result := b.y1;
    end;

    This function will click within a certain point inside the TPA:

    Simba Code:
    procedure clickPointInsideTPA(tpa:TPointArray;pnt:TPoint);
    var
      b:Tbox;
    begin
      b := getTpaBounds(tpa);
      mouse(b.x1 + pnt.x, b.y1 + pnt.y, 0, 0, mouse_left);
    end;

    So if you wanted to click the top left of the TPA you would do:

    Simba Code:
    clickPointInsideTPA(tpa, Point(0, 0));

    Or 10 points below the top Y

    Simba Code:
    clickPointInsideTPA(tpa, Point(0, 10));
    This does the trick, thanks!

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •