Results 1 to 14 of 14

Thread: FindFallyRoadColor, FindVarrockRoadColor and more!

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

    Default FindFallyRoadColor, FindVarrockRoadColor and more!

    SCAR Code:
    Program New;
    {.include SRL/SRL.scar}

    function FindDraynorRoadColor: Integer;
    var
      R,G,B,TestColor : Integer;
      H,S,L : Extended;
      X,Y,Z : Extended;
      MyColor : Integer;
      ColorsTPA : TPointArray;
      C1 : TIntegerArray;
      i,C2: Integer;
    begin
      MyColor := 6975343;
      FindColorsSpiralTolerance(MMCX, MMCY, ColorsTPA, MyColor, MMX1, MMY1, MMX2, MMY2, 60);
      C1 := GetColors(ColorsTPA);
      C2 := High(C1);
      for i := 0 to C2 do
        begin
          if RS_OnMinimap(ColorsTPA[i].X, ColorsTPA[i].Y) then
          begin
            TestColor := GetColor(ColorsTPA[i].X, ColorsTPA[i].Y);

            if SimilarColors(TestColor, 6975343 , 40) then
            begin
               ColorToRGB(TestColor, R, G, B);
               ColorToHSL(TestColor, H, S, L);
               ColorToXYZ(TestColor, X, Y, Z);

               if InRange(R - G, -20, 20) then
                 if InRange(R - B, -15, 25) then
                   if InRange(G - B, -15, 25) then
                     if InRange(Round(S) - Round(H), -30, 0) then
                       if InRange(Round(L) - Round(H), 11, 41) then
                         if InRange(Round(S) - Round(L), -56, -26) then
                           if InRange(Round(X) - Round(Y), -8, 6) then
                             if InRange(Round(Y) - Round(Z), -7, 7) then
                               if (SimilarColors(MyColor, GetColor(ColorsTPA[i].X + 1, ColorsTPA[i].Y + 1), 8)) then
                                 if (SimilarColors(MyColor, GetColor(ColorsTPA[i].X - 1, ColorsTPA[i].Y - 1), 8)) then
                                 begin
                                   Result := TestColor;
                                   Writeln('Draynor Road Color = '+inttostr(testcolor)+'');
                                   Exit;
                                 end;

          end;
        end;
      end;
      Writeln('Couldnt find Draynor Road Color!');
      Result := 0;
    end;

    function FindFallyRoadColor: Integer;
    var
      R,G,B,TestColor : Integer;
      H,S,L : Extended;
      X,Y,Z : Extended;
      MyColor : Integer;
      ColorsTPA : TPointArray;
      C1 : TIntegerArray;
      i,C2: Integer;
    begin
      MyColor := 7766665 ;
      FindColorsSpiralTolerance(MMCX, MMCY, ColorsTPA, MyColor, MMX1, MMY1, MMX2, MMY2, 60);
      C1 := GetColors(ColorsTPA);
      C2 := High(C1);
      for i := 0 to C2 do
        begin
          if RS_OnMinimap(ColorsTPA[i].X, ColorsTPA[i].Y) then
          begin
            TestColor := GetColor(ColorsTPA[i].X, ColorsTPA[i].Y);

            if SimilarColors(TestColor, 7766665  , 40) then
            begin
               ColorToRGB(TestColor, R, G, B);
               ColorToHSL(TestColor, H, S, L);
               ColorToXYZ(TestColor, X, Y, Z);

               if InRange(R - G, -13, 27) then
                 if InRange(R - B, -1, 39) then
                   if InRange(G - B, -8, 32) then
                     if InRange(Round(S) - Round(H), -19, 11) then
                       if InRange(Round(L) - Round(H), 24, 54) then
                         if InRange(Round(S) - Round(L), -58, -28) then
                           if InRange(Round(X) - Round(Y), -8, 6) then
                             if InRange(Round(Y) - Round(Z), -4, 10) then
                               if (SimilarColors(MyColor, GetColor(ColorsTPA[i].X + 1, ColorsTPA[i].Y + 1), 6)) then
                                if (SimilarColors(MyColor, GetColor(ColorsTPA[i].X - 1, ColorsTPA[i].Y - 1), 6)) then
                                 begin
                                   Result := TestColor;
                                   Writeln('Fally Road Color = '+inttostr(testcolor)+'');
                                   Exit;
                                 end;

          end;
        end;
      end;
      Writeln('Couldnt find Fally Road Color!');
      Result := 0;
    end;

    function FindBarbarianRoadColor: Integer;
    var
      R,G,B,TestColor : Integer;
      H,S,L : Extended;
      X,Y,Z : Extended;
      MyColor : Integer;
      ColorsTPA : TPointArray;
      C1 : TIntegerArray;
      i,C2: Integer;
    begin
      MyColor := 4284271;
      FindColorsSpiralTolerance(MMCX, MMCY, ColorsTPA, MyColor, MMX1, MMY1, MMX2, MMY2, 60);
      C1 := GetColors(ColorsTPA);
      C2 := High(C1);
      for i := 0 to C2 do
        begin
          if RS_OnMinimap(ColorsTPA[i].X, ColorsTPA[i].Y) then
          begin
            TestColor := GetColor(ColorsTPA[i].X, ColorsTPA[i].Y);

            if SimilarColors(TestColor, 4284271, 40) then
            begin
               ColorToRGB(TestColor, R, G, B);
               ColorToHSL(TestColor, H, S, L);
               ColorToXYZ(TestColor, X, Y, Z);

               if InRange(R - G, -4, 36) then
                 if InRange(R - B, 26, 66) then
                   if InRange(G - B, 10, 50) then
                     if InRange(Round(S) - Round(H), 0, 30) then
                       if InRange(Round(L) - Round(H), 9, 39) then
                         if InRange(Round(S) - Round(L), -24, 6) then
                           if InRange(Round(X) - Round(Y), -7, 7) then
                             if InRange(Round(Y) - Round(Z), -2, 12) then
                               if (SimilarColors(MyColor, GetColor(ColorsTPA[i].X + 1, ColorsTPA[i].Y + 1), 5)) then
                                if (SimilarColors(MyColor, GetColor(ColorsTPA[i].X - 1, ColorsTPA[i].Y - 1), 5)) then
                                 begin
                                   Result := TestColor;
                                   Writeln('Barbarian Road Color = '+inttostr(testcolor)+'');
                                   Exit;
                                 end;

          end;
        end;
      end;
      Writeln('Couldnt find Barbarian Road Color!');
      Result := 0;
    end;


    function FindVarrockRoadColor: Integer;
    var
      R,G,B,TestColor : Integer;
      H,S,L : Extended;
      X,Y,Z : Extended;
      MyColor : Integer;
      ColorsTPA : TPointArray;
      C1 : TIntegerArray;
      i,C2: Integer;
    begin
      MyColor := 9078929;
      FindColorsSpiralTolerance(MMCX, MMCY, ColorsTPA, MyColor, MMX1, MMY1, MMX2, MMY2, 60);
      C1 := GetColors(ColorsTPA);
      C2 := High(C1);
      for i := 0 to C2 do
        begin
          if RS_OnMinimap(ColorsTPA[i].X, ColorsTPA[i].Y) then
          begin
            TestColor := GetColor(ColorsTPA[i].X, ColorsTPA[i].Y);

            if SimilarColors(TestColor, 9078929, 40) then
            begin
               ColorToRGB(TestColor, R, G, B);
               ColorToHSL(TestColor, H, S, L);
               ColorToXYZ(TestColor, X, Y, Z);

               if InRange(R - G, -11, 29) then
                 if InRange(R - B, -13, 27) then
                   if InRange(G - B, -22, 18) then
                     if InRange(Round(S) - Round(H), -107, -77) then
                       if InRange(Round(L) - Round(H), -56, -26) then
                         if InRange(Round(S) - Round(L), -66, -36) then
                           if InRange(Round(X) - Round(Y), -7, 7) then
                             if InRange(Round(Y) - Round(Z), -10, 4) then
                               if (SimilarColors(MyColor, GetColor(ColorsTPA[i].X + 1, ColorsTPA[i].Y + 1), 7)) then
                                if (SimilarColors(MyColor, GetColor(ColorsTPA[i].X - 1, ColorsTPA[i].Y - 1), 7)) then
                                 begin
                                   Result := TestColor;
                                   Writeln('Varrock Road Col = '+inttostr(testcolor)+'');
                                   Exit;
                                 end;

          end;
        end;
      end;
      Writeln('Couldnt find Varrock Road Color!');
      Result := 0;
    end;

    begin
      SetUpSRL;
    end.

    Compiles on Scar - Confirmed
    Compiles on Simba - NOT Confirmed

    Usage:

    FindColorsTolerance(FindFallyRoadColor, Tol = 15)

    I rewrote them without even testing the old ones. I last tested varrock a couple of months ago and it was broken and I confirmed that draynor was broken.
    Last edited by Camaro'; 09-19-2010 at 05:52 AM.

  2. #2
    Join Date
    Mar 2008
    Location
    In a cave
    Posts
    345
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    If you want those to get in the include, then better got them all optimized and combined...
    A Chinese wiseman once said: "Shu ciu!", it was considered very smart, but now people know it means: "Something stinks here!"
    FalBuggySmelter v.1.31
    [Updated on the 1st of March 2010]
    RimmBugger BETA V1.8

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

    Default

    Quote Originally Posted by bugger0001 View Post
    If you want those to get in the include, then better got them all optimized and combined...
    How would one combine these?

    I could care less if it makes it into the include, I thought this could help some people.

  4. #4
    Join Date
    Mar 2008
    Location
    In a cave
    Posts
    345
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    There are lots of options, but one could be made like this:
    Simba Code:
    Program New;
    {.include SRL/SRL.scar}

    Type TColorParams =
    Record
      name: String;
      myCol, Tolerance: integer;
      inRL: TIntegerArray;
      inRH: TIntegerArray;
    end;

    function SetUpColorParams(s: string): TColorParams;
    begin
      with Result do
      case s of
      'draynor': begin
                   name := 'Draynor';
                   myCol := 6975343;
                   tolerance := 8;
                   inRL := [-20, -15, -15, -30, 11, -56, -8, -7];
                   inRH := [ 20,  25,  25,   0, 41, -26,  6,  7];
                 end;
      'fally'  : begin
                   name := 'Falador';
                   myCol := 7766665;
                   tolerance := 6;
                   inRL := [-13, -1, -8, -19, 24, -58, -8, -4];
                   inRH := [ 27, 39, 32,  11, 54, -28,  6, 10];
                 end;
      'barb'   : begin
                   name := 'Barbarian';
                   myCol := 4284271;
                   tolerance := 5;
                   inRL := [-4, 26, 10,  0,  9, -24, -7, -2];
                   inRH := [36, 66, 50, 30, 39,   6,  7, 12];
                 end;
      'varrock': begin
                   name := 'Varrock';
                   myCol := 9078929;
                   tolerance := 7;
                   inRL := [-11, -13, -22, -107, -56, -66, -7, -10];
                   inRH := [ 29,  27,  18,  -77, -26, -36,  7,   4];
                 end;
      end;
    end;

    function FindCustomRoadColor(whichRoad: String): Integer;
    var
      R,G,B,TestColor : Integer;
      H,S,L : Extended;
      X,Y,Z : Extended;
      ColPars : TColorParams;
      ColorsTPA : TPointArray;
      C1 : TIntegerArray;
      i,C2: Integer;
    begin
      ColPars := SetUpColorParams(Lowercase(whichRoad));
      FindColorsSpiralTolerance(MMCX, MMCY, ColorsTPA, ColPars.myCol, MMX1, MMY1, MMX2, MMY2, 60);
      C1 := GetColors(ColorsTPA);
      C2 := High(C1);
      for i := 0 to C2 do
        begin
          if RS_OnMinimap(ColorsTPA[i].X, ColorsTPA[i].Y) then
          begin
            TestColor := GetColor(ColorsTPA[i].X, ColorsTPA[i].Y);

            if SimilarColors(TestColor, ColPars.myCol, 40) then
            begin
               ColorToRGB(TestColor, R, G, B);
               ColorToHSL(TestColor, H, S, L);
               ColorToXYZ(TestColor, X, Y, Z);

               if InRange(R - G, ColPars.inRL[0], ColPars.inRH[0]) then
                 if InRange(R - B, ColPars.inRL[1], ColPars.inRH[1]) then
                   if InRange(G - B, ColPars.inRL[2], ColPars.inRH[2]) then
                     if InRange(Round(S) - Round(H), ColPars.inRL[3], ColPars.inRH[3]) then
                       if InRange(Round(L) - Round(H), ColPars.inRL[4], ColPars.inRH[4]) then
                         if InRange(Round(S) - Round(L), ColPars.inRL[5], ColPars.inRH[5]) then
                           if InRange(Round(X) - Round(Y), ColPars.inRL[6], ColPars.inRH[6]) then
                             if InRange(Round(Y) - Round(Z), ColPars.inRL[7], ColPars.inRH[7]) then
                               if (SimilarColors(ColPars.myCol, GetColor(ColorsTPA[i].X + 1, ColorsTPA[i].Y + 1), ColPars.tolerance)) then
                                if (SimilarColors(ColPars.myCol, GetColor(ColorsTPA[i].X - 1, ColorsTPA[i].Y - 1), ColPars.tolerance)) then
                                 begin
                                   Result := TestColor;
                                   Writeln(ColPars.name + ' Road Col = '+inttostr(testcolor)+'');
                                   Exit;
                                 end;

          end;
        end;
      end;
      Writeln('Couldnt find ' + ColPars.name + ' Road Color!');
      Result := 0;
    end;

    begin
      SetUpSRL;
    end.
    A Chinese wiseman once said: "Shu ciu!", it was considered very smart, but now people know it means: "Something stinks here!"
    FalBuggySmelter v.1.31
    [Updated on the 1st of March 2010]
    RimmBugger BETA V1.8

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

    Default

    Quote Originally Posted by bugger0001 View Post
    There are lots of options, but one could be made like this:
    Simba Code:
    Program New;
    {.include SRL/SRL.scar}

    Type TColorParams =
    Record
      name: String;
      myCol, Tolerance: integer;
      inRL: TIntegerArray;
      inRH: TIntegerArray;
    end;

    function SetUpColorParams(s: string): TColorParams;
    begin
      with Result do
      case s of
      'draynor': begin
                   name := 'Draynor';
                   myCol := 6975343;
                   tolerance := 8;
                   inRL := [-20, -15, -15, -30, 11, -56, -8, -7];
                   inRH := [ 20,  25,  25,   0, 41, -26,  6,  7];
                 end;
      'fally'  : begin
                   name := 'Falador';
                   myCol := 7766665;
                   tolerance := 6;
                   inRL := [-13, -1, -8, -19, 24, -58, -8, -4];
                   inRH := [ 27, 39, 32,  11, 54, -28,  6, 10];
                 end;
      'barb'   : begin
                   name := 'Barbarian';
                   myCol := 4284271;
                   tolerance := 5;
                   inRL := [-4, 26, 10,  0,  9, -24, -7, -2];
                   inRH := [36, 66, 50, 30, 39,   6,  7, 12];
                 end;
      'varrock': begin
                   name := 'Varrock';
                   myCol := 9078929;
                   tolerance := 7;
                   inRL := [-11, -13, -22, -107, -56, -66, -7, -10];
                   inRH := [ 29,  27,  18,  -77, -26, -36,  7,   4];
                 end;
      end;
    end;

    function FindCustomRoadColor(whichRoad: String): Integer;
    var
      R,G,B,TestColor : Integer;
      H,S,L : Extended;
      X,Y,Z : Extended;
      ColPars : TColorParams;
      ColorsTPA : TPointArray;
      C1 : TIntegerArray;
      i,C2: Integer;
    begin
      ColPars := SetUpColorParams(Lowercase(whichRoad));
      FindColorsSpiralTolerance(MMCX, MMCY, ColorsTPA, ColPars.myCol, MMX1, MMY1, MMX2, MMY2, 60);
      C1 := GetColors(ColorsTPA);
      C2 := High(C1);
      for i := 0 to C2 do
        begin
          if RS_OnMinimap(ColorsTPA[i].X, ColorsTPA[i].Y) then
          begin
            TestColor := GetColor(ColorsTPA[i].X, ColorsTPA[i].Y);

            if SimilarColors(TestColor, ColPars.myCol, 40) then
            begin
               ColorToRGB(TestColor, R, G, B);
               ColorToHSL(TestColor, H, S, L);
               ColorToXYZ(TestColor, X, Y, Z);

               if InRange(R - G, ColPars.inRL[0], ColPars.inRH[0]) then
                 if InRange(R - B, ColPars.inRL[1], ColPars.inRH[1]) then
                   if InRange(G - B, ColPars.inRL[2], ColPars.inRH[2]) then
                     if InRange(Round(S) - Round(H), ColPars.inRL[3], ColPars.inRH[3]) then
                       if InRange(Round(L) - Round(H), ColPars.inRL[4], ColPars.inRH[4]) then
                         if InRange(Round(S) - Round(L), ColPars.inRL[5], ColPars.inRH[5]) then
                           if InRange(Round(X) - Round(Y), ColPars.inRL[6], ColPars.inRH[6]) then
                             if InRange(Round(Y) - Round(Z), ColPars.inRL[7], ColPars.inRH[7]) then
                               if (SimilarColors(ColPars.myCol, GetColor(ColorsTPA[i].X + 1, ColorsTPA[i].Y + 1), ColPars.tolerance)) then
                                if (SimilarColors(ColPars.myCol, GetColor(ColorsTPA[i].X - 1, ColorsTPA[i].Y - 1), ColPars.tolerance)) then
                                 begin
                                   Result := TestColor;
                                   Writeln(ColPars.name + ' Road Col = '+inttostr(testcolor)+'');
                                   Exit;
                                 end;

          end;
        end;
      end;
      Writeln('Couldnt find ' + ColPars.name + ' Road Color!');
      Result := 0;
    end;

    begin
      SetUpSRL;
    end.
    Thats all nifty and cool and all, but I still think it won't be added to SRL either way.

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

    Default

    Er.... SRL already has these?

    http://villavu.com/repositories/srl-...AutoColor.scar

    Simba Code:
    const
      srl_AutoColorCount   = 13;
        srl_VarrockRoadColor   = 0;
        srl_LumbridgeRoadColor = 1;
        srl_FaladorRoadColor   = 2;
        srl_AlKharidRoadColor  = 3;
        srl_DarkDirtRoadColor  = 4;
        srl_LightDirtRoadColor = 5;
        srl_SandColor          = 6;
        srl_WaterColor         = 7;
        srl_SwampWaterColor    = 8;
        srl_LadderColor        = 9;
        srl_RockColor          = 10;
        srl_MineRockColor      = 11;
        srl_TreeColor          = 12;

    ~RM

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

  7. #7
    Join Date
    Oct 2006
    Location
    finland, helsinki
    Posts
    2,501
    Mentioned
    3 Post(s)
    Quoted
    2 Post(s)

    Default

    Last time i tested finding varrock road color didn't work..

    Code:
    • Narcle: I recall Jukka releasing a bunch of scripts like this before... Its how he rolls I think. rofl
    • Solarwind: Dude, you are like... t3h s3x.
    • Hy71194: JuKKa you're a machine! You released 3 scripts in 10 minutes! :O
    • benjaa: woah.... Jukka is the man Guildminer pwns all
    • NaumanAkhlaQ: And JuKKa Is my Her0!

  8. #8
    Join Date
    Mar 2008
    Location
    In a cave
    Posts
    345
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Apparently, I must admit I haven't used SRL's auto-coloring for quite some time and the last time I did, it certainly was not converted to current system. Anyways, good to know
    A Chinese wiseman once said: "Shu ciu!", it was considered very smart, but now people know it means: "Something stinks here!"
    FalBuggySmelter v.1.31
    [Updated on the 1st of March 2010]
    RimmBugger BETA V1.8

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

    Default

    Quote Originally Posted by JuKKa View Post
    Last time i tested finding varrock road color didn't work..
    Using the new system?
    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

  10. #10
    Join Date
    Mar 2007
    Posts
    3,116
    Mentioned
    0 Post(s)
    Quoted
    2 Post(s)

    Default

    The new system hasn't worked for me ever, but I know I already made a thread about this

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

    Default

    Yeah, maybe it was an update which killed it. Because I can't seem to get it working on my end also?

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

    Default

    Sooo?

  13. #13
    Join Date
    Mar 2008
    Location
    In a cave
    Posts
    345
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Camaro, do you still have the original list of colors you picked to make your auto-coloring functions? If you do, then maybe developers could just replace the SRL's colors arrays with your colors. Should probably do the trick as SRL's auto-coloring seems to be very universal and should find all the needed mods itself.
    A Chinese wiseman once said: "Shu ciu!", it was considered very smart, but now people know it means: "Something stinks here!"
    FalBuggySmelter v.1.31
    [Updated on the 1st of March 2010]
    RimmBugger BETA V1.8

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

    Default

    Quote Originally Posted by bugger0001 View Post
    Camaro, do you still have the original list of colors you picked to make your auto-coloring functions? If you do, then maybe developers could just replace the SRL's colors arrays with your colors. Should probably do the trick as SRL's auto-coloring seems to be very universal and should find all the needed mods itself.
    I thought I saved them, but it turns out I didn't. That was the best color though.

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
  •