Results 1 to 10 of 10

Thread: Click specific area of TPA?

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

    Default Click specific area of TPA?

    Hey I was going through my old script and updating all my procedures to work with SRL6. So I have everything else working fine, but I'm stuck on this one line of one of my procedures.

    So the problem at hand is the balance beam TPA needs to have a specific part clicked on. In-game it has 3 segments. The one closest to the player is clickable, the one in the middle isn't, and the one furthest away is "out of reach". So my original solution was to take my ATPA[0] since my ATPA was sorted by size, use the Bounds of the top left corner(X1,Y1) and add 25 to X1 and 2 to Y1 to create a MouseBox that would click on only that portion.

    Here's a picture of how it used to work...


    The line of code to generate what I wanted(outdated)...
    Simba Code:
    Mousebox(GetTPABounds(BalanceATPA[0]).X1, GetTPABounds(BalanceATPA[0]).Y1, GetTPABounds(BalanceATPA[0]).X1 + 25, GetTPABounds(BalanceATPA[0]).Y2 + 2, 2);

    And an example of the procedure as I have it updated without that line since I don't know what to do.
    Simba Code:
    procedure colorCheck3;
    var
      x,y:Integer;
      BalanceTPA:TPointArray;
      BalanceATPA:T2DPointArray;
    begin
      if findColorsSpiralTolerance(x, y, BalanceTPA, 4809844, mainScreen.getBounds(), 5, colorSetting(2, 0.1, 0.2)) then
        begin
          BalanceATPA := BalanceTPA.toATPA(30, 30);
          BalanceATPA.sortBySize(true);
          smartImage.debugTPA(BalanceTPA, true);
          smartImage.debugATPA(BalanceATPA);
          //mouseBox(GetTPABounds(BalanceATPA[0]).X1, GetTPABounds(BalanceATPA[0]).Y1, GetTPABounds(BalanceATPA[0]).X1 + 25, GetTPABounds(BalanceATPA[0]).Y2 + 2, 2);
          wait(150 + random(25));
          if isMouseOverText(['alanc']) then
            begin
              wait(150 + random(50));
              fastClick(MOUSE_LEFT);
              writeLn('Found Balance!');
              smartImage.clear;
              wait(150 + random(50));
              minimap.setAngle(MM_DIRECTION_EAST);
              Wait(2700 + random(100));
            end;
        end;
    end;

    Lost as to what to do for this, any help is welcome.

    *Edit*
    Just to further explain. I have ATPA[0] as shown in white in the picture. I want to get the coordinates(used to be X1,Y1) of the top left of the bounds, and create a tbox with those coordinates as X1,Y1,X1+25,Y1+2, and then click within that tbox(which is the purple clickable area).

  2. #2
    Join Date
    Jul 2006
    Posts
    80
    Mentioned
    1 Post(s)
    Quoted
    27 Post(s)

    Default

    http://villavu.com/forum/showthread.php?t=107716

    Thread might help (The mayor specifically)

  3. #3
    Join Date
    Mar 2013
    Location
    Shaolin
    Posts
    863
    Mentioned
    24 Post(s)
    Quoted
    519 Post(s)

    Default

    I'm pretty sure that the search option of findcolorstolerance has a thing... sec while I look
    Simba Code:
    (mainscreen.playerpoint.x - 100, mainscreen.playerpoint.x + 100), mainscreen.playerpoint.y)
    Something like that.
    You have permission to steal anything I've ever made...

  4. #4
    Join Date
    Aug 2007
    Location
    Colorado
    Posts
    7,421
    Mentioned
    268 Post(s)
    Quoted
    1442 Post(s)

    Default

    Instead of sorting by size why not sort by distance from your player? I don't know specifically how it's done in SRL-6 but Simba has the "SortATPAFromMidPoint" procedure, just plug in your player's X/Y coordinate and your ATPA[0] will be the closest to your player.

    By the way that image is very low quality, I can't really see anything clearly. It looks like you took a screenshot from a low quality video. Could you post an actual screenshot instead with the same debugging?

    Current projects:
    [ AeroGuardians (GotR minigame), Motherlode Miner, Blast furnace ]

    "I won't fall in your gravity. Open your eyes,
    you're the Earth and I'm the sky..."


  5. #5
    Join Date
    Mar 2013
    Location
    Freedomville.
    Posts
    155
    Mentioned
    2 Post(s)
    Quoted
    107 Post(s)

    Default

    Just define the edited box you want as a TBox, and use the new syntax.

    e.g.
    Simba Code:
    Box1 := GetTPABounds(BalanceATPA[0]);
    Box2 := [Box1.x1, Box1.y1, Box1.x1 + 25, Box1.y2 +2];
    MouseBox(Box2, MOUSE_MOVE, MOUSE_HUMAN);

    For the MouseBox bit you wanted updated.

  6. #6
    Join Date
    Dec 2011
    Location
    Hyrule
    Posts
    8,662
    Mentioned
    179 Post(s)
    Quoted
    1870 Post(s)

    Default

    Quote Originally Posted by sdf View Post
    Just define the edited box you want as a TBox, and use the new syntax.

    e.g.
    Simba Code:
    Box1 := GetTPABounds(BalanceATPA[0]);
    Box2 := [Box1.x1, Box1.y1, Box1.x1 + 25, Box1.y2 +2];
    MouseBox(Box2, MOUSE_MOVE, MOUSE_HUMAN);

    For the MouseBox bit you wanted updated.
    Just edit box1

    Box1.edit := [0,0,25,2]

  7. #7
    Join Date
    Feb 2006
    Location
    Helsinki, Finland
    Posts
    1,395
    Mentioned
    30 Post(s)
    Quoted
    107 Post(s)

    Default

    Quote Originally Posted by Brotein View Post
    ...
    Simba Code:
    Mousebox(GetTPABounds(BalanceATPA[0]).X1, GetTPABounds(BalanceATPA[0]).Y1, GetTPABounds(BalanceATPA[0]).X1 + 25, GetTPABounds(BalanceATPA[0]).Y2 + 2, 2);
    Going slightly offtopic here, but just to point out, you should store the BalanceATPA bounds to TBox variable instead - with single GetTPABounds! Running through the GetTPABounds function 4 times (in this case) is just unneccessary and simply waste of time. :\

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

    Default

    Quote Originally Posted by Ashaman88 View Post
    Just edit box1

    Box1.edit := [0,0,25,2]
    That was almost too easy Thanks!

  9. #9
    Join Date
    Jun 2007
    Location
    The land of the long white cloud.
    Posts
    3,702
    Mentioned
    261 Post(s)
    Quoted
    2006 Post(s)

    Default

    Like Flight said, the easiest way would be to sort if from the player point, then you are always going to click on the closest part of the plank. You just need to make sure you split the TPA into the correct size. I'm not sure if a width of 30 is too big or not? Then just mouse the middle of ATPA[0].

    E:

    Last edited by The Mayor; 01-26-2014 at 05:25 AM.

  10. #10
    Join Date
    Mar 2013
    Location
    Freedomville.
    Posts
    155
    Mentioned
    2 Post(s)
    Quoted
    107 Post(s)

    Default

    Quote Originally Posted by Ashaman88 View Post
    Just edit box1

    Box1.edit := [0,0,25,2]
    Not quite, I did originally type that - but if you look at his code it's creating a box using one of the top left coordinates (X1, Y1, X1 + x, Y2 + x) and not (X1, Y1, X2, Y2). Hence why I made a new box, and didn't just edit.

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
  •