Results 1 to 8 of 8

Thread: why wont this find the color?

  1. #1
    Join Date
    May 2007
    Location
    in the forest
    Posts
    190
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default why wont this find the color?

    SCAR Code:
    function StoreAutoColor: Integer; //thanks to Scar Assistant
    var
      I, R, G, B, Len, TestColor: Integer;
      H, S, L, X, Y, Z: Extended;
      P: TPointArray;

    begin
      Result := -1;
      FFlag(0);
      FindColorsSpiralTolerance(MMCX, MMCY, P, 6447978, MMX1, MMY1, MMX2, MMY2, 60);
      Len := High(P);
      for I := 0 to Len do
        if RS_OnMinimap(P[I].X, P[I].Y) then
        begin
          TestColor := GetColor(P[I].X, P[I].Y);
          ColorToRGB(TestColor, R, G, B);
          if InRange(R - B, -12, 28) then
            if InRange(R - G, -13, 27) then
              if InRange(G - B, -19, 21) then
              begin
                ColorToHSL(TestColor, H, S, L);
                if InRange(Round(H - L), -53, -23) then
                  if InRange(Round(S - H), -13, 17) then
                    if InRange(Round(S - L), -51, -21) then
                    begin
                      ColorToXYZ(TestColor, X, Y, Z);
                      if InRange(Round(X - Y), -7, 7) then
                        if InRange(Round(Y - Z), -8, 6) then
                        begin
                          Result := TestColor;
                          Exit;
                        end;
                    end;
              end;
        end;
      WriteLn('Autocolor did not find the color.');
    end;

    function WalkToStoreAutoColor: Integer;
    var
      I, R, G, B, Len, TestColor: Integer;
      H, S, L, X, Y, Z: Extended;
      P: TPointArray;

    begin
      Result := -1;
      FFlag(0);
      FindColorsSpiralTolerance(MMCX, MMCY, P, 7435130, MMX1, MMY1, MMX2, MMY2, 60);
      Len := High(P);
      for I := 0 to Len do
        if RS_OnMinimap(P[I].X, P[I].Y) then
        begin
          TestColor := GetColor(P[I].X, P[I].Y);
          ColorToRGB(TestColor, R, G, B);
          if InRange(R - B, -11, 29) then
            if InRange(R - G, -13, 27) then
              if InRange(G - B, -18, 22) then
              begin
                ColorToHSL(TestColor, H, S, L);
                if InRange(Round(H - L), -57, -27) then
                  if InRange(Round(S - H), -15, 15) then
                    if InRange(Round(S - L), -57, -27) then
                    begin
                      ColorToXYZ(TestColor, X, Y, Z);
                      if InRange(Round(X - Y), -7, 7) then
                        if InRange(Round(Y - Z), -8, 6) then
                        begin
                          Result := TestColor;
                          Exit;
                        end;
                    end;
              end;
        end;
      WriteLn('Autocolor did not find the color.');
    end;


    function LoadAllDTMWalks(WalkNumber: Integer): Integer; //thanks to BoBBoHoBBo's guide to ddtm walking
    var                                                     // and thanks to EvilChicken! for making it work^^
      dtmMainPoint: TDTMPointDef;
      dtmSubPoints: array[0..4] of TDTMPointDef;
      TempTDTM: TDTM;
      Color: Integer;

    begin
      case WalkNumber of
        1: begin
          Color := WalkToStoreAutoColor;
          dtmMainPoint.x := 734;
          dtmMainPoint.y := 282;
          dtmMainPoint.Color := Color;

          dtmSubPoints[0].x := 734;
          dtmSubPoints[0].y := 282;
          dtmSubPoints[0].Color := Color;

          dtmSubPoints[1].x := 736;
          dtmSubPoints[1].y := 295;
          dtmSubPoints[1].AreaSize := 3;
          dtmSubPoints[1].Color := Color;

          dtmSubPoints[2].x := 734;
          dtmSubPoints[2].y := 271;
          dtmSubPoints[2].AreaSize := 2;
          dtmSubPoints[2].Color := Color;

          dtmSubPoints[3].x := 727;
          dtmSubPoints[3].y := 265;
          dtmSubPoints[3].AreaSize := 2;
          dtmSubPoints[3].Color := Color;

          dtmSubPoints[4].x := 729;
          dtmSubPoints[4].y := 260;
          dtmSubPoints[4].AreaSize := 3;
          dtmSubPoints[4].Color := Color;

          TempTDTM.MainPoint := dtmMainPoint;
          TempTDTM.SubPoints := dtmSubPoints;
          Result := AddDTM(TempTDTM);
        end;

        2: begin
          Color := StoreAutoColor;
          dtmMainPoint.x := 694;
          dtmMainPoint.y := 287;
          dtmMainPoint.Color := Color;

          dtmSubPoints[0].x := 694;
          dtmSubPoints[0].y := 287;
          dtmSubPoints[0].Color := Color;

          dtmSubPoints[1].x := 699;
          dtmSubPoints[1].y := 283;
          dtmSubPoints[1].Color := Color;

          dtmSubPoints[2].x := 701;
          dtmSubPoints[2].y := 290;
          dtmSubPoints[2].Color := Color;

          dtmSubPoints[3].x := 689;
          dtmSubPoints[3].y := 288;
          dtmSubPoints[3].Color := Color;

          dtmSubPoints[4].x := 696;
          dtmSubPoints[4].y := 277;
          dtmSubPoints[4].Color := Color

          TempTDTM.MainPoint := dtmMainPoint;
          TempTDTM.SubPoints := dtmSubPoints;
          Result := AddDTM(TempTDTM);
        end;
      end;
    end;

    function WalkToStore: Boolean;
    var
      WalkDTM: integer; // Calls the WalkDTM making walking simpler.
    begin
      WalkDTM := LoadAllDTMWalks(1); //Load which DDTM you want to find.
      if FindDTM(WalkDTM, X, Y, MMx1,MMy1,MMx2,MMy2) then // Find the DDTM using Find DTM
      begin
        Mouse(X, Y, 5, 5, True);
        WriteLn('point 1 found');
        FFlag(0);
        Result := True; // If succesfully finds it will click it and wait to flag is gone.
      end else
       if DTMRotated(WalkDTM, X, Y, MMX1, MMY1, MMX2, MMY2) then
         Begin
          Mouse(X, Y, 5, 5, True);
          WriteLn('point 1 FS done');
          FFlag(0);
          Result :=True;
         end else
          begin
           Result :=False
           Writeln(' FS Failed... abort');
           FreeDTM(WalkDTM);
          if not (Result) then
           begin
            Logout;
            Exit;
          end;
           end;
    end;

    this is autocolored using the scar assistant tool and the ddtm is from the ddtm maker by nielsie95, and I put it together using bobbohobbo's tut now the only problem is it cant find the colours ( i triend Findroadcolor before using the autocolour for the road too and still it just goes through and fails the failsafes, and logs out. Anythoughts?
    At sea with the navy - not very active

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

    Default

    Add tolerance to the subpoints.


  3. #3
    Join Date
    May 2007
    Location
    in the forest
    Posts
    190
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Ive tried using the method from the adding the (d) to (d)dtms tut but it didnt work for me like
    tol := tol + 1;
    repeat
    until
    tol > 25;

    any other thoughts of how to do that
    At sea with the navy - not very active

  4. #4
    Join Date
    Oct 2006
    Location
    ithurtsithurtsithurtsithurts
    Posts
    2,930
    Mentioned
    7 Post(s)
    Quoted
    135 Post(s)

    Default

    A couple things you can do. First, add tolerance to the variables you are setting, for example:
    SCAR Code:
    dtmMainPoint.Tolerance := 15;
    And second, you can try increasing the area size.

  5. #5
    Join Date
    May 2007
    Location
    in the forest
    Posts
    190
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    ty works now
    At sea with the navy - not very active

  6. #6
    Join Date
    Sep 2008
    Location
    Not here.
    Posts
    5,422
    Mentioned
    13 Post(s)
    Quoted
    242 Post(s)

    Default

    btw... you mainpoint should have a tolerance of 255...

  7. #7
    Join Date
    Oct 2006
    Location
    ithurtsithurtsithurtsithurts
    Posts
    2,930
    Mentioned
    7 Post(s)
    Quoted
    135 Post(s)

    Default

    Quote Originally Posted by mormonman View Post
    btw... you mainpoint should have a tolerance of 255...
    Eh, not always. I've had a couple DDTMs that would appear in multiple places if the mainpoint was set to 255 tolerance, but only one place with the tolerance set to a "reasonable" level.

  8. #8
    Join Date
    Sep 2008
    Location
    Not here.
    Posts
    5,422
    Mentioned
    13 Post(s)
    Quoted
    242 Post(s)

    Default

    ok yeah i guess it depends on the style of ddtm... if its a road then you don't want 255...

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. It wont find the furnace color plz help
    By Rouge_Ling in forum OSR Help
    Replies: 4
    Last Post: 05-11-2008, 09:47 AM
  2. Replies: 5
    Last Post: 07-31-2007, 07:23 PM
  3. FindColorTolerance Wont find color
    By x13om13e12x in forum OSR Help
    Replies: 2
    Last Post: 06-29-2007, 08:55 AM

Posting Permissions

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