Results 1 to 11 of 11

Thread: FindWaterColor Fix

  1. #1
    Join Date
    Feb 2007
    Posts
    419
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default FindWaterColor Fix

    FindWaterColor is seriously flawed in Falador (probable due to the easter bunny update)

    by changing AutoColor (found under includes\SRL\SRL\core\AutoColor.scar) to this I've corrected most of the error
    SCAR Code:
    {*******************************************************************************
    function FindWaterColor: Integer;
    By: Tarajunky
    Description: Autodetects Water Color on Minimap
    *******************************************************************************}


    function FindWaterColor: Integer;
    var
      GC, a, l, TestColor, Red, Green, Blue : integer;
    var
      P:array of Tpoint;
    begin
      GC := 12095356;
      Flag;
      FindColorsSpiralTolerance(MMCX, MMCY, P, GC, MMX1, MMY1, MMX2, MMY2, 50);
      l:=GetArrayLength(P);
      for a:= 0 to l-1 do
      begin
        if rs_OnMinimap(P[a].x,P[a].y) then
        begin
          TestColor := GetColor(P[a].x,P[a].y);
          if SimilarColors(TestColor,GC,50) then
          begin
            ColorToRGB(TestColor,Red,Green,Blue);
            if InRange(Green - Red, 18, 30) then
              if InRange(Blue - Red, 55, 72) then
                if InRange(Blue - Green, 34, 52) then
                  if GetColor(P[a].x + 2, P[a].y + 2) = TestColor then
                    if GetColor(P[a].x + 1, P[a].y + 1) = TestColor then
                      if GetColor(P[a].x, P[a].y + 2) = TestColor then
                        if GetColor(P[a].x + 2, P[a].y) = TestColor then
                          if GetColor(P[a].x, P[a].y + 1) = TestColor then
                            if GetColor(P[a].x + 1, P[a].y) = TestColor then
                              if GetColor(P[a].x + 2, P[a].y + 1) = TestColor then
                                if GetColor(P[a].x + 1, P[a].y + 2) = TestColor then
                                begin
                                  Result := TestColor;
                                  WaterColor := TestColor;
                                  WriteLn('WaterColor = ' + IntToStr(TestColor));
                                  Exit;
                                end;
          end;
        end;
      end;
      WriteLn('Could not find Water Color!');
      Result := 0;
    end;

    FindFaladorRoadFix
    SCAR Code:
    {*******************************************************************************
    function FindFallyRoadColor: Integer;
    By: Tarajunky
    Description: Autodetects Falador Road Color on Minimap
    *******************************************************************************}


    function FindFallyRoadColor: Integer;
    var
      GC, a, l, TestColor, Red, Green, Blue : integer;
    var
      P:array of Tpoint;
    begin
      GC := 6187637;
      Flag;
      FindColorsSpiralTolerance(MMCX, MMCY, P, GC, MMX1, MMY1, MMX2, MMY2, 50);
      l:=GetArrayLength(P);
      for a:= 0 to l-1 do
      begin
        if rs_OnMinimap(P[a].x,P[a].y) then
        begin
          TestColor := GetColor(P[a].x,P[a].y);
          if SimilarColors(TestColor,GC,50) then
          begin
            ColorToRGB(TestColor,Red,Green,Blue);
            if InRange(Red - Blue, 18, 33)then
              if InRange(Red - Green, 0, 15) then
                if InRange(Green - Blue, 8, 30) then
                  if GetColor(P[a].x + 5, P[a].y + 5) = TestColor then
                    if GetColor(P[a].x + 3, P[a].y + 3) = TestColor then
                      if GetColor(P[a].x, P[a].y + 5) = TestColor then
                        if GetColor(P[a].x + 5, P[a].y) = TestColor then
                          if GetColor(P[a].x, P[a].y + 3) = TestColor then
                            if GetColor(P[a].x + 3, P[a].y) = TestColor then
                              if GetColor(P[a].x + 5, P[a].y + 3) = TestColor then
                                if GetColor(P[a].x + 3, P[a].y + 5) = TestColor then
                                begin
                                  Result := TestColor;
                                  WriteLn('Falador RoadColor = ' +
                                    IntToStr(TestColor));
                                  Exit;
                                end;
          end;
        end;
      end;
      WriteLn('Could not find Falador Road Color!');
      Result := 0;
    end;

  2. #2
    Join Date
    Dec 2006
    Location
    Sweden
    Posts
    10,812
    Mentioned
    3 Post(s)
    Quoted
    16 Post(s)

    Default

    It is messed up all over RS, like in Draynor.

    Thanks for t3h fix


    Send SMS messages using Simba
    Please do not send me a PM asking for help; I will not be able to help you! Post in a relevant thread or make your own! And always remember to search first!

  3. #3
    Join Date
    Oct 2006
    Posts
    702
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    i get a sytnax error in the findwatercolor
    "For it is not what goes into your mouth that will defile you; rather, it is what comes out of your mouth that defiles you." - Jesus of Nazareth

  4. #4
    Join Date
    Oct 2006
    Posts
    702
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    works perfect thanks man
    "For it is not what goes into your mouth that will defile you; rather, it is what comes out of your mouth that defiles you." - Jesus of Nazareth

  5. #5
    Join Date
    Feb 2007
    Posts
    419
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Sorry about the HTML, forgot about that when i moved it from my other post

  6. #6
    Join Date
    Nov 2006
    Location
    NSW, Australia
    Posts
    3,487
    Mentioned
    1 Post(s)
    Quoted
    0 Post(s)

    Default

    I already edited mine earlier today so I could use your script
    [CENTER][img]http://signatures.mylivesignature.com/54486/113/4539C8FAAF3EAB109A3CC1811EF0941B.png[/img][/CENTER]
    [CENTER][BANANA]TSN ~ Vacation! ~ says :I Love Santy[/BANANA][/CENTER]

    [CENTER][BANANA]Raymond - Oh rilie? says :Your smart[/BANANA][/CENTER]

  7. #7
    Join Date
    Dec 2006
    Location
    Minnesota
    Posts
    227
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Thanks for the fix, works great.

  8. #8
    Join Date
    Dec 2006
    Location
    Copy pastin to my C#
    Posts
    3,788
    Mentioned
    8 Post(s)
    Quoted
    29 Post(s)

    Default

    Yay, now I can use your script too

    By the way, in future post SRL fixes to the new Development section


    (Now I am running your script, works great )

  9. #9
    Join Date
    Feb 2006
    Location
    Amsterdam
    Posts
    13,692
    Mentioned
    146 Post(s)
    Quoted
    130 Post(s)

    Default

    This one is pretty fast and accurate, too:

    SCAR Code:
    Function w_GetWaterColor: Integer;

    Var
       x, y, z: Integer;

    Begin
      Result := -1;
      z := GetColorToleranceSpeed;
      ColorToleranceSpeed(2);
      If FindColoredAreaTolerance(x, y, 12161662, MMX1, MMY1, MMX2, MMY2, 10, 25) Then
        Result := GetColor(x, y)
      Else
      Begin
        WriteLn('Could not find water Color.');
        ColorToleranceSpeed(z);
        TerminateScript;
      End;
      ColorToleranceSpeed(z);
    End;

    It needs a 5x5 pixel box of water color.



    The best way to contact me is by email, which you can find on my website: http://wizzup.org
    I also get email notifications of private messages, though.

    Simba (on Twitter | Group on Villavu | Website | Stable/Unstable releases
    Documentation | Source | Simba Bug Tracker on Github and Villavu )


    My (Blog | Website)

  10. #10
    Join Date
    Jul 2007
    Location
    Norway.
    Posts
    1,938
    Mentioned
    3 Post(s)
    Quoted
    0 Post(s)

    Default

    I made my FindWaterColor like this combining both your functions:

    SCAR Code:
    function FindWaterColor2: Integer;
    var
      GC, a, l, TestColor, Red, Green, Blue : integer;
    var
      P:array of Tpoint;
    begin
      GC := 12095356;
      FFlag(0);
      FindColorsSpiralTolerance(MMCX, MMCY, P, GC, MMX1, MMY1, MMX2, MMY2, 50);
      l:=GetArrayLength(P);
      for a:= 0 to l-1 do
      begin
        if rs_OnMinimap(P[a].x,P[a].y) then
        begin
          TestColor := GetColor(P[a].x,P[a].y);
          if SimilarColors(TestColor,GC,50) then
          begin
            ColorToRGB(TestColor,Red,Green,Blue);
            if InRange(Green - Red, 18, 30) then
              if InRange(Blue - Red, 55, 72) then
                if InRange(Blue - Green, 34, 52) then
                  if GetColor(P[a].x + 2, P[a].y + 2) = TestColor then
                    if GetColor(P[a].x + 1, P[a].y + 1) = TestColor then
                      if GetColor(P[a].x, P[a].y + 2) = TestColor then
                        if GetColor(P[a].x + 2, P[a].y) = TestColor then
                          if GetColor(P[a].x, P[a].y + 1) = TestColor then
                            if GetColor(P[a].x + 1, P[a].y) = TestColor then
                              if GetColor(P[a].x + 2, P[a].y + 1) = TestColor then
                                if GetColor(P[a].x + 1, P[a].y + 2) = TestColor then
                                begin
                                  Result := TestColor;
                                  WaterColor := TestColor;
                                  WriteLn('WaterColor = ' + IntToStr(TestColor));
                                  Exit;
                                end;
          end;
        end;
      end;
      WriteLn('Could not find Water Color!');
      Result := 0;
    end;

    Function FindWaterColor: Integer;

    Var
       x, y, z: Integer;

    Begin
      Result := 0;
      z := GetColorToleranceSpeed;
      ColorToleranceSpeed(2);
      If FindColoredAreaTolerance(x, y, 12161662, MMX1, MMY1, MMX2, MMY2, 10, 25) Then
        Result := GetColor(x, y)
      Else
      Begin
        WriteLn('Could not find water Color.');
        ColorToleranceSpeed(z);
        Result := FindWaterColor2;
      End;
    End;

    Would this work slightly better than Wizzup?'s function alone? And did I do it correctly?

    Edit: Why is the autocoloring functions still using "Flag"? They should be changed to "FFlag(0)"'s!

    Edit2: FindRockColor is broken too.. Does someone have a fix?

  11. #11
    Join Date
    Dec 2006
    Location
    Copy pastin to my C#
    Posts
    3,788
    Mentioned
    8 Post(s)
    Quoted
    29 Post(s)

    Default

    What do you have agains Flag?

    FFlag maybe does some antiban, but it's a bit close to FF LAG...


    SCAR Code:
    Procedure n_FFlag(Dist: Integer);

    Var
       Sf: Integer;
       
    Begin
      If LoggedIn Then
      Begin
        Sf := GetSystemTime;
        While FlagDistance > Dist Do
          If GetSystemTime - Sf >= 20000 Then
            Break
          Else
            Wait(20);
      End;
    End;

    No lag

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. FindRoadColor; And FindWaterColor;
    By kingarabian in forum OSR Help
    Replies: 8
    Last Post: 04-03-2008, 08:41 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
  •