Results 1 to 6 of 6

Thread: FindColorSpiralTolerance - Carry on searching!

  1. #1
    Join Date
    Apr 2007
    Location
    Rimmington
    Posts
    168
    Mentioned
    0 Post(s)
    Quoted
    1 Post(s)

    Question FindColorSpiralTolerance - Carry on searching!

    Hey all

    im using FindColorSpiralTolerance to find the color of objects and am getting some negative matches [some very similar colors about] how would i make it carry on if the uptext is not one off the objects im searching for?

    i know i could use a TPA but i just cant get them to do there stuff for me =[
    Learning To Code - So Excuse the n00b questions!

  2. #2
    Join Date
    Jan 2012
    Location
    Calgary, AB, Canada
    Posts
    1,819
    Mentioned
    5 Post(s)
    Quoted
    120 Post(s)

    Default

    You could use DTM's as in the case you're describing it seems like a DTM would be more accurate.

    Or

    Simba Code:
    procedure Find;
    begin
      repeat
        FindColorsSpiralTolerance(stuff here);
      until(IsUpText('text'))
    end;

    I'm sure that'll work
    Current Project: Retired

  3. #3
    Join Date
    Oct 2011
    Location
    UK
    Posts
    1,322
    Mentioned
    2 Post(s)
    Quoted
    1 Post(s)

    Default

    Use FindColorsSpiralTolerance, which gives you an array of points, you can then search through, once you get good with arrays look into ATPAs which will make your object finding much more accurate / quicker, this is how you would use FindColorsSpiralTolerance

    Simba Code:
    Function FindMyObject : Boolean;
    Var
      Points : array of TPoint;
      i, H : integer;
    begin

      FindColorsSpiralTolerance(MSCX, MSCY, Points, 28492, MSX1, MSY1, MSX2, MSY2, 8);//Set the colour and tolerance here
      //That searches for your colour, and stores all the instances of it in "Points"

      H := high(Points);
      for i := 0 to H do  //This goes through all of the points stored
        begin    
          MouseBox(Points[i].x - 5, Points[i].y - 5, Points[i].x + 5, Points[i].y + 5, mouse_Move);  //It moves your mouse to each one
          if(WaitUpTextMulti(['Uptext goes here'], 200+Random(500)))then  //And checks the uptext
            begin
              Result := True;
              ClickMouse2(mouse_Left);
              exit;
            end;
        end;

    end;

  4. #4
    Join Date
    Apr 2007
    Location
    Rimmington
    Posts
    168
    Mentioned
    0 Post(s)
    Quoted
    1 Post(s)

    Default

    Quote Originally Posted by putonajonny View Post
    Use FindColorsSpiralTolerance, which gives you an array of points, you can then search through, once you get good with arrays look into ATPAs which will make your object finding much more accurate / quicker, this is how you would use FindColorsSpiralTolerance

    Simba Code:
    Function FindMyObject : Boolean;
    Var
      Points : array of TPoint;
      i, H : integer;
    begin

      FindColorsSpiralTolerance(MSCX, MSCY, Points, 28492, MSX1, MSY1, MSX2, MSY2, 8);//Set the colour and tolerance here
      //That searches for your colour, and stores all the instances of it in "Points"

      H := high(Points);
      for i := 0 to H do  //This goes through all of the points stored
        begin    
          MouseBox(Points[i].x - 5, Points[i].y - 5, Points[i].x + 5, Points[i].y + 5, mouse_Move);  //It moves your mouse to each one
          if(WaitUpTextMulti(['Uptext goes here'], 200+Random(500)))then  //And checks the uptext
            begin
              Result := True;
              ClickMouse2(mouse_Left);
              exit;
            end;
        end;

    end;

    think i will go with something like this i just cant grasp TPA's yet stupid things any ideas on how i would make it not bother looking unless there was 10 pixels off color there?
    Learning To Code - So Excuse the n00b questions!

  5. #5
    Join Date
    Dec 2006
    Location
    UK!!
    Posts
    910
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by NoUserName View Post
    think i will go with something like this i just cant grasp TPA's yet stupid things any ideas on how i would make it not bother looking unless there was 10 pixels off color there?
    DO you mean 10Px as an area or a tol of 10Px?
    Simba Code:
    FindColorsSpiralTolerance(MSCX, MSCY, Points, 28492, MSX1, MSY1, MSX2, MSY2, 8); //The 8 is the tol for the color 28492

  6. #6
    Join Date
    Oct 2011
    Location
    UK
    Posts
    1,322
    Mentioned
    2 Post(s)
    Quoted
    1 Post(s)

    Default

    Quote Originally Posted by NoUserName View Post
    think i will go with something like this i just cant grasp TPA's yet stupid things any ideas on how i would make it not bother looking unless there was 10 pixels off color there?
    You would do this with ATPAs:

    Simba Code:
    Function FindMyObject : Boolean;
    Var
      Points : array of TPoint;
      ATPA : array of array of TPoint;
      i, H : integer;
    begin

      FindColorsSpiralTolerance(MSCX, MSCY, Points, 28492, MSX1, MSY1, MSX2, MSY2, 8);//Set the colour and tolerance here
      //That searches for your colour, and stores all the instances of it in "Points"

      TPAToATPAWrap(Points, 40, ATPA);

      SetArrayLength(Points, GetArrayLength(ATPA));

      H := high(ATPA);
      for i := 0 to H do  //This goes through all of the points stored
        begin    
          if(GetArrayLength(ATPA[i]) < 10)then
            Continue;
          Points[i] := MiddleTPA(TPA[i]);
          MouseBox(Points[i].x - 5, Points[i].y - 5, Points[i].x + 5, Points[i].y + 5, mouse_Move);  //It moves your mouse to each one
          if(WaitUpTextMulti(['Uptext goes here'], 200+Random(500)))then  //And checks the uptext
            begin
              Result := True;
              ClickMouse2(mouse_Left);
              exit;
            end;
        end;

    end;

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
  •