Results 1 to 6 of 6

Thread: Checking an area

  1. #1
    Join Date
    Jun 2009
    Posts
    23
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default Checking an area

    Is there a way to do something similar to:

    Code:
    colorvar := GetColor(671, 462);
    if (SimilarColors(colorvar, 16750060, 40)) then
    But instead of an exact point, checking an area? Say a square?

  2. #2
    Join Date
    Jan 2008
    Location
    NC, USA.
    Posts
    4,429
    Mentioned
    0 Post(s)
    Quoted
    4 Post(s)

    Default

    FindColor(x, y, col, x1, y1, x2, y2);
    Quote Originally Posted by irc
    [00:55:29] < Guest3097> I lol at how BenLand100 has become noidea
    [01:07:40] <@BenLand100> i'm not noidea i'm
    [01:07:44] -!- BenLand100 is now known as BenLand42-
    [01:07:46] <@BenLand42-> shit
    [01:07:49] -!- BenLand42- is now known as BenLand420
    [01:07:50] <@BenLand420> YEA

  3. #3
    Join Date
    Jun 2009
    Posts
    23
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Could I use SimilarColors(colorvar, 16750060, 40) as the color parameter in FindColor? Also I'm a big confused.. I looked up this function in the guide, and I don't understand why is there an extra x,y? at the front? There's 2 sets of coords for the 2 points to make the box, but what are the first two for?..

  4. #4
    Join Date
    Jul 2008
    Location
    England
    Posts
    763
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Use FindColorTolerance to search for a colour with a tolerance.
    lol

  5. #5
    Join Date
    Jun 2009
    Posts
    23
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by Quickmarch View Post
    Use FindColorTolerance to search for a colour with a tolerance.
    Still doesn't explain what the first 2 x and y in the function are.. (It's also in this function) And the 'guide' doesn't help.

  6. #6
    Join Date
    Feb 2007
    Location
    Access Violation at 0x00000000
    Posts
    2,865
    Mentioned
    3 Post(s)
    Quoted
    18 Post(s)

    Default

    The first x and y are the coordinates your colour is found finally.
    SCAR Code:
    Program New;

    Var
      x, y : Integer;
      t : TBox;
      p : TPoint;

    Function BoxAround(Point : TPoint; w, h : Integer): TBox;
    Begin
      Result.x1 := (Point.x - w);
      Result.y1 := (Point.y - h);
      Result.x2 := (Point.x + w);
      Result.y2 := (Point.y + h);
    End;

    Begin
      p := Point(671, 472);
      t := BoxAround(p, 20, 20); //A square 20x20
      If FindColorTolerance(x, y, 16750060, t.x1, t.y1, t.x2, t.y2, 40) Then //Find the color inside the box, 40 tolerance. x and y are the coords it FINDS the color
        WriteLn('Found colour at '+ IntToStr(x) +', '+ IntToStr(y) +'.')
      Else
        WriteLn('Failed to find colour.');
    End.
    Ce ne sont que des gueux


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
  •