Page 1 of 6 123 ... LastLast
Results 1 to 25 of 129

Thread: ACA[AutocolorAid] remake

  1. #1
    Join Date
    May 2012
    Location
    Moscow, Russia
    Posts
    661
    Mentioned
    35 Post(s)
    Quoted
    102 Post(s)

    Default ACA[AutocolorAid] remake

    Hey all. I am sure many of you liked ACA v 2 by Nielsie95 and Sumilion. I'm from it was delighted. But unfortunately the program have not been updated and is completely cross-platform. A few days ago I was contacted to Niels and asked source code of this utility. Received a positive response to the request, and after a few days of work, I present to you ACA remake.

    Written in Lazarus + FPC, based on ACA2 and ACA v 3 source code. The program uses search colors algorithms from Simba.
    Last update: 13.10.2014

    Status: Win stable, *nix beta.

    Credits:
    Nielsie95 and Sumilion for ACA2 and wonderful readable code.
    Nielsie95 for ACA v 3 and ACA2 source code.


    Features:
    Tolerance calculator
    Optionable ColorToleranceSpeed
    Client window - a image copied from your screen, allowing you to pick colors from it
    Color Marking
    Custom search area for Marking Colors
    Bitmap saving
    Bitmap loading
    AutoColor function generator
    FindObject function generator
    Multi-colors profiles
    CTS0,1,2,3 supported
    Crossplatform, can be easely integrated to Simba.
    The DX Apps grabbing support.

    Screenshots:

    Windows:



    Linux:




    Generated code:
    Simba Code:
    program AutoColor;
    {$I SRL\SRL.simba}

    function  RedBox : Integer;
    var
      arP: TPointArray;
      arC: TIntegerArray;
      tmpCTS, i, arL: Integer;
      H, S, L: Extended;
      X, Y, Z: Extended;
    begin
      tmpCTS := GetColorToleranceSpeed;
      ColorToleranceSpeed(2);
      SetColorSpeed2Modifiers(0.08, 1.75);

      FindColorsSpiralTolerance(640, 512, arP, 16043446, 0, 0, 1280, 1024, 8);
      if (Length(arP) = 0) then
      begin
        Writeln('Failed to find the color, no result.');
        ColorToleranceSpeed(tmpCTS);
        SetColorSpeed2Modifiers(0.2, 0.2);
        Exit;
      end;

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

      for i := 0 to arL do
      begin
        ColorToHSL(arC[i], H, S, L);

        if (H >= 60.28) and (H <= 60.38) and (S >= 68.97) and (S <= 90.26) and (L >= 74.69) and (L <= 91.98) then
        begin
          ColorToXYZ(arC[i], X, Y, Z);

          if (X >= 43.15) and (X <= 74.37) and (Y >= 44.73) and (Y <= 78.30) and (Z >= 84.94) and (Z <= 104.14) then
          begin
            Result := arC[i];
            Writeln('AutoColor = ' + IntToStr(arC[i]));
            Break;
          end;
        end;
      end;

      ColorToleranceSpeed(tmpCTS);
      SetColorSpeed2Modifiers(0.2, 0.2);

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

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

      FindColorsSpiralTolerance(640, 512, arP, 16043446, 0, 0, 1280, 1024, 8);
      if (Length(arP) = 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
        ColorToHSL(arC[i], H, S, L);

        if (H >= 60.28) and (H <= 60.38) and (S >= 68.97) and (S <= 90.26) and (L >= 74.69) and (L <= 91.98) then
        begin
          ColorToXYZ(arC[i], X, Y, Z);

          if (X >= 43.15) and (X <= 74.37) and (Y >= 44.73) and (Y <= 78.30) and (Z >= 84.94) and (Z <= 104.14) then
          begin
            Result := arC[i];
            Writeln('AutoColor = ' + IntToStr(arC[i]));
            Break;
          end;
        end;
      end;

      ColorToleranceSpeed(tmpCTS);

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

    begin
      SetupSRL;
      RedBox;
      LazIcon;
    end.

    Simba Code:
    program FindObjects;
    {$I SRL\SRL.simba}

    var
      x, y: Integer;
    function  RedBox(var x,y: integer) : Integer;
    var
      arP, arAP: TPointArray;
      arC, arUC: TIntegerArray;
      ararP: T2DPointArray;
      tmpCTS, i, j, arL, arL2: Integer;
      P: TPoint;
      H, S, L: Extended;
      X, Y, Z: Extended;
    begin
      tmpCTS := GetColorToleranceSpeed;
      ColorToleranceSpeed(2);
      SetColorSpeed2Modifiers(0.08, 1.75);

      if not(FindColorsTolerance(arP, 16043446, MSX1, MSY1, MSX2, MSY2, 8)) then
      begin
        Writeln('Failed to find the color, no object found.');
        ColorToleranceSpeed(tmpCTS);
        SetColorSpeed2Modifiers(0.2, 0.2);
        Exit;
      end;

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

      for i := 0 to arL do
      begin
        ColorToHSL(arC[i], H, S, L);

        if (H >= 60.28) and (H <= 60.38) and (S >= 68.97) and (S <= 90.26) and (L >= 74.69) and (L <= 91.98) then
        begin
          ColorToXYZ(arC[i], X, Y, Z);

          if (X >= 43.15) and (X <= 74.37) and (Y >= 44.73) and (Y <= 78.30) and (Z >= 84.94) and (Z <= 104.14) then
          begin
            for j := 0 to arL2 do
            begin
              if (arUC[i] = arC[j]) then
              begin
                SetLength(arAP, Length(arAP) + 1);
                arAP[High(arAP)] := arP[j];
              end;
            end;
          end;
        end;
      end;

    function  LazIcon(var x,y: integer) : Integer;
    var
      arP, arAP: TPointArray;
      arC, arUC: TIntegerArray;
      ararP: T2DPointArray;
      tmpCTS, i, j, arL, arL2: Integer;
      P: TPoint;
      H, S, L: Extended;
      X, Y, Z: Extended;
    begin
      tmpCTS := GetColorToleranceSpeed;
      ColorToleranceSpeed(3);
      SetColorSpeed3Modifiers(1,8);

      if not(FindColorsTolerance(arP, 16043446, MSX1, MSY1, MSX2, MSY2, 8)) then
      begin
        Writeln('Failed to find the color, no object found.');
        ColorToleranceSpeed(tmpCTS);
        Exit;
      end;

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

      for i := 0 to arL do
      begin
        ColorToHSL(arC[i], H, S, L);

        if (H >= 60.28) and (H <= 60.38) and (S >= 68.97) and (S <= 90.26) and (L >= 74.69) and (L <= 91.98) then
        begin
          ColorToXYZ(arC[i], X, Y, Z);

          if (X >= 43.15) and (X <= 74.37) and (Y >= 44.73) and (Y <= 78.30) and (Z >= 84.94) and (Z <= 104.14) then
          begin
            for j := 0 to arL2 do
            begin
              if (arUC[i] = arC[j]) then
              begin
                SetLength(arAP, Length(arAP) + 1);
                arAP[High(arAP)] := arP[j];
              end;
            end;
          end;
        end;
      end;

    begin
      SetupSRL;
      LazIcon(x,y);
      LazIcon(x,y);
    end.

    Source code can be found here:
    http://github.com/CynicRus/ACARemake

    Cheers,
    Cynic.
    Attached Files Attached Files
    Last edited by CynicRus; 10-13-2014 at 05:42 AM.
    Per aspera ad Astra!
    ----------------------------------------
    Slow and steady wins the race.

  2. #2
    Join Date
    Sep 2010
    Posts
    5,762
    Mentioned
    136 Post(s)
    Quoted
    2739 Post(s)

    Default

    Nice, is it more accurate?

  3. #3
    Join Date
    May 2012
    Location
    Moscow, Russia
    Posts
    661
    Mentioned
    35 Post(s)
    Quoted
    102 Post(s)

    Default

    Quote Originally Posted by RJJ95 View Post
    Nice, is it more accurate?
    Well, using the same algorithms that Simba and Aca v2\3.
    Per aspera ad Astra!
    ----------------------------------------
    Slow and steady wins the race.

  4. #4
    Join Date
    Oct 2012
    Posts
    758
    Mentioned
    6 Post(s)
    Quoted
    282 Post(s)

    Default

    Great! - I haven't looked at it yet, but good job for doing what you're doing.

  5. #5
    Join Date
    Feb 2013
    Posts
    65
    Mentioned
    0 Post(s)
    Quoted
    25 Post(s)

    Default

    Looks great! Will definitely be useful.

  6. #6
    Join Date
    Mar 2006
    Location
    Belgium
    Posts
    3,564
    Mentioned
    111 Post(s)
    Quoted
    1475 Post(s)

    Default

    Damn Cynicrus, so many good things!!

    Creds to DannyRS for this wonderful sig!

  7. #7
    Join Date
    Dec 2011
    Location
    United States
    Posts
    960
    Mentioned
    21 Post(s)
    Quoted
    504 Post(s)

    Default

    CTS 3! I'm going to give it a try.

    Edit:
    Errors!
    http://i.imgur.com/xENFh9o.png
    Last edited by Wetish; 03-10-2013 at 05:57 PM.

  8. #8
    Join Date
    Jun 2012
    Location
    Howell, Michigan
    Posts
    1,585
    Mentioned
    34 Post(s)
    Quoted
    553 Post(s)

    Default

    Sexy<3

  9. #9
    Join Date
    Jan 2012
    Location
    In A Farm
    Posts
    3,301
    Mentioned
    30 Post(s)
    Quoted
    444 Post(s)

    Default

    Good Work..

  10. #10
    Join Date
    Jul 2011
    Location
    /home/litoris
    Posts
    2,226
    Mentioned
    0 Post(s)
    Quoted
    159 Post(s)

    Default

    Awesome, the most useful tool for a scripter I was getting tired of ACA 3's inaccuacy, I always had to adjust the tolerance myself using smart graphics. +repped!
    Miner & Urn Crafter & 07 Chicken Killer
    SPS BlindWalk Tutorial

    Working on: Nothing

    teacher in every art, brought the fire that hath proved to mortals a means to mighty ends

  11. #11
    Join Date
    May 2012
    Location
    Moscow, Russia
    Posts
    661
    Mentioned
    35 Post(s)
    Quoted
    102 Post(s)

    Default

    Quote Originally Posted by Wetish View Post
    CTS 3! I'm going to give it a try.

    Edit:
    Errors!
    http://i.imgur.com/xENFh9o.png
    Gimme more info!-)
    Per aspera ad Astra!
    ----------------------------------------
    Slow and steady wins the race.

  12. #12
    Join Date
    Dec 2011
    Location
    Hyrule
    Posts
    8,662
    Mentioned
    179 Post(s)
    Quoted
    1870 Post(s)

    Default

    Great job! Will definitely test it out . Any chance of adding a zoom option to help with grabbing colors? (Sorry if there already is one and I missed it)

  13. #13
    Join Date
    May 2012
    Location
    Moscow, Russia
    Posts
    661
    Mentioned
    35 Post(s)
    Quoted
    102 Post(s)

    Default

    Quote Originally Posted by Ashaman88 View Post
    Great job! Will definitely test it out . Any chance of adding a zoom option to help with grabbing colors? (Sorry if there already is one and I missed it)
    I can implement it without any problems. Only is it necessary?
    Per aspera ad Astra!
    ----------------------------------------
    Slow and steady wins the race.

  14. #14
    Join Date
    Dec 2011
    Location
    Hyrule
    Posts
    8,662
    Mentioned
    179 Post(s)
    Quoted
    1870 Post(s)

    Default

    Quote Originally Posted by CynicRus View Post
    I can implement it without any problems. Only is it necessary?
    I often use it with the DTM editor when I want to see the precise breakout of pixels (especially for MM stuff), but it's no biggie

  15. #15
    Join Date
    Mar 2012
    Posts
    690
    Mentioned
    2 Post(s)
    Quoted
    40 Post(s)

    Default

    Might want to upload the pic at another site, clicked the pic and it took me to a site full of hooker ads :/

  16. #16
    Join Date
    May 2007
    Location
    England
    Posts
    4,140
    Mentioned
    11 Post(s)
    Quoted
    266 Post(s)

    Default

    Quote Originally Posted by Sirenia View Post
    Might want to upload the pic at another site, clicked the pic and it took me to a site full of hooker ads :/


    But serious, great job. Very nice contribution which a fair few people will be able to use and abuse.

    Oh, and the pic isn't meant to offend anyone.
    <3

    Quote Originally Posted by Eminem
    I don't care if you're black, white, straight, bisexual, gay, lesbian, short, tall, fat, skinny, rich or poor. If you're nice to me, I'll be nice to you. Simple as that.

  17. #17
    Join Date
    Jun 2012
    Location
    Howell, Michigan
    Posts
    1,585
    Mentioned
    34 Post(s)
    Quoted
    553 Post(s)

    Default

    Colors are much more accurate but simba throws up duplicate identifier errors with the generated function, but thanks!

  18. #18
    Join Date
    Jul 2012
    Posts
    437
    Mentioned
    10 Post(s)
    Quoted
    165 Post(s)

    Default

    delete duplicates doesn't seem to be working for me and i get list out of bounds when i try delete colors manually. Other than that it seems to be working good.

  19. #19
    Join Date
    Sep 2007
    Location
    Australia, NSW
    Posts
    934
    Mentioned
    6 Post(s)
    Quoted
    145 Post(s)

    Default

    Yay, CTS3! And I also second the zoom function It's not 'necessary', but it'd be very useful for precision Good job on this!

    INACTIVE
    How-to: Make S.M.A.R.T. less laggy

    Sell me your Maple Shieldbows (u)! Up to 95gp ea!

    My Scripts:
    Ivy Chopper Ultra [RS3] | Fantastic Fletcher [RS3]
    99 x78 | 99 x10 | 99 x2 | 99 x12


    Use the REPORT tags when posting progress reports to make life easier (:
    [REPORT]Put progress report in here![/REPORT]

    Super Savvy Smither V1.06Cool Classy Cooker V1.02 [EoC]

  20. #20
    Join Date
    Jun 2007
    Location
    The land of the long white cloud.
    Posts
    3,702
    Mentioned
    261 Post(s)
    Quoted
    2006 Post(s)

    Default

    Well done on releasing this! I will give it a go now!

    I like how you can drag the crosshair onto the client, very useful.

    E: It seems to crash after I have picked about 10 colours?
    Last edited by The Mayor; 03-11-2013 at 03:03 AM.

  21. #21
    Join Date
    May 2012
    Location
    Moscow, Russia
    Posts
    661
    Mentioned
    35 Post(s)
    Quoted
    102 Post(s)

    Default

    Quote Originally Posted by The Mayor View Post
    Well done on releasing this! I will give it a go now!

    I like how you can drag the crosshair onto the client, very useful.

    E: It seems to crash after I have picked about 10 colours?
    Weird.
    I will look at that today.
    Per aspera ad Astra!
    ----------------------------------------
    Slow and steady wins the race.

  22. #22
    Join Date
    May 2012
    Location
    Moscow, Russia
    Posts
    661
    Mentioned
    35 Post(s)
    Quoted
    102 Post(s)

    Default

    Quote Originally Posted by Sirenia View Post
    Might want to upload the pic at another site, clicked the pic and it took me to a site full of hooker ads :/
    Done.

    To all: I found OutOfMem bug. I will be fix it today.
    Per aspera ad Astra!
    ----------------------------------------
    Slow and steady wins the race.

  23. #23
    Join Date
    Oct 2012
    Posts
    758
    Mentioned
    6 Post(s)
    Quoted
    282 Post(s)

    Default

    Tried to open image in new tab and I got ->

    403 Forbidden
    nginx

  24. #24
    Join Date
    May 2012
    Location
    Moscow, Russia
    Posts
    661
    Mentioned
    35 Post(s)
    Quoted
    102 Post(s)

    Default

    Quote Originally Posted by Runehack123 View Post
    Tried to open image in new tab and I got ->

    403 Forbidden
    nginx
    In the first post picture looks bad?
    Per aspera ad Astra!
    ----------------------------------------
    Slow and steady wins the race.

  25. #25
    Join Date
    May 2012
    Location
    Moscow, Russia
    Posts
    661
    Mentioned
    35 Post(s)
    Quoted
    102 Post(s)

    Default

    Fixed version has been released now.

    - Memory leak fixed
    - Delete duplicates added
    - Few optimisations
    Per aspera ad Astra!
    ----------------------------------------
    Slow and steady wins the race.

Page 1 of 6 123 ... LastLast

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
  •