Results 1 to 2 of 2

Thread: I need help with finding color thing

  1. #1
    Join Date
    May 2008
    Posts
    210
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default I need help with finding color thing

    this is from ACA2 made by Sumilion and Nielsie95

    SCAR Code:
    program AutoColor;
    {.include SRL\SRL.scar}

    function AutoColor: Integer;
    var
      arP: TPointArray;
      arC: TIntegerArray;
      tmpCTS, i, arL: Integer;
      H, S, L: Extended;
      X, Y, Z: Extended;
    begin
      tmpCTS := GetColorToleranceSpeed;
      ColorToleranceSpeed(1);

      if not (FindColorsTolerance(arP, 1468528, MMX1, MMY1, MMX2, MMY2, 0)) then
      begin
        Writeln('Failed to find the color, no result.');
        ColorToleranceSpeed(tmpCTS);
        Exit;
      end;

      arC := GetColors(arP);
      ClearSameIntegers(arC);
      arL := High(arC);

      for i := 0 to arL do
      begin
        if (rs_OnMinimap(arP[i].x, arP[i].y)) then
        begin
          ColorToHSL(arC[i], H, S, L);

          if (H >= 15.17) and (H <= 15.21) and (S >= 67.14) and (S <= 67.18) and (L >= 26.25) and (L <= 26.29) then
          begin
            ColorToXYZ(arC[i], X, Y, Z);

            if (X >= 11.76) and (X <= 11.80) and (Y >= 13.38) and (Y <= 13.42) and (Z >= 2.71) and (Z <= 2.75) then
            begin
              Result := arC[i];
              Writeln('AutoColor = ' + IntToStr(arC[i]));
              Break;
            end;
          end;
        end;
      end;

      ColorToleranceSpeed(tmpCTS);

      if (i = arL + 1) then
        Writeln('AutoColor failed in finding the color.');
    end;

    begin
      SetupSRL;
      AutoColor;
    end.

    it works so congratz Sum and Nielsie but I want it to click at the color when it has found it, how to? please dont tell me to do it myself, Ive tried for a few hours and I would appreciate if someone could just edit it in for me

  2. #2
    Join Date
    Mar 2007
    Posts
    3,042
    Mentioned
    1 Post(s)
    Quoted
    14 Post(s)

    Default

    SCAR Code:
    program AutoColor;
    {.include SRL\SRL.scar}
     
    function AutoColor: Integer;
    var
      arP: TPointArray;
      arC: TIntegerArray;
      tmpCTS, i, arL: Integer;
      H, S, L: Extended;
      X, Y, Z: Extended;
    begin
      tmpCTS := GetColorToleranceSpeed;
      ColorToleranceSpeed(1);
     
      if not (FindColorsTolerance(arP, 1468528, MMX1, MMY1, MMX2, MMY2, 0)) then
      begin
        Writeln('Failed to find the color, no result.');
        ColorToleranceSpeed(tmpCTS);
        Exit;
      end;
     
      arC := GetColors(arP);
      ClearSameIntegers(arC);
      arL := High(arC);
     
      for i := 0 to arL do
      begin
        if (rs_OnMinimap(arP[i].x, arP[i].y)) then
        begin
          ColorToHSL(arC[i], H, S, L);
     
          if (H >= 15.17) and (H <= 15.21) and (S >= 67.14) and (S <= 67.18) and (L >= 26.25) and (L <= 26.29) then
          begin
            ColorToXYZ(arC[i], X, Y, Z);
     
            if (X >= 11.76) and (X <= 11.80) and (Y >= 13.38) and (Y <= 13.42) and (Z >= 2.71) and (Z <= 2.75) then
            begin
              Result := arC[i];
              Mouse(arP[i].x, arP[i].y, 2, 2, True);
              Writeln('AutoColor = ' + IntToStr(arC[i]));
              Break;
            end;
          end;
        end;
      end;
     
      ColorToleranceSpeed(tmpCTS);
     
      if (i = arL + 1) then
        Writeln('AutoColor failed in finding the color.');
    end;
     
    begin
      SetupSRL;
      AutoColor;
    end.

    There you go.
    :-)

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. color finding
    By elobire in forum OSR Help
    Replies: 7
    Last Post: 12-15-2008, 09:03 PM
  2. Finding a color in the inv.
    By yanix in forum OSR Help
    Replies: 1
    Last Post: 01-30-2008, 09:51 PM
  3. color finding help
    By fORCE_wORKS in forum OSR Help
    Replies: 1
    Last Post: 11-09-2007, 11:18 AM
  4. Need Finding A Color Help >.<
    By pkzzz in forum OSR Help
    Replies: 5
    Last Post: 10-11-2007, 09:32 PM
  5. Finding color in a box on MM?
    By hlstriker in forum OSR Help
    Replies: 7
    Last Post: 12-20-2006, 05:04 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •