Results 1 to 3 of 3

Thread: Finding an Array of colors within set coordinates

  1. #1
    Join Date
    Dec 2006
    Location
    Canada, BC
    Posts
    728
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default Finding an Array of colors within set coordinates

    Ok, i wanna make a TPA to atack monks. Atm the mouse keeps mouseing over things that arnt monks, so i would like to make the script only move the mouse over to a position if both the head color, the light brown and the dark brown of the robes colors are found within a 10x10 pixle box. i understand how to use arrays and stuff but how would i make it find a position, then draw a box around it and check to see if the other two colors required are also in that box? and maby if not found then increase the size of the box to 20x20 pixles just for a failsafe?

    i made a little picture to describe what i need
    Lance. Da. Pants.

  2. #2
    Join Date
    Jun 2006
    Posts
    1,492
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    I used this kind of stuff

    SCAR Code:
    if FindColor(x,y,Mainscreen coordinates) then
    begin
        if FindColor(x1,y1, x-10, y-10, x+10, y+10) then
        ...
    end;

    Basically, if you find this color, then look for another color in the vicinity of that color.

  3. #3
    Join Date
    Oct 2007
    Location
    Denmark
    Posts
    409
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    I don't know if this works. It's late and I don't have time to test but it should give you an idea of what to do
    SCAR Code:
    function FindMonk(var T: TPoint): Boolean;
    var
      Head, LB, DB, i, H: Integer;
      x, y: Integer;
      TPA: array of TPoint;
      ATPA: T2DPointArray;
    begin
      Head := 7642573;
      LB := 4284787;
      DB := 2639703;
     
      FindColorsSpiralTolerance(MSCX, MSCY, TPA, Head, MSX1, MSY1, MSX2, MSY2, 10);
      ATPA := TPAtoATPA(TPA, 20);
      H := High(ATPA);
      for i := 0 to H do
      begin
        T := MiddleTPA(ATPA[i]);
        if FindColorTolerance(x, y, LB, T.x - 10, T.y - 10, T.x + 10, T.x + 10, 10) and
           FindColorTolerance(x, y, DB, T.x - 10, T.y - 10, T.x + 10, T.x + 10, 10) then
        begin
          MMouse(T.x, T.y, 5, 5);
          Wait(50 + Random(50));
          if IsUpText('onk') then
          begin
            Result := True;
            Exit;
          end;
        end;
      end;
      Result := False
    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
  •