Page 2 of 3 FirstFirst 123 LastLast
Results 26 to 50 of 68

Thread: Autocoloring with RGB,HSL and XYZ!

  1. #26
    Join Date
    Jan 2008
    Location
    Stanford, CA
    Posts
    329
    Mentioned
    0 Post(s)
    Quoted
    1 Post(s)

    Default

    excellent tutorial, but hey could this possibly be used to check if one is logged out? and to look for specific colors in certain areas?

  2. #27
    Join Date
    Nov 2007
    Location
    Chile
    Posts
    1,901
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by freakymonkey View Post
    excellent tutorial, but hey could this possibly be used to check if one is logged out? and to look for specific colors in certain areas?
    just change this:
    SCAR Code:
    FindColorsSpiralTolerance(MSCX, MSCY, ColorsTPA, MyColor, MMX1, MMY1, MMX2, MMY2, 60);
    to the area you want to look.


  3. #28
    Join Date
    Jan 2008
    Location
    Stanford, CA
    Posts
    329
    Mentioned
    0 Post(s)
    Quoted
    1 Post(s)

    Default

    alright sweet! =)

  4. #29
    Join Date
    Jul 2007
    Location
    Right now? Chair.
    Posts
    8,488
    Mentioned
    3 Post(s)
    Quoted
    12 Post(s)

    Default

    great tut, answered a few questions i had about AutoColoring!

    ~RM

    I & I know Zion. It is in the spirit, body and mind of every one of us
    RMouse(obj: TMSIObject): boolean;

  5. #30
    Join Date
    Aug 2007
    Posts
    123
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Thanks man, cant wait to put this into my script

  6. #31
    Join Date
    May 2007
    Location
    Some where fun.
    Posts
    2,891
    Mentioned
    1 Post(s)
    Quoted
    5 Post(s)

    Default

    Good tutorial, im testing out my autocolor.. It didnt work lol..

    I was reading over the replys and saw this..
    Quote Originally Posted by Cazax View Post
    for example you got 27 as red and 58 as green. 58 - 27 is 31.
    31 - 15 is 16. 31 + 15 is 46.
    SCAR Code:
    if InRange(r - g, 16, 46) then
    Where do you get the number 15?

    Everything else in that post i get fine.

    EDIT AGAIN:
    IS 15 the tolerance??? cause if it is i get it now..

  7. #32
    Join Date
    Mar 2007
    Posts
    1,223
    Mentioned
    0 Post(s)
    Quoted
    5 Post(s)

    Default

    R: 95
    G: 96
    B: 88

    H: 18.75
    S: 4.34782579541206
    L: 36.0784322023392

    X: 10.6636375115794
    Y: 11.5032188520144
    Z: 10.8908279770015

    Umm this is what I got now what do i do with this?

  8. #33
    Join Date
    Nov 2007
    Location
    Chile
    Posts
    1,901
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by cnr sport View Post
    Good tutorial, im testing out my autocolor.. It didnt work lol..

    I was reading over the replys and saw this..


    Where do you get the number 15?

    Everything else in that post i get fine.

    EDIT AGAIN:
    IS 15 the tolerance??? cause if it is i get it now..
    15 Is a sort of tolerance, if the color changes too much, use 20, 25, etc...


    Quote Originally Posted by faster789 View Post
    R: 95
    G: 96
    B: 88

    H: 18.75
    S: 4.34782579541206
    L: 36.0784322023392

    X: 10.6636375115794
    Y: 11.5032188520144
    Z: 10.8908279770015

    Umm this is what I got now what do i do with this?
    Uhmmm...Read the tut?


  9. #34
    Join Date
    Mar 2007
    Posts
    1,223
    Mentioned
    0 Post(s)
    Quoted
    5 Post(s)

    Default

    Lol i did, but what I mean is when you did yours you didnt have decimals in it so I'm asking if its right. -_-//

  10. #35
    Join Date
    Nov 2007
    Location
    Chile
    Posts
    1,901
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by faster789 View Post
    Lol i did, but what I mean is when you did yours you didnt have decimals in it so I'm asking if its right. -_-//
    Yes its right, just round it


  11. #36
    Join Date
    May 2007
    Location
    Some where fun.
    Posts
    2,891
    Mentioned
    1 Post(s)
    Quoted
    5 Post(s)

    Default

    Quote Originally Posted by Cazax View Post
    15 Is a sort of tolerance, if the color changes too much, use 20, 25, etc...



    Uhmmm...Read the tut?
    i have a 25 "sort of " tolerance cause im trying to autocolor the color of a oak tree on the mini map..

    SCAR Code:
    function MMoakcolor: Integer;
    var
      R,G,B : Integer; // Red, Blue and Red we are going to use them
      H,S,L : Extended; // HSL have decimal numbers
      X,Y,Z : Extended; // This one too!
      MyColor,NewColor : Integer; // The color we are going to 'AutoColor' and the new color is the new color :S
      ColorsTPA : TPointArray; // We are going to use TPA's
      C1,C2 : TIntegerArray; //  we are going to use them later
      i : Integer;
    begin
      MyColor := 18195;
      FindColorsSpiralTolerance(MMCX, MMCY, ColorsTPA, MyColor, MMX1, MMY1, MMX2, MMY2, 60);
      C1 := GetColors(ColorsTPA);
      ClearSameIntegers(C1);
      for i := 0 to Length(C1) - 1 do
        begin
          if rs_OnMinimap(ColorsTPA[i].X, ColorsTPA[i].Y) then
          begin
            NewColor := GetColor(ColorsTPA[i].X, ColorsTPA[i].Y);
            if SimilarColors(NewColor, MyColor, 50) then
            begin
              ColorToRGB(NewColor, R, G, B);
              ColorToHSL(NewColor, H, S, L);
              ColorToXYZ(NewColor, X, Y, Z);
               if InRange(R - G, -77, -27) then
                 if InRange(R - B, -6, 44) then
                   if InRange(G - B, 56, 106) then
                     if InRange(Round(S) - Round(H), -96, -46) then
                       if InRange(Round(L) - Round(H), -40, 10) then
                         if InRange(Round(S) - Round(L), 61, 111) then
                           if InRange(Round(X) - Round(Y), -17, 13) then
                             if InRange(Round(Y) - Round(Z), -11, 19) then
                               if GetColor(colorsTPA[i].X + 2, colorsTPA[i].Y + 2) = NewColor then
                                 if GetColor(colorsTPA[i].X + 1, colorsTPA[i].Y + 1) = NewColor then
                                 begin
                                   Writeln('Color = '+Inttostr(NewColor));
                                   Result := NewColor;
                                   Exit;
                                 end;
          end;
        end;
      end;
      Writeln('Couldnt find the Color!');
      Result := 0;
    end;

    IT WILL NEVER WORK! .. Please tell me why.. and please tell me possible fixes..? Im gonna rep you now for helping me

  12. #37
    Join Date
    Nov 2007
    Location
    Chile
    Posts
    1,901
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by cnr sport View Post
    i have a 25 "sort of " tolerance cause im trying to autocolor the color of a oak tree on the mini map..

    SCAR Code:
    function MMoakcolor: Integer;
    var
      R,G,B : Integer; // Red, Blue and Red we are going to use them
      H,S,L : Extended; // HSL have decimal numbers
      X,Y,Z : Extended; // This one too!
      MyColor,NewColor : Integer; // The color we are going to 'AutoColor' and the new color is the new color :S
      ColorsTPA : TPointArray; // We are going to use TPA's
      C1,C2 : TIntegerArray; //  we are going to use them later
      i : Integer;
    begin
      MyColor := 18195;
      FindColorsSpiralTolerance(MMCX, MMCY, ColorsTPA, MyColor, MMX1, MMY1, MMX2, MMY2, 60);
      C1 := GetColors(ColorsTPA);
      for i := 0 to Length(C1) - 1 do
        begin
          if rs_OnMinimap(ColorsTPA[i].X, ColorsTPA[i].Y) then
          begin
            NewColor := GetColor(ColorsTPA[i].X, ColorsTPA[i].Y);
            if SimilarColors(NewColor, MyColor, 50) then
            begin
              ColorToRGB(NewColor, R, G, B);
              ColorToHSL(NewColor, H, S, L);
              ColorToXYZ(NewColor, X, Y, Z);
               if InRange(R - G, -77, -27) then
                 if InRange(R - B, -6, 44) then
                   if InRange(G - B, 56, 106) then
                     if InRange(Round(S) - Round(H), -96, -46) then
                       if InRange(Round(L) - Round(H), -40, 10) then
                         if InRange(Round(S) - Round(L), 61, 111) then
                           if InRange(Round(X) - Round(Y), -17, 13) then
                             if InRange(Round(Y) - Round(Z), -11, 19) then
                               if GetColor(colorsTPA[i].X + 2, colorsTPA[i].Y + 2) = NewColor then
                                 if GetColor(colorsTPA[i].X + 1, colorsTPA[i].Y + 1) = NewColor then
                                 begin
                                   Writeln('Color = '+Inttostr(NewColor));
                                   Result := NewColor;
                                   Exit;
                                 end;
          end;
        end;
      end;
      Writeln('Couldnt find the Color!');
      Result := 0;
    end;

    IT WILL NEVER WORK! .. Please tell me why.. and please tell me possible fixes..? Im gonna rep you now for helping me
    Delete this:
    SCAR Code:
    ClearSameIntegers(C1);
    And, are you sure those numbers are negative?


  13. #38
    Join Date
    Mar 2007
    Posts
    1,223
    Mentioned
    0 Post(s)
    Quoted
    5 Post(s)

    Default

    you might want to show how you changed your second program and implemented it to the myfirstautocolor funcction...because apparently you didnt use the same range of the second program to the autocolor function, because they both are differnt..

  14. #39
    Join Date
    May 2007
    Location
    Some where fun.
    Posts
    2,891
    Mentioned
    1 Post(s)
    Quoted
    5 Post(s)

    Default

    Quote Originally Posted by Cazax View Post
    Delete this:
    SCAR Code:
    ClearSameIntegers(C1);
    And, are you sure those numbers are negative?
    I think they are, but why would i delete that.. Im gonna try it now..

    Edit: Doesnt work either..

  15. #40
    Join Date
    Nov 2007
    Location
    Chile
    Posts
    1,901
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by faster789 View Post
    you might want to show how you changed your second program and implemented it to the myfirstautocolor funcction...because apparently you didnt use the same range of the second program to the autocolor function, because they both are differnt..
    they arent the same becouse they are different examples.


  16. #41
    Join Date
    May 2007
    Location
    Some where fun.
    Posts
    2,891
    Mentioned
    1 Post(s)
    Quoted
    5 Post(s)

    Default

    Quote Originally Posted by Cazax View Post
    they arent the same becouse they are different examples.
    Do you have any ideas of how i can fix my problem?

  17. #42
    Join Date
    Nov 2007
    Location
    Chile
    Posts
    1,901
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    SCAR Code:
    Function FindMMOakTree : Integer;
    var
      H,S,L,X,Y,Z : Extended;
      R,G,B,P,A,TestColor,xx,xy : Integer;
      TPA : TPointArray;
    begin
      if Not(LoggedIn) then Exit;
        xx:= MMCX;
        xy := MMCY;
        FindColorsSpiralTolerance(xx, xy, TPA, 1068078, MMX1, MMY1, MMX2, MMY2, 60)
        P := High(TPA);
        for A := 0 to P do
        begin
          if RS_OnMinimap(TPA[A].X, TPA[A].Y) then
          begin
            TestColor := GetColor(TPA[A].X, TPA[A].Y);
            if SimilarColors(TestColor, 1068078, 50) then
            begin
               ColorToRGB(TestColor, R, G, B);
               ColorToHSL(TestColor, H, S, L);
               ColorToXYZ(TestColor, X, Y, Z);
               if InRange(R - G, -50, -10) then
                 if InRange(R - B, 10, 54) then
                   if InRange(G - B, 32, 99) then
                     if InRange(Round(S) - Round(H), 22, 73) then
                       if InRange(Round(L) - Round(H), -17, 2) then
                         if InRange(Round(S) - Round(L), 30, 75) then
                           if InRange(Round(X) - Round(Y), -9, 5) then
                             if InRange(Round(Y) - Round(Z), 2, 8) then
                               if GetColor(TPA[A].X + 2, TPA[A].Y + 2) = TestColor then
                                 if GetColor(TPA[A].X + 1, TPA[A].Y + 1) = TestColor then
                                 begin
                                   Writeln('MMOakColor = '+Inttostr(TestColor));
                                   Result := TestColor;
                                   Exit;
                                 end;
          end;
        end;
      end;
      Writeln('Couldnt find MMOakColor!');
      Result := 0;
    end;
    Test it


  18. #43
    Join Date
    May 2007
    Location
    Some where fun.
    Posts
    2,891
    Mentioned
    1 Post(s)
    Quoted
    5 Post(s)

    Default

    Quote Originally Posted by Cazax View Post
    SCAR Code:
    Function FindMMOakTree : Integer;
    var
      H,S,L,X,Y,Z : Extended;
      R,G,B,P,A,TestColor,xx,xy : Integer;
      TPA : TPointArray;
    begin
      if Not(LoggedIn) then Exit;
        xx:= MMCX;
        xy := MMCY;
        FindColorsSpiralTolerance(xx, xy, TPA, 1068078, MMX1, MMY1, MMX2, MMY2, 60)
        P := High(TPA);
        for A := 0 to P do
        begin
          if RS_OnMinimap(TPA[A].X, TPA[A].Y) then
          begin
            TestColor := GetColor(TPA[A].X, TPA[A].Y);
            if SimilarColors(TestColor, 1068078, 50) then
            begin
               ColorToRGB(TestColor, R, G, B);
               ColorToHSL(TestColor, H, S, L);
               ColorToXYZ(TestColor, X, Y, Z);
               if InRange(R - G, -50, -10) then
                 if InRange(R - B, 10, 54) then
                   if InRange(G - B, 32, 99) then
                     if InRange(Round(S) - Round(H), 22, 73) then
                       if InRange(Round(L) - Round(H), -17, 2) then
                         if InRange(Round(S) - Round(L), 30, 75) then
                           if InRange(Round(X) - Round(Y), -9, 5) then
                             if InRange(Round(Y) - Round(Z), 2, 8) then
                               if GetColor(TPA[A].X + 2, TPA[A].Y + 2) = TestColor then
                                 if GetColor(TPA[A].X + 1, TPA[A].Y + 1) = TestColor then
                                 begin
                                   Writeln('MMOakColor = '+Inttostr(TestColor));
                                   Result := TestColor;
                                   Exit;
                                 end;
          end;
        end;
      end;
      Writeln('Couldnt find MMOakColor!');
      Result := 0;
    end;
    Test it

    WOW- you own for just making me the proc.. Im testing now.. will edit this post

    Didnt find the color.. The first time.. now it always does.. thanks! reped u but it always finds the wrong color..

  19. #44
    Join Date
    Apr 2007
    Posts
    224
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    So.... ummmm do i call the function in the script and it will find color and idk what to do next rofl.

  20. #45
    Join Date
    Jun 2007
    Location
    La Mirada, CA
    Posts
    2,484
    Mentioned
    1 Post(s)
    Quoted
    3 Post(s)

    Default

    if you dont know the basics of colors and what autocoloring is used for then go to simpler tuts first

    "Failure is the opportunity to begin again more intelligently" (Henry Ford)


  21. #46
    Join Date
    Apr 2007
    Posts
    224
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by HyperSecret View Post
    if you dont know the basics of colors and what autocoloring is used for then go to simpler tuts first
    Worked it out

  22. #47
    Join Date
    Jan 2008
    Location
    Frankfurt, Germany
    Posts
    742
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Hey Cazax, I promised I would go through your tut again, and guess what, here I am
    I am not quite done (well, reading it over for the third time, but this time I will try to really concentrate ), but I noticed one thing:
    SCAR Code:
    ClearSameInteger(C1);
    should be
    SCAR Code:
    ClearSameIntegers(C1);
    just a hint for those of you who get the (i think it was) type mismatch error.
    I will edit this post when I am done and I understood it

    EDIT: Well, finished an (mostly) understood (still having problems getting the correct ranges, but I guess that's just a matter of time and practice till I get good enough with it).
    Now I only have two questions left:
    1.) Why the heck didn't i get this the first and second time I read this?!?!?!!?
    2.) Why the heck isn't this stickied? I think it deserves it! Autocoloring is a huge part of rs cheat writing scripts, and everyone should understand what the are using...
    Thanks for an awesome guide, rep++ for you.

    PS: Now the function which you made for me looks official:
    SCAR Code:
    {*******************************************************************************
    function HouseColor: Integer;
    By: Cazax;
    Modified by: Pure1993 (Only ironing out the few type mismatches ;D )
    Description: Detects the color of the house in the Lumbridge graveyard in which
    the ghost appears in the Restless Ghost quest.
    *******************************************************************************}


    function HouseColor: Integer;
    var
      X,Y,Z, H, S, L : Extended;
      R,G,B,P,A,TestColor,xx,xy : Integer;
      TPA : TPointArray;
    begin
      if Not(LoggedIn) then Exit;
        xx:= MMCX;
        xy := MMCY;
        FindColorsSpiralTolerance(xx, xy, TPA, 3227710, MMX1, MMY1, MMX2, MMY2, 60)
        P := High(TPA);
        for A := 0 to P do
        begin
          if RS_OnMinimap(TPA[A].X, TPA[A].Y) then
          begin
            TestColor := GetColor(TPA[A].X, TPA[A].Y);
            if SimilarColors(TestColor, 4739921, 50) then
            begin
              ColorToRGB(TestColor, R, G, B);
              ColorToHSL(TestColor, H, S, L);
              ColorToXYZ(TestColor, X, Y, Z);
              if InRange(R - G, -22, 18) then
                if InRange(R - B, -11, 29) then
                  if InRange(G - B, -9, 31) then
                          if InRange(Round(X) - Round(Y), -7, 7) then
                            if InRange(Round(Y) - Round(Z), -6, 8) then
                              if GetColor(TPA[A].X + 2, TPA[A].Y + 2) = TestColor then
                                if GetColor(TPA[A].X + 1, TPA[A].Y + 1) = TestColor then
                                begin
                                  Writeln('HouseColor = '+Inttostr(TestColor));
                                  Result := TestColor;
                                  Exit;
                                end;
            end;
          end;
        end;
        Writeln('Couldnt find Color!');
        Result := 0;
    end;
    Now it looks like it came straight from the srl library .
    There is nothing right in my left brain and there is nothing left in my right brain.

  23. #48
    Join Date
    Nov 2007
    Location
    Chile
    Posts
    1,901
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by Pure1993 View Post
    Hey Cazax, I promised I would go through your tut again, and guess what, here I am
    I am not quite done (well, reading it over for the third time, but this time I will try to really concentrate ), but I noticed one thing:
    SCAR Code:
    ClearSameInteger(C1);
    should be
    SCAR Code:
    ClearSameIntegers(C1);
    just a hint for those of you who get the (i think it was) type mismatch error.
    I will edit this post when I am done and I understood it

    EDIT: Well, finished an (mostly) understood (still having problems getting the correct ranges, but I guess that's just a matter of time and practice till I get good enough with it).
    Now I only have two questions left:
    1.) Why the heck didn't i get this the first and second time I read this?!?!?!!?
    2.) Why the heck isn't this stickied? I think it deserves it! Autocoloring is a huge part of rs cheat writing scripts, and everyone should understand what the are using...
    Thanks for an awesome guide, rep++ for you.

    PS: Now the function which you made for me looks official:
    SCAR Code:
    {*******************************************************************************
    function HouseColor: Integer;
    By: Cazax;
    Modified by: Pure1993 (Only ironing out the few type mismatches ;D )
    Description: Detects the color of the house in the Lumbridge graveyard in which
    the ghost appears in the Restless Ghost quest.
    *******************************************************************************}


    function HouseColor: Integer;
    var
      X,Y,Z, H, S, L : Extended;
      R,G,B,P,A,TestColor,xx,xy : Integer;
      TPA : TPointArray;
    begin
      if Not(LoggedIn) then Exit;
        xx:= MMCX;
        xy := MMCY;
        FindColorsSpiralTolerance(xx, xy, TPA, 3227710, MMX1, MMY1, MMX2, MMY2, 60)
        P := High(TPA);
        for A := 0 to P do
        begin
          if RS_OnMinimap(TPA[A].X, TPA[A].Y) then
          begin
            TestColor := GetColor(TPA[A].X, TPA[A].Y);
            if SimilarColors(TestColor, 4739921, 50) then
            begin
              ColorToRGB(TestColor, R, G, B);
              ColorToHSL(TestColor, H, S, L);
              ColorToXYZ(TestColor, X, Y, Z);
              if InRange(R - G, -22, 18) then
                if InRange(R - B, -11, 29) then
                  if InRange(G - B, -9, 31) then
                          if InRange(Round(X) - Round(Y), -7, 7) then
                            if InRange(Round(Y) - Round(Z), -6, 8) then
                              if GetColor(TPA[A].X + 2, TPA[A].Y + 2) = TestColor then
                                if GetColor(TPA[A].X + 1, TPA[A].Y + 1) = TestColor then
                                begin
                                  Writeln('HouseColor = '+Inttostr(TestColor));
                                  Result := TestColor;
                                  Exit;
                                end;
            end;
          end;
        end;
        Writeln('Couldnt find Color!');
        Result := 0;
    end;
    Now it looks like it came straight from the srl library .
    Thank you i forgot say something ill edit the tut...


  24. #49
    Join Date
    Jul 2007
    Location
    Ohio
    Posts
    1,103
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Dang, thanks for this it really helped me out with my script. You get some rep++.

  25. #50
    Join Date
    Jan 2008
    Location
    Frankfurt, Germany
    Posts
    742
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Np Cazax, but you still didn't change the thing i mean, you missed the "s" in ClearSameIntegers.
    There is nothing right in my left brain and there is nothing left in my right brain.

Page 2 of 3 FirstFirst 123 LastLast

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. autocoloring
    By Shuttleu in forum OSR Help
    Replies: 0
    Last Post: 04-19-2008, 10:42 PM
  2. AutoColoring
    By king vash in forum OSR Help
    Replies: 3
    Last Post: 02-05-2008, 01:07 PM
  3. Help with autocoloring...
    By rockman in forum OSR Help
    Replies: 5
    Last Post: 01-24-2008, 11:30 PM

Posting Permissions

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