Results 1 to 6 of 6

Thread: Finding 2+ colors near by each other

  1. #1
    Join Date
    Dec 2013
    Posts
    95
    Mentioned
    2 Post(s)
    Quoted
    37 Post(s)

    Default Finding 2+ colors near by each other

    Looking over the TPA related functions in the docs, I don't see an immediate way to do this directly. However, it does seem like a lot of the existing library functions cover most of this. What is the cleanest/best way to find an object in the main screen consisting of 2+ colors which must be near by each other, reusing as much existing library code as possible? (Note: DTMs don't seem to work well here because the object is basically a random mass of these colors intermingled.) Thanks in advance!

  2. #2
    Join Date
    Jul 2013
    Location
    An horse
    Posts
    300
    Mentioned
    9 Post(s)
    Quoted
    120 Post(s)

    Default

    Quote Originally Posted by vwxz View Post
    Looking over the TPA related functions in the docs, I don't see an immediate way to do this directly. However, it does seem like a lot of the existing library functions cover most of this. What is the cleanest/best way to find an object in the main screen consisting of 2+ colors which must be near by each other, reusing as much existing library code as possible? (Note: DTMs don't seem to work well here because the object is basically a random mass of these colors intermingled.) Thanks in advance!
    Could this be what you are looking for? Looks quite similar to what you are talking about.

  3. #3
    Join Date
    Dec 2013
    Posts
    95
    Mentioned
    2 Post(s)
    Quoted
    37 Post(s)

    Default

    Sorry, I may have been to abstract/generic in my earlier post. The specific things I'm trying to find are Runespan nodes, which at a rough approximation are blobs of 2+ colors together.

    Quote Originally Posted by Foundry View Post
    Could this be what you are looking for? Looks quite similar to what you are talking about.
    That looks very promising. Not too sure at the moment, though.

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

    Default

    I wrote this up. It works but the pros might have a better way.

    This finds two colors, and puts each into its own TPA. It then splits one of the TPAs into an ATPA (30 by 30 box, you can change) and sorts it from the player. Then it sees if the second TPA is near the midpoint of each TPA in the ATPA (currently within a distance of 5 pixels, you can change). If so, it moves the mouse there and clicks if the overText matches.



    Simba Code:
    function find2Colors: boolean;
    var
      x, y, x1, y1, i: integer;

      TPA1, TPA2: TPointArray;
      ATPA: T2DPointArray;

    begin
      if not isLoggedIn then
        exit;

      findColorsSpiralTolerance(x, y, TPA1, 424876, mainScreen.getBounds(), 6, colorSetting(2, 0.16, 0.93));
      findColorsSpiralTolerance(x1, y1, TPA2, 79474, mainScreen.getBounds(), 3, colorSetting(2, 0.31, 0.58));

      if (Length(TPA1) < 1) then
        exit;

      ATPA := TPA1.toATPA(30, 30);
      ATPA.sortFromMidPoint(mainscreen.playerPoint);

      for i := 0 to high(ATPA) do
      begin
        if TPA2.isPointNear(middleTPA(ATPA[i]), 5) then
        begin
          mouse(middleTPA(ATPA[i]), MOUSE_MOVE);
          if isMouseOverText(['Attack', 'ttack'], 500) then
          begin
            fastClick(MOUSE_LEFT);
            exit(true);
          end;
        end;
      end;
    end;

  5. #5
    Join Date
    Dec 2013
    Posts
    95
    Mentioned
    2 Post(s)
    Quoted
    37 Post(s)

    Default

    Awesome. Thank you both! Think I have a variation that works for what I'm doing now.

  6. #6
    Join Date
    Oct 2013
    Location
    East Coast USA
    Posts
    770
    Mentioned
    61 Post(s)
    Quoted
    364 Post(s)

    Default

    I posted some code that has this functionality too.

    The function TObjFind._doFilterInclusiveExact is the one that performs multiple color comparison.

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
  •