Results 1 to 8 of 8

Thread: findColorTolerance, backwards.

  1. #1
    Join Date
    Feb 2012
    Posts
    170
    Mentioned
    0 Post(s)
    Quoted
    6 Post(s)

    Default findColorTolerance, backwards.

    I'm trying to search a box from the bottom to the top, how do I reverse findColorTolerance? I know there is the spiral function, but I need to go from bottom to top. Thanks.
    Code:
    handColor:= GetColor(320,580);
       findColorTolerance(clickX, clickY, handColor,99,69,356,542, 10);
       mouse(clickX, clickY, 3, 4, true);

  2. #2
    Join Date
    Jun 2008
    Location
    United States
    Posts
    818
    Mentioned
    60 Post(s)
    Quoted
    90 Post(s)

    Default

    You could use 'FindColorsTolerance' and sort the resulting TPA from the bottom-right corner of the screen.
    [10/14/13:19:03] <BenLand100> this is special relatively, just cleverly disguised with yachts

  3. #3
    Join Date
    Dec 2006
    Location
    Sydney, New South Wales, Australia
    Posts
    4,603
    Mentioned
    15 Post(s)
    Quoted
    42 Post(s)

    Default

    Since euphemism refuses to go into further detail and provide an example, here is one:
    Simba Code:
    const
      Colour = 0;
      Tol = 16;

    var
      TPA: TPointArray;

    begin
      if(FindColorsTolerance(TPA, Colour, MSX1, MSY1, MSX2, MSY2, Tol)) then
        InvertTPA(TPA);
    end.
    You may contact me with any concerns you have.
    Are you a victim of harassment? Please notify me or any other staff member.

    | SRL Community Rules | SRL Live Help & Chat | Setting up Simba | F.A.Q's |

  4. #4
    Join Date
    Feb 2012
    Location
    Somewhere, over the rainbow...
    Posts
    2,272
    Mentioned
    3 Post(s)
    Quoted
    45 Post(s)

    Default

    Quote Originally Posted by Daniel View Post
    Since euphemism refuses to go into further detail and provide an example, here is one:
    Simba Code:
    const
      Colour = 0;
      Tol = 16;

    var
      TPA: TPointArray;

    begin
      if(FindColorsTolerance(TPA, Colour, MSX1, MSY1, MSX2, MSY2, Tol)) then
        InvertTPA(TPA);
    end.
    But haven't you inverted the TPA after already searching for it? Meaning it searched from top to bottom rather than vice versa?

  5. #5
    Join Date
    Feb 2012
    Posts
    170
    Mentioned
    0 Post(s)
    Quoted
    6 Post(s)

    Default

    I don't quite understand, what does TPA do? is it the 'image' that we're scanning? and how will the bot know where to click if I don't get my x and y coords from the found color? or would I need 2 searches?

    Code:
    handColor:= GetColor(320,580);
     if  findColorTolerance(TPA, handColor,99,69,356,542, 10) then
    begin
    InvertTPA(TPA); // idk what to do after here.
    
       mouse(clickX, clickY, 3, 4, true);  
    end.

  6. #6
    Join Date
    Jun 2008
    Location
    United States
    Posts
    818
    Mentioned
    60 Post(s)
    Quoted
    90 Post(s)

    Default

    Quote Originally Posted by abu_jwka View Post
    But haven't you inverted the TPA after already searching for it? Meaning it searched from top to bottom rather than vice versa?
    The non-spiral color finding functions search left-to-right, top-to-bottom. So, after the search is finished, the TPA will contain the points where the color has been found, and it will be ordered left-to-right, top-to-bottom. Using 'InvertTPA' will invert it, meaning the TPA now is ordered right-to-left, bottom-to-top, and the first point in the TPA will be the one xdarkshadowx wants.

    Quote Originally Posted by xdarkshadowx View Post
    I don't quite understand, what does TPA do? is it the 'image' that we're scanning? and how will the bot know where to click if I don't get my x and y coords from the found color? or would I need 2 searches?
    Go to the 'Tutorial Island' section of our forums and look up some tutorials on TPAs, which is an acronym for TPoint Array.

    Edit: Tutorial that contains a good bit of relevant material
    Last edited by euphemism; 04-30-2012 at 05:46 AM.
    [10/14/13:19:03] <BenLand100> this is special relatively, just cleverly disguised with yachts

  7. #7
    Join Date
    Dec 2006
    Location
    Sydney, New South Wales, Australia
    Posts
    4,603
    Mentioned
    15 Post(s)
    Quoted
    42 Post(s)

    Default

    Quote Originally Posted by xdarkshadowx View Post
    I don't quite understand, what does TPA do? is it the 'image' that we're scanning? and how will the bot know where to click if I don't get my x and y coords from the found color? or would I need 2 searches?

    Code:
    handColor:= GetColor(320,580);
     if  findColorTolerance(TPA, handColor,99,69,356,542, 10) then
    begin
    InvertTPA(TPA); // idk what to do after here.
    
       mouse(clickX, clickY, 3, 4, true);  
    end.
    FindColorTolerance searches the screen from the top-left position, and will stop once only one instance of that colour is found - you cannot change this. However, what you CAN do is use FindColorsTolerance to find ALL instances of that colour on the screen. Like FindColorTolerance, it searches from the top-left position. However, we can invert (make it go back to front [i.e. instead of top-left to bottom-right, we can switch it so it goes bottom-right to top-left]) the TPA.

    TPA stands for TPointArray (or array of TPoint). If you were only searching for one colour, you would only need a x and a y variable (which is represents a point on your computer screen). However, since we're looking for the colour in multiple locations, we have to store all of these locations in an array, which means multiple values of the same time (multiple values, i.e. locations, of the same type, i.e. point [or TPoint]).

    So, what you'd need is something like:
    Simba Code:
    const
      Colour = 0;
      Tol = 16;

    var
      TPA: TPointArray;

    begin
      // Search the Runescape main screen for the colour 'Colour'.
      if(FindColorsTolerance(TPA, Colour, MSX1, MSY1, MSX2, MSY2, Tol)) then
      begin
        InvertTPA(TPA);  // Switch the TPA values around.

        Mouse(TPA[0].x, TPA[0].y, 4, 4, mouse_Left);  // Left click on the bottom-right most colour.
      end;
    end.

    If you notice, I use TPA[0].x and TPA[0].y. Initially, without inverting the TPA, this would contain the position of the colour found in the top-left most position. Because it stores it in how it is found. Inverting this TPA will then give us the opposite result
    You may contact me with any concerns you have.
    Are you a victim of harassment? Please notify me or any other staff member.

    | SRL Community Rules | SRL Live Help & Chat | Setting up Simba | F.A.Q's |

  8. #8
    Join Date
    Feb 2012
    Location
    Somewhere, over the rainbow...
    Posts
    2,272
    Mentioned
    3 Post(s)
    Quoted
    45 Post(s)

    Default

    Quote Originally Posted by euphemism View Post
    The non-spiral color finding functions search left-to-right, top-to-bottom. So, after the search is finished, the TPA will contain the points where the color has been found, and it will be ordered left-to-right, top-to-bottom. Using 'InvertTPA' will invert it, meaning the TPA now is ordered right-to-left, bottom-to-top, and the first point in the TPA will be the one xdarkshadowx wants.
    Ah okay, now I understand

    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
  •