Results 1 to 4 of 4

Thread: FindColorSkipCoords

  1. #1
    Join Date
    Feb 2006
    Location
    Belgium
    Posts
    3,137
    Mentioned
    3 Post(s)
    Quoted
    5 Post(s)

    Default FindColorSkipCoords

    Well, I made them first colorfinding functions cuz i was bored, so I started thinking and came up with this, this will find a color, ignoring all coordinates in the specified TPointArray.

    Code:
    function FindColorSkipCoords(var x, y: Integer; color, x1, y1, x2, y2: Integer; skipcoords: TPointArray): Boolean;
    var
      p1, p2: TPoint;
      tmpColor, a: integer;
      skipB: Boolean;
    begin
      if(x1 < x2)then begin p1.x := x1; p2.x := x2; end else begin p1.x := x2; p2.x := x1; end;
      if(y1 < y2)then begin p1.y := y1; p2.y := y2; end else begin p1.y := y2; p2.y := y1; end;
      Result := False;
      for x := p1.x to p2.x do
      begin
        for y := p1.y to p2.y do
        begin
          skipB := False;
          tmpColor := GetColor(x, y);
          for a := 0 to GetArrayLength(skipcoords) - 1 do
          begin
            if(skipcoords[a].x = x)and(skipcoords[a].y = y)then skipB := True;
          end;
          if(GetColor(x, y) = color)and(skipB = False)then
          begin
            Result := True;
            Exit;
          end;
        end;
      end;
    end;
    (BTW: It's tested if anyone would doubt it works.)

  2. #2
    Join Date
    Feb 2006
    Location
    Myrtle Beach, SC USA!
    Posts
    841
    Mentioned
    2 Post(s)
    Quoted
    1 Post(s)

    Default

    that looks pretty useful actually.
    Retired SRL Leader - Web Developer by Trade, Free Lancer

    http://s-vizion.com
    http://blog.s-vizion.com

  3. #3
    Join Date
    Feb 2006
    Location
    Under a rock.
    Posts
    1,351
    Mentioned
    0 Post(s)
    Quoted
    2 Post(s)

    Default

    Quote Originally Posted by Dankness
    that looks pretty useful actually.
    It looks very useful, good job Freddy! Are you getting back into SCAR scripting again?
    SRL Developer
    ◘◘◘◘◘◘◘◘◘◘◘◘◘◘◘◘◘◘◘◘

  4. #4
    Join Date
    Feb 2006
    Location
    Belgium
    Posts
    3,137
    Mentioned
    3 Post(s)
    Quoted
    5 Post(s)

    Default

    Yeah, prolly, since clients are currently pretty dead I currently have no use of expanding my java skills anymore

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
  •