Results 1 to 3 of 3

Thread: Walking feedback

  1. #1
    Join Date
    May 2007
    Location
    UK
    Posts
    4,007
    Mentioned
    1 Post(s)
    Quoted
    12 Post(s)

    Default Walking feedback

    Hi guys, I am making my ProWoodcutter, and I want some feedback on my walking, maybe someone could even test it!

    SCAR Code:
    function AutoColor: Integer;
    var
      arP: TPointArray;
      arC: TIntegerArray;
      tmpCTS, i, arL: Integer;
      H, S, L: Extended;
      X, Y, Z: Extended;
    begin
      tmpCTS := GetColorToleranceSpeed;
      ColorToleranceSpeed(1);

      FindColorsSpiralTolerance(MMCX, MMCY, arP, 5789018, MMX1, MMY1, MMX2, MMY2, 40);
      if (Length(arP) = 0) then
      begin
        Writeln('Failed to find the color, no result.');
        ColorToleranceSpeed(tmpCTS);
        Exit;
      end;

      arC := GetColors(arP);
      ClearSameIntegers(arC);
      arL := High(arC);

      for i := 0 to arL do
      begin
        ColorToHSL(arC[i], H, S, L);

        if (H >= 0.00) and (H <= 93.77) and (S >= 0.72) and (S <= 10.16) and (L >= 26.45) and (L <= 41.39) then
        begin
          ColorToXYZ(arC[i], X, Y, Z);

          if (X >= 5.35) and (X <= 14.18) and (Y >= 5.60) and (Y <= 13.46) and (Z >= 5.37) and (Z <= 17.49) then
          begin
            Result := arC[i];
            Writeln('AutoColor = ' + IntToStr(arC[i]));
            Break;
          end;
        end;
      end;

      ColorToleranceSpeed(tmpCTS);

      if (i = arL + 1) then
        Writeln('AutoColor failed in finding the color.');
    end;

    function WalkWillowRadial(XOffSet, YOffSet: Integer): TPoint;
    var
      TPA: TPointArray;
      i, CTS: Integer;
      ATPA: T2DPointArray;
      TB: TBox;

    begin
      CTS := GetColorToleranceSpeed;
      ColorToleranceSpeed(1);
      RadialWalkEx(TPA, MMCX, MMCY + 20, 1455939, 50, 200, 250, 50);
      if Length(TPA) = 0 then Exit;
      ATPA := SplitTPAEx(TPA, 20, 20);
      SortATPAFrom(ATPA, Point(MMCX, MMCY));
      TB := GetATPABounds(ATPA);
      for i := 0 to High(TPA) do
       if (PointInBox(TPA[i], TB)) then
       begin
         Result.x := ((TB.x1 + TB.x2) / 2) - XOffSet;
         Result.y := ((TB.y1 + TB.y2) / 2) - YOffSet;
         Break;
      end;
      ColorToleranceSpeed(CTS);
    end;

    function WalkToDB: Boolean;
    var
      x, y, i, Failsaves: Integer;
      TPA: TPointArray;
      ATPA: T2DPointArray;

    begin
      Failsaves := 1;
      Loads := Loads + 1;
      for i := 0 to Failsaves do
      begin
        case i of
        0:
          begin
          FindSymbol(X, Y, 'bank');
           Mouse(X, Y, 5, 5, True);
    DBDTM := DTMFromString('78DA636C67626008644001FFFFFD63F80FA41' +
                  '9416C2060AC01AAF182C8B140D5FCF9C304A619A17CB09A204C35' +
                  '22E86AC2F09B0300F8811153');
              if DTMRotated(DBDTM, x, y, MMX1, MMY1, MMX2, MMY2) then
              begin
                Result := True;
                Mouse(x, y, 3, 3, True);
                Flag;
                AntiRandom;
                Exit;
              end;
              begin
              FreeDTM(DBDTM);
            end;
          end;
        1:
          begin
            RadialWalkEx(TPA, MMCX, MMCY, 195836, 3, 360, 30, 30);
            if Length(TPA) = 0 then Exit;
            SortTPAFrom(TPA, Point(MMCX, MMCY));
            ATPA := SplitTPAEx(TPA, 10, 10);
            SortATPASize(ATPA, True);
            MiddleTPAEx(ATPA[0], x, y);
            Mouse(x, y, 3, 3, True);
            Result := True;
            AntiRandom;
            Flag;
            AntiRandom;
            Exit;
          end;
        end;
      end;

    function WalkToDWillows: boolean;
    var
      u,x,y,m: Integer;
      P: TPoint;

    begin
      if (not(loggedin)) then exit;
      U := findwatercolor;
      P := WalkWillowRadial(3, 3);
      if (PointSet(P)) then
      begin
        Result := True;
        Mouse(P.x, P.y, 3, 3, True);
        AntiRandom;
        Flag;
        Exit;
      end;
      if (DTMRotated(RockDTM, x, y, MMX1, MMY1, MMX2, MMY2)) then // Found DDTM
      begin
        Result := True;
        Mouse(x, y, 5, 5, True);
        AntiRandom;
        Flag;
        Wait(RandomRange(100, 500));
        Exit;
      end;
      if RadialWalk(AutoColor, 160, 200, 60, -10, -10) then
        Result := True
      else
      Result := RadialWalk(FindWaterColor, 260, 280, 40, 70, 5);
      if Result then
      begin
        AntiRandom;
        Exit;
      end;
      if Findsymbol(x,y,'fish') then
      begin
        M := GetColor(x - 20, y);
        if M = U Then
        begin
          Mouse(x,y,5,5, true);
          wait(250+random(250));
          FFlag(10);
          If Distance(mmcx,mmcy,x,y) < 7 then
          begin
            result := true;
            AntiRandom;
            Exit;
          end;
        end;
      end;
    end;

    Can you tell me:
    What I can do better.
    What won't work.
    Whats good.
    Whether it works.
    etc..

    Cheers
    T~M
    ====

  2. #2
    Join Date
    Aug 2008
    Location
    Finland
    Posts
    2,851
    Mentioned
    3 Post(s)
    Quoted
    2 Post(s)

    Default

    I am currently making a multi-location fighter that banks food, and i am going to make it walk with DDTMs only. Not a single RW. I think it's the most accurate and safe way to walk. Just remember to search for the dtm many times before resulting false, because there might be some player or npc walking on your subpoint.

    SCAR Code:
    // WRONG
    function WalkDDTM: boolean;
    var
      x, y: integer;
      tmp: extended;
    begin
      result := FindDTMRotated(MyDDTM, x, y, MMX1, MMY1, MMX2, MMY2, Radians(-45), Radians(45), Radians(2), tmp);
      if result then
        MouseFlag(x, y, 0, 0, 0);
    end;

    // RIGHT
    function WalkDDTM: boolean;
    var
      i, x, y: integer;
      tmp: extended;
    begin
      for i := 0 to 9 do
      begin
        result := FindDTMRotated(MyDDTM, x, y, MMX1, MMY1, MMX2, MMY2, Radians(-45), Radians(45), Radians(2), tmp);
        if result then
        begin
          MouseFlag(x, y, 0, 0, 0);
          break;
        end else
          wait(1500+random(500));
      end;
    end;

    Ok, your flaws:
    SCAR Code:
    if Findsymbol(x,y,'fish') then
      begin
        M := GetColor(x - 20, y);
        if M = U Then // i believe this always returns true also, why wouldn't it?
        begin
          Mouse(x,y,5,5, true);
          wait(250+random(250));
          FFlag(10);
          If Distance(mmcx,mmcy,x,y) < 7 then // this always results false, because x and y are static. you're not using reflection!
          begin
            result := true;
            AntiRandom;
            Exit;
          end;

    Good things:
    - you're using alot of failsafes, that's very very good!
    Last edited by marpis; 07-21-2009 at 01:32 AM.

  3. #3
    Join Date
    May 2007
    Location
    UK
    Posts
    4,007
    Mentioned
    1 Post(s)
    Quoted
    12 Post(s)

    Default

    Whats your msn?
    I think I need some help...

    T~M

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
  •