Results 1 to 25 of 25

Thread: CTS AuoColor

  1. #1
    Join Date
    Aug 2008
    Location
    !!LOL!!
    Posts
    247
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default CTS AuoColor

    i made this:
    SCAR Code:
    program TPALearningTut;
    {.include SRL/SRL.scar}

    function AutoColor: Integer;
    var
      CTS, I, TestColor: Integer;
      P: TPointArray;
      H, S, L: Extended;
    begin
      CTS := GetColorToleranceSpeed;
      ColorToleranceSpeed(2);
      SetColorSpeed2Modifiers(0.71, 0.61);

      FFlag(0);
      FindColorsSpiralTolerance(MMCX, MMCY, P, 5929889, MMX1, MMY1, MMX2, MMY2, 60);

      For I := 0 to High(P) do
      if rs_OnMinimap(P[i].x,P[i].y) then
        begin
          TestColor := GetColor(P[i].x, P[i].y);
          ColorToHSL(TestColor, H, S, L);
          if InRange(Round(H - L), -51, -32) then
          if InRange(Round(S - H), 13, 32) then
          If InRange(Round(S - L), -30, -10) then

               begin
                 Result := TestColor;
                 Writeln(' Auto Color = '+IntToStr(Result));
                 exit;
               end;
        end;
      ColorToleranceSpeed(CTS);
      SetColorSpeed2Modifiers(0.2, 0.2);
      Writeln('Didnt Work');
    end;

    begin
    SetupSrl;
    ActivateClient;
    Wait(1000);
    AutoColor;
    end.
    My problem is that i cant work out the best ranges, some info:
    Program Auto colors:7249603
    supposed to auto color: 6392491
    color im using : 5929889
    thank you for ur time.

  2. #2
    Join Date
    Feb 2007
    Location
    PA, USA
    Posts
    5,240
    Mentioned
    36 Post(s)
    Quoted
    496 Post(s)

    Default

    go into srl includes and find Scripting tools, inside that is ACA2 (auto color aid 2)
    use that and be sure to pick TONS of the same(relatively) colors from different worlds/logging in/out

  3. #3
    Join Date
    Aug 2008
    Location
    !!LOL!!
    Posts
    247
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    thanks i know of aca2 but i want to learn to do it my self i wanna understand

  4. #4
    Join Date
    Dec 2007
    Location
    192.168.1.73
    Posts
    2,439
    Mentioned
    6 Post(s)
    Quoted
    119 Post(s)

    Default

    R0b0t1 made a very helpful tut on HSL ACing: http://villavu.com/forum/showthread.php?t=17110

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

    Default

    I liked Pure1993's guide more.
    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

  6. #6
    Join Date
    Jan 2008
    Location
    Ontario, Canada
    Posts
    7,805
    Mentioned
    5 Post(s)
    Quoted
    3 Post(s)

    Default

    Uhm you don't sort it in anyway.

    I use a strategy, get all the colours under a tolerance, use a for..to..do loop and create a 2D Point array of the occuraces of each colour. Use SortATPASize to sort this new atpa, go through checking all the colours and lengths of each occurance. Don't forget to use ClearSameIntegers

    Example:
    SCAR Code:
    function FindKaraTreeColour: Integer;
    var
      p: TPointArray;
      a: T2DPointArray;
      c: TIntegerArray;
      i, h, cts: Integer;
      R, G, B: Integer;
    begin
      Result := 0;
      cts := GetColorToleranceSpeed;
      ColorToleranceSpeed(1);
     
      FindColorsTolerance(p, 3238985, MMX1, MMY1, MMX2, MMY2, 47);
      FilterPointsPie(p, 0, 360, 10, 76, MMCX, MMCY);
      if High(p) < 50 then
      begin
        ColorToleranceSpeed(cts);
        Writeln('FindKaraTreeColour: Could not find Base Colour.');
        Exit;
      end;
     
      c := GetColors(p);
      ClearSameIntegers(c);
      h := High(c);
      SetLength(a, h + 1);
      for i := 0 to h do
      begin
        ColorToRGB(c[i], R, G, B);
       
        if (R >= 44) and (R <= 101) and (G >= 80) and (G <= 136) and (B >= 22) and (B <= 75) then
        begin
          FindColors(a[i], c[i], MMX1, MMY1, MMX2, MMY2);
          FilterPointsPie(a[i], 0, 360, 10, 76, MMCX, MMCY);
        end;
      end;
      SortATPASize(a, True);
     
      Result := GetColor(a[0][0].x, a[0][0].y);
      {$IFDEF DEBUG}Writeln('KaraTreeColour = ' + IntToStr(Result));{$ENDIF}
      ColorToleranceSpeed(cts);
    end;

    Not the best example, but you can kinda see what I mean.
    Writing an SRL Member Application | [Updated] Pascal Scripting Statements
    My GitHub

    Progress Report:
    13:46 <@BenLand100> <SourceCode> @BenLand100: what you have just said shows you 
                        have serious physchological problems
    13:46 <@BenLand100> HE GETS IT!
    13:46 <@BenLand100> HE FINALLY GETS IT!!!!1

  7. #7
    Join Date
    Feb 2007
    Location
    Alberta,Canada
    Posts
    2,358
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by Nava2 View Post
    Uhm you don't sort it in anyway.

    I use a strategy, get all the colours under a tolerance, use a for..to..do loop and create a 2D Point array of the occuraces of each colour. Use SortATPASize to sort this new atpa, go through checking all the colours and lengths of each occurance. Don't forget to use ClearSameIntegers

    Example:
    SCAR Code:
    function FindKaraTreeColour: Integer;
    var
      p: TPointArray;
      a: T2DPointArray;
      c: TIntegerArray;
      i, h, cts: Integer;
      R, G, B: Integer;
    begin
      Result := 0;
      cts := GetColorToleranceSpeed;
      ColorToleranceSpeed(1);
     
      FindColorsTolerance(p, 3238985, MMX1, MMY1, MMX2, MMY2, 47);
      FilterPointsPie(p, 0, 360, 10, 76, MMCX, MMCY);
      if High(p) < 50 then
      begin
        ColorToleranceSpeed(cts);
        Writeln('FindKaraTreeColour: Could not find Base Colour.');
        Exit;
      end;
     
      c := GetColors(p);
      ClearSameIntegers(c);
      h := High(c);
      SetLength(a, h + 1);
      for i := 0 to h do
      begin
        ColorToRGB(c[i], R, G, B);
       
        if (R >= 44) and (R <= 101) and (G >= 80) and (G <= 136) and (B >= 22) and (B <= 75) then
        begin
          FindColors(a[i], c[i], MMX1, MMY1, MMX2, MMY2);
          FilterPointsPie(a[i], 0, 360, 10, 76, MMCX, MMCY);
        end;
      end;
      SortATPASize(a, True);
     
      Result := GetColor(a[0][0].x, a[0][0].y);
      {$IFDEF DEBUG}Writeln('KaraTreeColour = ' + IntToStr(Result));{$ENDIF}
      ColorToleranceSpeed(cts);
    end;

    Not the best example, but you can kinda see what I mean.
    this has always confused me, what does FilterPointsPie do?
    “Ignorance, the root and the stem of every evil.”

  8. #8
    Join Date
    Jan 2008
    Location
    Ontario, Canada
    Posts
    7,805
    Mentioned
    5 Post(s)
    Quoted
    3 Post(s)

    Default

    Quote Originally Posted by Blumblebee View Post
    this has always confused me, what does FilterPointsPie do?
    Easy, removes all points not within the Start Radial (SR) and the End Radial (ER) in between the minimum radius (MinR) and the Maximum radius (MaxR). And mx and my are the center of the circle to filter from!
    Writing an SRL Member Application | [Updated] Pascal Scripting Statements
    My GitHub

    Progress Report:
    13:46 <@BenLand100> <SourceCode> @BenLand100: what you have just said shows you 
                        have serious physchological problems
    13:46 <@BenLand100> HE GETS IT!
    13:46 <@BenLand100> HE FINALLY GETS IT!!!!1

  9. #9
    Join Date
    Feb 2007
    Location
    Alberta,Canada
    Posts
    2,358
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by Nava2 View Post
    Easy, removes all points not within the Start Radial (SR) and the End Radial (ER) in between the minimum radius (MinR) and the Maximum radius (MaxR). And mx and my are the center of the circle to filter from!
    so pretty much you go from 0 to 360 to enclose the whole minimap, but you use the min and max radius to get rid of the colors that are (potentially) worthless or harmful to the autocolor. cool ty
    “Ignorance, the root and the stem of every evil.”

  10. #10
    Join Date
    Aug 2008
    Location
    !!LOL!!
    Posts
    247
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    thank you very much guys really!!!
    edit:> How did u get the r g b values?
    ediy:>> W0000000000000T mt acing finally works thank you nava2!!!!!!!!!!!!!!!
    Last edited by hackncrack1; 05-08-2009 at 09:47 PM.

  11. #11
    Join Date
    Jan 2008
    Location
    California, US
    Posts
    2,765
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    ColorToRGB

  12. #12
    Join Date
    Dec 2007
    Location
    192.168.1.73
    Posts
    2,439
    Mentioned
    6 Post(s)
    Quoted
    119 Post(s)

    Default

    So which CTS is more reliable?

  13. #13
    Join Date
    Mar 2007
    Posts
    4,810
    Mentioned
    3 Post(s)
    Quoted
    3 Post(s)

    Default

    Yeah FilterPointsPie(AFAIK) is used in RadialWalk, Try lowering the tolerance it seems very high..

  14. #14
    Join Date
    Sep 2006
    Posts
    6,089
    Mentioned
    77 Post(s)
    Quoted
    43 Post(s)

    Default

    Quote Originally Posted by Nava2 View Post
    Uhm you don't sort it in anyway.

    I use a strategy, get all the colours under a tolerance, use a for..to..do loop and create a 2D Point array of the occuraces of each colour. Use SortATPASize to sort this new atpa, go through checking all the colours and lengths of each occurance. Don't forget to use ClearSameIntegers

    Example:
    SCAR Code:
    function FindKaraTreeColour: Integer;
    var
      p: TPointArray;
      a: T2DPointArray;
      c: TIntegerArray;
      i, h, cts: Integer;
      R, G, B: Integer;
    begin
      Result := 0;
      cts := GetColorToleranceSpeed;
      ColorToleranceSpeed(1);
     
      FindColorsTolerance(p, 3238985, MMX1, MMY1, MMX2, MMY2, 47);
      FilterPointsPie(p, 0, 360, 10, 76, MMCX, MMCY);
      if High(p) < 50 then
      begin
        ColorToleranceSpeed(cts);
        Writeln('FindKaraTreeColour: Could not find Base Colour.');
        Exit;
      end;
     
      c := GetColors(p);
      ClearSameIntegers(c);
      h := High(c);
      SetLength(a, h + 1);
      for i := 0 to h do
      begin
        ColorToRGB(c[i], R, G, B);
       
        if (R >= 44) and (R <= 101) and (G >= 80) and (G <= 136) and (B >= 22) and (B <= 75) then
        begin
          FindColors(a[i], c[i], MMX1, MMY1, MMX2, MMY2);
          FilterPointsPie(a[i], 0, 360, 10, 76, MMCX, MMCY);
        end;
      end;
      SortATPASize(a, True);
     
      Result := GetColor(a[0][0].x, a[0][0].y);
      {$IFDEF DEBUG}Writeln('KaraTreeColour = ' + IntToStr(Result));{$ENDIF}
      ColorToleranceSpeed(cts);
    end;

    Not the best example, but you can kinda see what I mean.
    Isn't that a bit over the top? Why not use a maxCount and maxColor instead of storing all the counts? And sorting like this wont always help of course =\

  15. #15
    Join Date
    Aug 2008
    Location
    !!LOL!!
    Posts
    247
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    I've used this sorting 10 times and it hasn't failed yet, always chooses the rite color i think cts 2 is the most reliable

  16. #16
    Join Date
    Jan 2008
    Location
    California, US
    Posts
    2,765
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Cts 3 is more accurate but slow lol.

  17. #17
    Join Date
    Aug 2008
    Location
    !!LOL!!
    Posts
    247
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    i read that difference in slowness is 40 to 100 ms

  18. #18
    Join Date
    Jan 2008
    Location
    Ontario, Canada
    Posts
    7,805
    Mentioned
    5 Post(s)
    Quoted
    3 Post(s)

    Default

    for the minimap you only need CTS1 because the minimap is based off rgb values only. In other words, adding hue and saturation is just excessive.



    @nielsie you cant filter points with count colour. also, no thAt sorting isn't always right but it's good for most needs.
    Last edited by Nava2; 05-10-2009 at 01:13 PM.
    Writing an SRL Member Application | [Updated] Pascal Scripting Statements
    My GitHub

    Progress Report:
    13:46 <@BenLand100> <SourceCode> @BenLand100: what you have just said shows you 
                        have serious physchological problems
    13:46 <@BenLand100> HE GETS IT!
    13:46 <@BenLand100> HE FINALLY GETS IT!!!!1

  19. #19
    Join Date
    Aug 2008
    Location
    !!LOL!!
    Posts
    247
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    is there a tutorial on sorting?? i need to understand some stuff

  20. #20
    Join Date
    Sep 2006
    Posts
    6,089
    Mentioned
    77 Post(s)
    Quoted
    43 Post(s)

    Default

    Quote Originally Posted by Nava2 View Post
    for the minimap you only need CTS1 because the minimap is based off rgb values only. In other words, adding hue and saturation is just excessive.



    @nielsie you cant filter points with count colour. also, no thAt sorting isn't always right but it's good for most needs.
    I'm not sure what you mean, but this is what I meant by my other post:

    SCAR Code:
    function FindKaraTreeColour: Integer;
    var
      p: TPointArray;
      c: TIntegerArray;
      i, h, cts, maxCount, maxColor: Integer;
      R, G, B: Integer;
    begin
      Result := 0;
      cts := GetColorToleranceSpeed;
      ColorToleranceSpeed(1);

      FindColorsTolerance(p, 3238985, MMX1, MMY1, MMX2, MMY2, 47);
      FilterPointsPie(p, 0, 360, 10, 76, MMCX, MMCY);
      if High(p) < 50 then
      begin
        ColorToleranceSpeed(cts);
        Writeln('FindKaraTreeColour: Could not find Base Colour.');
        Exit;
      end;

      c := GetColors(p);
      ClearSameIntegers(c);
      h := High(c);
      maxCount := -1;
      for i := 0 to h do
      begin
        ColorToRGB(c[i], R, G, B);

        if (R >= 44) and (R <= 101) and (G >= 80) and (G <= 136) and (B >= 22) and (B <= 75) then
        begin
          FindColors(p, c[i], MMX1, MMY1, MMX2, MMY2);
          FilterPointsPie(p, 0, 360, 10, 76, MMCX, MMCY);
          if (Length(p) > maxCount) or (maxCount = -1) then
          begin
            maxCount := Length(p);
            maxColor := c[i];
          end;
        end;
      end;

      Result := maxColor;
      {$IFDEF DEBUG}Writeln('KaraTreeColour = ' + IntToStr(Result));{$ENDIF}
      ColorToleranceSpeed(cts);
    end;

    hackncrack1, I don't think there are any tutorials on sorting colors (there's not so much to tell about). But if you don't understand some things, you can ask them here
    Last edited by nielsie95; 05-10-2009 at 04:05 PM.

  21. #21
    Join Date
    Aug 2008
    Location
    !!LOL!!
    Posts
    247
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    ok so wat exactly did this function do?
    SCAR Code:
    FindColorsTolerance(p, 3238985, MMX1, MMY1, MMX2, MMY2, 47);

  22. #22
    Join Date
    Sep 2006
    Posts
    6,089
    Mentioned
    77 Post(s)
    Quoted
    43 Post(s)

    Default

    FindColorsTolerance finds all the points in an area that are similar to a color. This time it finds all the points with colors similar (tolerance 47) to 3238985. The found points are stored in p, a TPointArray, a list of TPoints. MMX1..MMY2 stands for MiniMapX1..MiniMapY2, so it searches on the minimap.

  23. #23
    Join Date
    Aug 2008
    Location
    !!LOL!!
    Posts
    247
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    oops wrong function this one:
    SCAR Code:
    FilterPointsPie(p, 0, 360, 10, 76, MMCX, MMCY);

  24. #24
    Join Date
    Jan 2008
    Location
    California, US
    Posts
    2,765
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Filters the points and consolidates them from the start radial to the end radial I believe.

  25. #25
    Join Date
    Sep 2006
    Posts
    6,089
    Mentioned
    77 Post(s)
    Quoted
    43 Post(s)

    Default

    Yeah, it filters out the points that are not in the "pie" shape. The pie shape is formed by degrees. So from 0 to 90 would be 1/4th of a circle. 0 to 180 would be 1/2 and 0 to 360 is a circle. It also filters out points that are too close or too far away from the midpoint. In this case a distance from 10 to 76 is aloud, everything that's not in that range is filtered out.

    To put it more simple, that particular piece of code filters out the points that are not on the MiniMap.

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
  •