+ Reply to Thread
Results 1 to 11 of 11

Thread: Varrock East Mine

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

    Default Varrock East Mine

    Here's something to start this project. Unfortunately Flag doesn't work correctly, and therefore I'm having trouble in scripting but this should be enough to walk from the bank to the mine (in theory)
    This is a very rough core to the walking and is not very accurate nor fast yet.
    SCAR Code:
    // NEW MSI_FLAG, REPLACE THE OLD ONE IN Walking_Reflection!!
    procedure MSI_Flag(FlagDist: integer);
    begin
      if WaitFunc(@IsMoving, 1, 2500 + random(200)) then
        while (IsMoving or FlagPresent) do
        begin
          FFlag(FlagDist);
          if (FlagDistance <= FlagDist) then
            Break;
        end;
    end;

    procedure MSI_MouseFlag(X, Y, RX, RY, FlagDist: integer);
    begin
      if rs_OnMinimap(X, Y) then
      begin
        Mouse(X, Y, RX, RY, True);
        MSI_Flag(FlagDist);
      end;
    end;

    function MSI_FindMine(var X, Y: integer): boolean;
    var
      TPA: TPointArray;
      ATPA: T2DPointArray;
    begin
      if FindMMColorsSpiralTolerance(TPA, FindStoneColor, 0) then
      begin
        ATPA := SplitTPA(TPA, 20);
        SortATPASize(ATPA, True);
        MiddleTPAEx(ATPA[0], X, Y);
        Result := True;
      end else
        Result := FindSymbol(X, Y, 'mine');
    end;

    function Walk_VEM(Step: byte): boolean;
    var
      T, A, Ac, X, Y: Integer;
    begin
      A := Round(rs_GetCompassAngleDegrees);
      MakeCompass('N');
     
      case Step of
        1:
          begin
            Ac := FindNewVarrockRoadColor;
            for T := 0 to 5 do
              if RadialWalkTolerance(Ac, 75, 45, 70, -1, 1, T) then
                break;
            if (T > 5) then
            begin
              writeLn('FAILSAFE[1]');
              Mouse(665, 51, 5, 5, True);
            end;
            MSI_Flag(15);
            Result := True;
          end;
       
        2:
          begin
            MSI_MouseFlag(MMCX + 65, MMCY, 5, 5, 10);
            Result := True;
          end;
         
        3:
          begin
            Ac := FindNewVarrockRoadColor;
            for T := 0 to 5 do
              if RadialWalkTolerance(Ac, 160, 90, 70, -1, -1, T) then
                break;
            if (T > 5) then
            begin
              writeLn('FAILSAFE[3]');
              Mouse(669, 134, 5, 5, True);
            end;
            MSI_Flag(10);
            Result := True;
          end;
         
        4:
          begin
            Ac := FindNewVarrockRoadColor;
            for T := 0 to 5 do
              if RadialWalkTolerance(Ac, 160, 200, 70, -1, -1, T) then
                break;
            if (T > 5) then
            begin
              writeLn('FAILSAFE[3]');
              Mouse(639, 142, 5, 5, True);
            end;
            MSI_Flag(15);
            Result := True;
          end;

        5:
          begin
            Ac := FindNewVarrockRoadColor;
            for T := 0 to 5 do
              if RadialWalkTolerance(Ac, 160, 200, 70, -1, -1, T) then
                break;
            if (T > 5) then
            begin
              writeLn('FAILSAFE[3]');
              Mouse(627, 128, 5, 5, True);
            end;
            MSI_Flag(15);
            Result := True;
          end;
         
        6:
          begin
            if not RadialWalkTolerance(Ac, 160, 200, 70, -1, -1, 15) then
              MSI_MouseFlag(626, 138, 3, 3, 10);
            Result := True;
          end;
         
        7:
          begin
            if MSI_FindMine(X, Y) then
            begin
              MSI_MouseFlag(X, Y, 0, 0, 0);
              Result := True;
            end;
          end;
      end;
    end;
    Note that FindMine ohly uses symbol atm because FindStoneColor is broken.
    I'd also like if someone moved MSI_FindMMLocation() from Walking_Reflection to Walking_Color



    About VEM project

    We should/will be using SRL's FindObjRock. It uses TAutoColorInfo which is the best possible way of finding rocks. Get them updated please!
    This really shouldn't take more than a week or two to get implemented, since we have the mainloop and all the other crucial things done already! All we need is walking and mining which both are easy beefs.
    Last edited by marpis; 02-24-2010 at 08:17 PM.

  2. #2
    Join Date
    Apr 2008
    Location
    Marquette, MI
    Posts
    15,252
    Mentioned
    138 Post(s)
    Quoted
    680 Post(s)

    Default

    Updated MSI_Flag and moved FindMMLocation.

    I thought we were going to release the Woodcutter first, and then work on the next script. That way, the other members can do most of the work.

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

    Default

    Quote Originally Posted by Coh3n View Post
    Updated MSI_Flag and moved FindMMLocation.

    I thought we were going to release the Woodcutter first, and then work on the next script. That way, the other members can do most of the work.
    I thought now that woodcutter doesn't need that many people to work on, those who have extra time could on work this project
    And believe me, other members won't be doing most of the work...

  4. #4
    Join Date
    Feb 2007
    Location
    Alberta,Canada
    Posts
    2,358
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    I'm down. We should do varrock west mine too, the walking is really easy for it (just follow the white line).

    I had a private VEM/VWM that never got released/properly finished. I could go find it and see what parts we can use/what worked well on it (all i made was walking for both of them).

    edit: @Coh3n's post below.

    Considering we're making all these functions to make MSI work. Why not focus our attentions to finally fixing SRL's skills.scar stuff. example: we move all our MSI stuff to the include for woodcutting.scar so it's usable again. The autocolor stuff gets moved to autocolor.scar or whatever. I think it would be cool if we fixed the includes and taught people to use them again.
    Last edited by Blumblebee; 02-24-2010 at 09:27 PM.
    “Ignorance, the root and the stem of every evil.”

  5. #5
    Join Date
    Apr 2008
    Location
    Marquette, MI
    Posts
    15,252
    Mentioned
    138 Post(s)
    Quoted
    680 Post(s)

    Default

    Quote Originally Posted by marpis View Post
    I thought now that woodcutter doesn't need that many people to work on, those who have extra time could on work this project
    You're right, BUT I think it would be better to make the Woodcutter really good and functioning 100% before we move on. I'm not saying it will happen, but it wouldn't be good if we start doing too much. I would rather have someone tweaking the Woodcutter to make it work better, than moving on to the next project.

    For example, the banking needs a lot of work, whether we make our own, or the SRL functions get updated. Either way, I think that should be the priority right now, know what I mean?

    I think once that part is done, we should release it so more people can test and give feedback. Then, we can have other members/us work on the Miner while we can still make the necessary tweaks to the Woodcutter.

  6. #6
    Join Date
    Oct 2007
    Location
    #srl
    Posts
    6,102
    Mentioned
    39 Post(s)
    Quoted
    62 Post(s)

    Default

    Quote Originally Posted by Coh3n View Post
    You're right, BUT I think it would be better to make the Woodcutter really good and functioning 100% before we move on. I'm not saying it will happen, but it wouldn't be good if we start doing too much. I would rather have someone tweaking the Woodcutter to make it work better, than moving on to the next project.

    For example, the banking needs a lot of work, whether we make our own, or the SRL functions get updated. Either way, I think that should be the priority right now, know what I mean?

    I think once that part is done, we should release it so more people can test and give feedback. Then, we can have other members/us work on the Miner while we can still make the necessary tweaks to the Woodcutter.
    What is Wrong with the banking? I can fix that.

    Also, for the VEM walking, I had one that was simply a loop finding the road color until it found the mining symbol and that worked great. ( it had other fail safes ofcourse )
    Last edited by NCDS; 02-24-2010 at 10:25 PM.

  7. #7
    Join Date
    Feb 2007
    Location
    Alberta,Canada
    Posts
    2,358
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    There is a lot of useless functions. This is really old, but I think some of it might be useful. I love doing walking so I could try to write some new walking for stuff if thats cool anyways yeah, there it is:

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

    var GPS: array [1..5] of TPoint;
    var Path: Function(Paths: TBooleanArray): Boolean; SetPath: array [0..1] of TbooleanArray;
    var SymbolColor: Integer;

    Function MidPoint(x1, x2: Integer): Integer;
    begin
      Result := ((x1+x2)/2);
    end;

    const
      VEM_Mine = 0;
      VEM_Bank = 1;
      VWM_Mine = 2;
      VWM_Bank = 3;
     
      Cross_Split = 0;
     
      Failsafe = 0;

    Function IsRun(): Boolean;
    begin
      Result := GetColor(724, 112) = 6806252;
    end;

    Function NoRun(): Boolean;
    var x, y: Integer;
    begin
      Result := FindColor(x, y, 255, 735, 106, 760, 121);
    end;

    Procedure SetRunEx();
    begin
      if not IsRun then
        if not NoRun then
      SetRun(True);
    end;

    type
      TACInfo = record
        Colour, Tol, Width, Height, Count, CTS: Integer;
        HueMod, SatMod: Extended;
      end;
     
    const
      SRLAC_RoadColour = 0;
      SRLAC_VarrockRoadColour = 1;
      SRLAC_FallyRoadColour = 2;
      SRLAC_LumbyRoadColour = 3;
      SRLAC_DirtRoadColour = 4;
      SRLAC_WaterColour = 5;
      SRLAC_SandColour = 6;

    Function SRL_GetACInfo(ACIndex: Integer): TACInfo; // New Autocolor.scar made by Blumblebee & ZephrysFury
    begin
      case ACIndex of
        SRLAC_RoadColour:
        with Result do
        begin
          Colour := 6579821;
          Tol := 10;
          Width := 2;
          Height := 2;
          Count := 3;
          CTS := 1;
        end;
        SRLAC_VarrockRoadColour:
        with Result do
        begin
          Colour := 8291719;
          HueMod := 0.55;
          SatMod := 0.16;
          Tol := 8;
          Width := 3;
          Height := 3;
          Count := 5;
          CTS := 2;
        end;
        SRLAC_FallyRoadColour:
        with Result do
        begin
          Colour := 7831173;
          Tol := 10;
          Width := 2;
          Height := 2;
          Count := 5;
          CTS := 1;
        end;
        SRLAC_LumbyRoadColour:
        with Result do
        begin
          Colour := 8225677;
          Tol := 10;
          Width := 2;
          Height := 2;
          Count := 5;
          CTS := 1;
        end;
        SRLAC_DirtRoadColour:
        with Result do
        begin
          Colour := 1853272;
          Tol := 5;
          Width := 2;
          Height := 2;
          Count := 5;
          CTS := 1;
        end;
        SRLAC_WaterColour:
        with Result do
        begin
          Colour := 10850700;
          Tol := 8;
          Width := 5;
          Height := 5;
          Count := 5;
          CTS := 1;
        end;
      end;
    end;

    Function GetMMPoints(tpa: TpointArray; width, height, count: Integer): TpointArray;
    var
      atpa: T2DpointArray; l, i, p: Integer;
    begin
      Atpa := TPAtoATPAEx(Tpa, width, height);
      for i := 0 to High(atpa) do
      begin
        if Length(atpa) > count then
        begin
          l := getarraylength(Result);
          SetArrayLength(Result, l+1);
          Result[l] := MiddleTpa(atpa[i]);
        end;
      end;
      if Length(result) = 0 then Exit;
      for i := 0 to High(Result) do
        if rs_OnMiniMap(result[i].x, result[i].y) then Inc(p);
      if p = 0 then SetArrayLength(Result, 0);
    end;

    Function SRL_AutoColour(ACIndex: Integer) : Integer;
    var TPA, Pts: TPointArray; tAC: TACInfo; t, i, ii: Integer; aCol, uCol, tCol: TIntegerArray;
    begin
      try
        tAC := SRL_GetACInfo(ACIndex);
        ColorToleranceSpeed(1);
        FindColorsSpiralTolerance(MMCX, MMCY, TPA, tAC.Colour, MMX1, MMY1, MMX2, MMY2, tAC.Tol);
        if (Length(TPA) <= 0) then Exit;

        Pts := GetMMPoints(TPA, tAC.Width, tAC.Height, tAC.Count);
        aCol := GetColors(Pts);
        uCol := aCol;
        ClearSameIntegers(aCol);
        SetLength(tCol, high(uCol)+1);
        for i := 0 to high(aCol) do
        begin
          for ii := 0 to high(uCol) do
          begin
            if aCol[i] = uCol[ii] then
              Inc(tCol[ii]);
          end;
        end;
        t := 0;
        for i := 0 to high(uCol) do
          if tCol[i] > tCol[t] then
            t := i;
        Result := uCol[t];
      except
      end;
    end;

    Function FindNewVarrockRoadColor: Integer;
    begin
      Result := SRL_AutoColour(SRLAC_VarrockRoadColour);
    end;

    Function GetSymbolArea(Color: Integer; Hue, Sat: Extended; Tol: Integer): TPointArray;
    var TPA: TPointArray; ATPA: T2DPointArray; P: TPoint; l, i: integer;
    begin
      ColorToleranceSpeed(2);
      SetColorSpeed2Modifiers(Hue, Sat);
      FindColorsSpiralTolerance(MMcx, MMcy, TPA, Color, MMx1, MMy1, MMx2, MMy2, Tol);
      ColorToleranceSpeed(1);
      SetColorSpeed2Modifiers(0.2, 0.2);
      if Length(TPA) <= 0 then Exit;
      ATPA := SplitTPAEx(TPA, 5, 5);
      for i := 0 to High(ATPA) do
      begin
        P := MiddleTPA(ATPA[i]);
        if rs_OnMiniMap(P.x,P.y) then
        begin
          l := getarraylength(Result);
          SetArrayLength(Result, l+1);
          Result[l] := P;
        end;
      end;
    end;

    Function CreateSymbolBox(TPA: TPointArray; TP: TPoint): TBox;
    var nTPA, oTPA: TPointArray;
    begin
      oTPA := TPA;
      if Length(oTPA) <= 0 then Exit;
      sortTPAFrom(oTPA, Point(TP.x, TP.y));
      FindColorsTolerance(nTPA, 65536, oTPA[0].x-7, oTPA[0].y-7, oTPA[0].x+7, oTPA[0].y+7, 10);
      if Length(nTPA) > 0 then
        Result := GetTPABounds(nTPA);
    end;

    Function FindUniqueColors(Col: Integer; rTPA: TPointArray; Area: TPoint): Integer;
    var SymBox: TBox; TPA: TPointArray; List1, List2, List3 : TIntegerArray; i, ii, Tol, L: integer;
    begin
      SymBox := CreateSymbolBox(rTPA, Area);
      FindColorsTolerance(TPA, 0, SymBox.x1, SymBox.y1, SymBox.x2, SymBox.y2, 225);
      List1 := GetColors(TPA);
      List2 := List1;
      ClearSameIntegers(List1);
      for i := 0 to High(List2) do
      begin
        for ii := 0 to High(List1) do
        begin
          if List1[ii] = List2[i] then
          begin
            L := getarraylength(List3);
            SetArrayLength(List3, L+1);
            List3[L] := List1[ii];
          end;
        end;
      end;
      Tol := 5;
      while Result = 0 do
      begin
        for i := 0 to High(List3) do
        begin
          if SimilarColors(List3[i], Col, Tol) then
          begin
            Result := List3[i];
            WriteLn('Unique Symbol Color = '+IntToStr(Result));
            Exit;
          end;
        end;
        IncEx(Tol, 1);
      end;
    end;

    Function GetUniqueSymbolColor(x, y: Integer; Color: Integer; Hue, Sat: Extended; Tol: Integer): Integer;
    begin
      Result := FindUniqueColors(Color, GetSymbolArea(Color, Hue, Sat, Tol), Point(x, y));
    end;

    Function GetMMTPA(x, y, color, width, height, tolerance: Integer): TpointArray;
    var tpa: TpointArray; atpa: T2DpointArray; l, i, p: Integer;
    begin
      FindColorsSpiralTolerance(x, y, tpa, color, MMx1, MMy1, MMx2, MMy2, tolerance);
      Atpa := TPAtoATPAEx(Tpa, width, height);
      for i := 0 to High(atpa) do
      begin
        if Length(atpa) > 5 then
        begin
          l := getarraylength(Result);
          SetArrayLength(Result, l+1);
          Result[l] := MiddleTpa(atpa[i]);
        end;
      end;
      if Length(result) = 0 then Exit;
      for i := 0 to High(Result) do
        if rs_OnMiniMap(result[i].x, result[i].y) then Inc(p);
      if p = 0 then SetArrayLength(Result, 0);
    end;

    Function ExaminePlayerFormation: Boolean;
    var TPA: TPointArray; ATPA: T2DPointArray; P: TPoint;
    begin
      FindColors(TPA, 16711422, MMx1, MMy1, MMx2, MMy2);
      if Length(TPA) <= 0 then Exit;
      ATPA := TPAtoATPAEx(TPA, 10, 10);
      if length(ATPA) <= 0 then Exit;
      SortATPASize(ATPA, True);
      P := MiddleTPA(ATPA[0]);
      Mouse(P.x, P.y, 5, 5, True);
      Wait(500+random(100));
      FFlag(0);
      Result := True;
    end;

    Function SetLandMarkRecord(Index: Integer): Boolean;
    var i, Q, x, y: Integer; MainPoint: TDTMPointDef; SubPoints: Array of TDTMPointDef; TempTDTM: TDTM;
    begin
      case Index of
        Cross_Split:
        begin
          SetArrayLength(SubPoints, 4);
          with MainPoint do
          begin
            x := 609;
            y := 49;
            AreaSize := 3;
            AreaShape := 0;
            Color := RoadColor;
            Tolerance := 8;
          end;
          SubPoints[0].x := 609;
          SubPoints[0].y := 49;
          SubPoints[1].x := 621;
          SubPoints[1].y := 18;
          SubPoints[2].x := 581;
          SubPoints[2].y := 49;
          SubPoints[3].x := 619;
          SubPoints[3].y := 71;
          for i := 0 to High(SubPoints) do
          begin
            SubPoints[i].Color := RoadColor;
            SubPoints[i].AreaSize := 3;
            SubPoints[i].AreaShape := 0;
            SubPoints[i].Tolerance := 8;
          end;
        end;
      end;
      TempTDTM.MainPoint := MainPoint;
      TempTDTM.SubPoints := SubPoints;
      Q := AddDTM(TempTDTM);
     
      Result := DTMRotated(Q, x, y, MMx1, MMy1, MMx2, MMy2);
      WriteLn('DTM['+IntToStr(Index)+'] Found. Point('+InTToStr(x)+', '+IntToStr(y)+');');
      Mouse(x-15, y, 5, 5, True);
      FFlag(10);
      FreeDTM(Q);
    end;

    Function CreateColorBox(Color: Integer): TBox;
    var TPA: TPointArray;
    begin
      FindColors(TPA, Color, MMx1, MMy1, MMx2, MMy2);
      if Length(TPA) <= 0 then Exit;
      Result := GetTPABounds(TPA);
    end;

    Function FindColorInBox(Color: Integer; Box: TBox): Boolean;
    var TPA: TPointArray; i: Integer;
    begin
      FindColorsTolerance(TPA, Color, Box.x1-5, Box.y1-5, Box.x2+5, Box.y2+5, 15);
      if Length(TPA) <= 0 then Exit;
      SortTPAFrom(TPA, Point(687, 50));
      for i := 0 to High(TPA) do
      begin
        if not rs_OnMiniMap(TPA[i].x, TPA[i].y) then continue;
        Mouse(TPA[i].x, TPA[i].y, 5, 5, True);
        Wait(750+random(450));
        if FlagPresent then
        begin
          FFlag(10);
          Result := True;
          Exit;
        end;
      end;
    end;

    Function RadialWalkExEx(TheColor, StartRadial, EndRadial, Radius, Xmod, Ymod: Integer): Boolean;
    var TPA: TPointArray; I: Integer;
    begin
      if RadialWalkEx(tpa, MMCX, MMCY, TheColor, 0, StartRadial, EndRadial, Radius) then
        for i := 0 to High(tpa) do
          if MFNF(tpa[i].x+Xmod, tpa[i].y+Ymod, 5, 5) then
      begin
        FFlag(10);
        Result := True;
        Exit;
      end;
    end;

    Function SetPathRecord(Index: Integer): Boolean;
    var TPA: TPointArray; i, x, y, DTM: Integer; modx, mody: Integer; P: TPoint; AreaBox: TBox;
    begin
      case Index of
        0:
        begin
          {TPA := GetMMTPA(MMx2, MMcy, FindRockColor, 5, 5, 5); // RoadColor
          if Length(TPA) <= 0 then Exit;
          SortTPAFrom(TPA, Point(690, 50));
          for i := 0 to High(TPA) do
          begin
            if not rs_OnMiniMap(TPA[i].x, TPA[i].y) then continue;
            Mouse(TPA[i].x-5, TPA[i].y+5, 5, 5, True);
            Wait(750+random(450));
            if FlagPresent then
            begin
              FFlag(10);
              Result := True;
              Exit;
            end;
          end;}

          Result := FindColorInBox(RoadColor, CreateColorBox(FindRockColor));
        end;
        1..5:
        begin
          case Index of
            1:
            begin
              Modx := 0;
              Mody := 8;
              RoadColor := FindNewVarrockRoadColor;
            end;
            2:
            begin
              Modx := 4;
              Mody := -2;
            end;
            3: Mody := 4;
          end;
          TPA := GetMMTPA(MMcx, MMcy, RoadColor, 5, 5, 18);
          if Length(TPA) <= 1 then Exit;
          SortTPAFrom(TPA, Point(GPS[index].x, GPS[index].y));
          for i := 0 to High(TPA) do
          begin
            if not rs_OnMiniMap(TPA[i].x, TPA[i].y) then continue;
            Mouse(TPA[i].x+modx, TPA[i].y+mody, 5, 5, True);
            Wait(150+random(150));
            if FlagPresent then
            begin
              FFlag(10);
              if Index = 3 then
              begin
                Flag;
                Wait(550+random(550));
              end;
              Result := True;
              Exit;
            end;
          end;
        end;
        6:
        begin
          TPA := GetMMTPA(MMcx, MMy2-15, 2902389, 3, 3, 15);
          WriteLn('Length TPA = '+IntToStr(Length(TPA)));
          if Length(TPA) <= 0 then
          begin
            if Players[CurrentPlayer].Integers[Failsafe] > 1 then Exit;
            SetPathRecord(2);
            SetPathRecord(4);
            Inc(Players[CurrentPlayer].Integers[Failsafe]);
          end;
          SortTPAFrom(TPA, Point(600, 150));
          P := MiddleTPA(TPA);
          Mouse(P.x, P.y, 5, 5, True);
          wait(550+random(500));
          if FlagPresent then
          begin
            Flag;
            Result := True;
          end;
        end;
        7:
        begin
          WriteLn('Searching for Red Door profile');
          FindColorsTolerance(TPA, 328944, MMx1, MMy1, MMx2, MMy2, 15);
          if Length(TPA) <= 0 then Exit;
          SortTPAfrom(TPA, Point(MMx1, MMy1));
          for i := 0 to High(TPA) do
          begin
            Mouse(TPA[i].x+15, TPA[i].y, 3, 5, True);
            Wait(450+random(450));
            if FlagPresent then
            begin
              FFlag(10);
              Wait(750+random(750));
              Result := True;
              Exit;
            end;
          end;
        end;
        8:
        begin
          while i < 3 do
          begin
            if SetPathRecord(4) then
              inc(i);
          end;
          Result := SetLandMarkRecord(Cross_Split);
          Flag;
        end;
        9:
        begin
          DTM := DTMFromString('78DA63CC64666068676400016606083870E00' +
            '0C37F20CD08E533A60265FA203C98D89F3F4C0C5CC86A128950134B8' +
            '49A5CC26A002CF6102D');
          DTMRotated(DTM, x, y, MMx1, MMy1, MMx2, MMy2);
          FreeDTM(DTM);
          if ((x <> 0) and (y <> 0)) then
          begin
            Mouse(x, y, 5, 2, True);
            wait(500+Random(500));
            if FlagPresent then
            begin
              FFlag(0);
              Wait(750+random(750));
              Result := True;
              Exit;
            end;
          end;
        end;
        10:
        begin
          AreaBox.x1 := 500;
          AreaBox.y1 := 100;
          AreaBox.x2 := 600;
          AreaBox.y2 := 136;
          TPA := GetMMTPA(MMcx, MMcy, RoadColor, 3, 3, 10);
          if Length(TPA) <= 0 then Exit;
          SortTPAfrom(TPA, Point(635, 150));
          for i := 0 to High(TPA) do
          begin
            if PointInBox(Point(TPA[i].x, TPA[i].y), AreaBox) then continue;
            Mouse(TPA[i].x+15, TPA[i].y, 3, 5, True);
            Wait(450+random(450));
            if FlagPresent then
            begin
              FFlag(10);
              Wait(150+random(150));
              Result := True;
              Exit;
            end;
          end;
        end;
        11:
        begin
          TPA := GetMMTPA(MMcx, MMcy, RoadColor, 5, 5, 18);
          if Length(TPA) <= 1 then Exit;
          SortTPAFrom(TPA, Point(MMx1, MMy2));
          for i := 0 to High(TPA) do
          begin
            if not rs_OnMiniMap(TPA[i].x, TPA[i].y) then continue;
            Mouse(TPA[i].x+modx, TPA[i].y+mody, 5, 5, True);
            Wait(1050+random(550));
            if FlagPresent then
            begin
              FFlag(10);
              Result := True;
              Exit;
            end;
          end;
        end;
        12:
        begin
          FindColorsTolerance(TPA, 15397877, MMx1, MMy1, MMx2, MMy2, 20);
          if Length(TPA) <= 0 then Exit;
          SortTPAFrom(TPA, Point(MMcx, MMy2));
          for i := 0 to High(TPA) do
          begin
            if not rs_OnMiniMap(TPA[i].x, TPA[i].y) then continue;
            Mouse(TPA[i].x-10, TPA[i].y-3, 5, 5, True);
            Wait(150+random(150));
            if FlagPresent then
            begin
              FFlag(10);
              Result := True;
              Exit;
            end;
          end;
        end;
        13:
        begin
          //TPA := GetMMTPA(MMcx, MMy2-15, 2902389, 3, 3, 15);
          FindColorsTolerance(TPA, 2902389, MMx1, MMcy, MMx2, MMy2, 10);
          WriteLn('Length TPA = '+IntToStr(Length(TPA)));
          if Length(TPA) <= 0 then
          begin
            if Players[CurrentPlayer].Integers[Failsafe] > 1 then Exit;
            WriteLn('Insert Failsafes here');
            Inc(Players[CurrentPlayer].Integers[Failsafe]);
          end;
          SortTPAFrom(TPA, Point(600, 150));
          AreaBox := GetTPABounds(TPA);
          x := MidPoint(AreaBox.x1, Areabox.x2);
          y := MidPoint(AreaBox.y1, AreaBox.y2);
          Mouse(x, y, 5, 5, True);
          wait(550+random(500));
          if FlagPresent then
          begin
            Flag;
            Result := True;
          end;
        end;
        14:
        begin
          SymbolColor := GetUniqueSymbolColor(MMcx, MMcy, 7237742, 1.67, 0.06, 25);
          FindColors(TPA, SymbolColor, MMx1, MMy1, MMx2, MMy2);
          SortTPAFrom(TPA, Point(MMcx, MMcy));
          for i := 0 to High(TPA) do
          begin
            if not rs_OnMiniMap(TPA[i].x, TPA[i].y) then continue;
            Mouse(TPA[i].x, TPA[i].y, 5, 5, True);
            Wait(150+random(150));
            if FlagPresent then
            begin
              FFlag(10);
              Result := True;
              Exit;
            end;
          end;
        end;
        15:
        begin
          FindColorsTolerance(TPA, 15397877, MMx1, MMy1, MMx2, MMy2, 20);
          if Length(TPA) <= 0 then Exit;
          SortTPAFrom(TPA, Point(MMcx, MMy1));
          for i := 0 to High(TPA) do
          begin
            if not rs_OnMiniMap(TPA[i].x, TPA[i].y) then continue;
            Mouse(TPA[i].x-10, TPA[i].y+3, 5, 5, True);
            Wait(150+random(150));
            if FlagPresent then
            begin
              FFlag(10);
              Result := True;
              Exit;
            end;
          end;
        end;
        16:
        begin
          if not RadialWalkExEx(RoadColor, 330, 45, 70, 0, 0) then
            if not RadialWalkExEx(RoadColor, 320, 55, 70, 0, 0) then
               if not RadialWalkExEx(RoadColor, 300, 75, 70, 0, 0) then
          begin
            WriteLn('Could not Find Varrock Road');
            nextPlayer(False);
          end;
        end;
        17:
        begin
          DTM := DTMFromString('78DA639CC3CCC0A0C5C80002AC0C10D05AE9C' +
            'DB00C28C408E5337602D5D84378CC50B13F7F9818B81890D47401658' +
            'C8850A349841A45FC6A0004130DD8');
          Result := DTMRotated(DTM, x, y, MMx1, MMy1, MMx2, MMy2);
          FreeDTM(DTM);
          if Result then
          begin
            Mouse(x-7, y+10, 5, 5, True);
            Result := True;
            Players[CurrentPlayer].Active := True;
            Flag;
            Exit;
          end;
        end;
        18:
        begin
          while not ((FindColor(x, y, RoadColor, MMcx, MMy1, MMx2, MMcy)) and (i < 3)) do
          begin
            Result := SetPathRecord(15);
            Inc(i);
          end;
        end;
      end;
    end;

    Function CreatePath(Paths: Array of Boolean): Boolean;
    var i: Integer;
    begin
      WriteLn(' Walking Path, Path Length = '+IntToStr(Length(Paths))+' and original index = '+IntToStr(low(paths)));
      for i := 0 to High(Paths) do
      begin
        if not Paths[i] then
        begin
          NextPlayer(False);
          Exit;
        end;
      end;
      Result := True;
      WriteLn(' Path [0..'+IntToStr(High(Paths))+'] Concluded');
    end;

    Function ReEnterMine: Boolean;
    begin
      Result := SetPathRecord(14);
    end;

    begin
      SetUpSRL;
      ActivateClient;
      RoadColor := FindNewVarrockRoadColor;
      GPS[1].x := MMx2-7;
      GPS[1].y := MMcy+10;
      GPS[2].x := MMcx;
      GPS[2].y := MMy2-4;
      GPS[3].x := 650;
      GPS[3].y := 22;
      GPS[4].x := 625;
      GPS[4].y := 30;
      GPS[5].x := MMx1;
      GPS[5].y := MMcy;
      //SetPath[VEM_Mine] := [SetPathRecord(0), SetPathRecord(1), SetPathRecord(10), SetPathRecord(2), SetPathRecord(2), SetPathRecord(6)];
      //Wait(10000+Random(2000));
      SetPath[VEM_Bank] := [SetPathRecord(3), SetPathRecord(8), SetPathRecord(5), SetPathRecord(9)];
    //  SetPath[VWM_Mine] := [SetPathRecord(11), SetPathRecord(12), SetPathRecord(12), SetPathRecord(12), SetPathRecord(13)];
    //  Wait(10000);
    //SetPath[VWM_Bank] := [SetPathRecord(18), SetPathRecord(16), SetPathRecord(18)];
    end.
    “Ignorance, the root and the stem of every evil.”

  8. #8
    Join Date
    Feb 2006
    Location
    Tracy/Davis, California
    Posts
    12,631
    Mentioned
    135 Post(s)
    Quoted
    418 Post(s)

    Default

    Damn it, I'm making a VEM too blargh!

    Well if anyone cares, here is my walking, (no failsafes yet, but it works pretty well, just needs a few tweaks maybe). Not too commented or anything, so some portions might be ambiguous, so questions about anything that needs clarification.

    SCAR Code:
    Function VRC: TPoint;
    var
      arP: TPointArray;
      arC: TIntegerArray;
      {tmpCTS,}  i,  arL: Integer;
    begin
      //tmpCTS := GetColorToleranceSpeed;
      //ColorToleranceSpeed(2);
      //SetColorSpeed2Modifiers(16.49,  0.84);
      FindColorsSpiralTolerance(MMCX,  MMCY,  arP,  8619913,  MMX1,  MMY1,  MMX2,  MMY2,  15);
      if (Length(arP) = 0) then
      begin
        Writeln('Failed to find the color,  no result.');
        //ColorToleranceSpeed(tmpCTS);
        //SetColorSpeed2Modifiers(0.2,  0.2);
        Exit;
      end;
      arC := GetColors(arP);
      ClearSameIntegers(arC);
      arL := High(arC);
      for i := 0 to arL do
      begin
        If CountColor(Arc[i], MMX1, MMY1, MMX2, MMY2) > 100 Then
        Begin
          Result.x := arC[i];
          Writeln('AutoColor = ' + IntToStr(arC[i])+' px:'+IntToStr(CountColor(Arc[i], MMX1, MMY1, MMX2, MMY2)));
          Result.y:=CountColor(Arc[i], MMX1, MMY1, MMX2, MMY2);
          Break;
        End Else
         Continue;
      end;
      //ColorToleranceSpeed(tmpCTS);
      //SetColorSpeed2Modifiers(0.2,  0.2);
    end;

    Procedure WikiWa;
    Begin
      GitSum:=VRC;
    End;

    Function AtCrossRoad:Boolean;
    var
      arP: TPointArray;
      tmpCTS: Integer;
    Begin
      tmpCTS := GetColorToleranceSpeed;
      ColorToleranceSpeed(2);
      SetColorSpeed2Modifiers(16.49,  0.84);
      FindColorsSpiralTolerance(MMCX,  MMCY,  arP,  9013892,  MMX1,  MMY1,  597,  99,  3);
      If Length(arP)> 90 Then
      Begin
        Result:=True;
        DebugTPA(arP, '');
        Writeln('AtCross');
      End;
      ColorToleranceSpeed(tmpCTS);
      SetColorSpeed2Modifiers(0.2,  0.2);
    End;

    Procedure MiddleBank;
    var TreePts:TPointArray;
        TreePtsBox: T2DPointArray;
        MidBankPt: TPoint;
        Sex:Integer;
    Begin
      If Not(LoggedIn) Then Exit;
      StatsGuise('Searching BankMiddle');
      MarkTime(sex)
      ColorToleranceSpeed(2);
      SetColorSpeed2Modifiers(0.84,  2.04);
      FindColorsSpiralTolerance(MMCX, MMCY, TreePts, 3632972, MMX1,  MMY1,  MMX2,  MMY2,  2);
      SetColorSpeed2Modifiers(0.2, 0.2);
      ColorToleranceSpeed(1);
      TreePtsBox:= TPAtoATPAEx(TreePts, 60, 60);
      DebugATPA(TreePtsBox, '');
      MidBankPt:=MiddleTPA(TreePtsBox[0]);
      Mouse(MidBankPt.x, MidBankPt.y, 0, 0, True);
      Writeln('Found VEB Center: '+IntToStr(TimeFromMark(sex))+'ms');
      Flag(0);
      Wait(3000+Random(500));
    End;

    Function MineToBank:Boolean;
    var x, y, I:Integer;
    Begin
      WikiWa;
      RadialWalk(GitSum.x, 0, 90, 65, 1, 1) Wait(50); //NE Out Of Mine
      Flag(4);
      For I:=0 To 4 Do    //Northwards
      Begin
        WikiWa;
        RadialWalk(GitSum.x, 45, -45, 60, 1, 1) Wait(50);
        Flag(4);
        WikiWa;
        If AtCrossRoad And RadialWalk(GitSum.x, 135, 180, 65, 1, 1) Or(GitSum.Y > 800) Then  //At Crossraods /Top Left MM Road Pixels > 900
        Begin
          Flag(2);
          Break;
        End;
      End;
      For I:=0 To 3 Do
      Begin
        WikiWa;
        RadialWalk(GitSum.x, 150, 210, 40, 1, 1) Wait(10);//RadialWalk(GitSum.x, 240, 300, 40, 1, 1) Wait(10); //Walk Eastwards
        Flag(2);
        If FindSymbol(x, y, 'water') Or
           FindSymbol(x, y, 'bank') Then     //Stop When Visible
         Break;
      End;
      Wait(1000+Random(500));      //Stop Moving Completely for MiddleBank search
      MiddleBank;
      Result:=True;
    End;

    Function ISeeRocks:Boolean;
    var RockPts:TPointArray;
        RockPtMid:TPoint;
    Begin
      ColorToleranceSpeed(2);
      SetColorSpeed2Modifiers(0.23, 0.60);
      FindColorsSpiralTolerance(MMCX, MMCY, RockPts, 2903935, MMX1,  MMY1,  MMX2,  MMY2,  3);
      SetColorSpeed2Modifiers(0.2, 0.2);
      ColorToleranceSpeed(1);
      If GetArrayLength(RockPts) > 25 Then
      Begin
        Result:=True;
        Writeln('I see ' + IntToStr(GetArrayLength(RockPts)) + ' rock px');
        RockPtMid:=MiddleTPA(RockPts);
        Mouse(RockPtMid.x, RockPtMid.y, 2, 2, True);
        Flag;
      End;
    End;

    Function BankToMine:Boolean;
    var I, x, y:Integer;
    Begin
      WikiWa;
      RadialWalk(GitSum.x, 90, 0, 60, 1, 1);  //NE out of bank.
      Flag(4);
      For I:=0 To 2 Do
      Begin
        WikiWa;
        RadialWalk(GitSum.x, 120, 60, 60, 1, 1);   //Eastwards
        Flag(3);
        If RadialWalk(GitSum.x, 150, 210, 60, 1, 1) Then //If CanSouthWalk break
         Break
      End;
      For I:=0 To 4 Do
      Begin
        WikiWa;
        RadialWalk(GitSum.x, 150, 210, 60, 1, 1); //Continue Southwards
        Flag(3);
        If FindSymbol(x, y, 'mine') Then
        Begin
          Mouse(x, y, 5, 5, True);
          Result:=True;
          Break;
        End;
        If ISeeRocks Then Begin WriteLn('Found Rocks') Break; End;
      End;
    End;

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

    Default

    Guys, let's not try to recycle any code... write it fresh, with new inspiration and methods. It'll also feel better, cus no one will really want to just simply update your work, so you end up not being able to switch between "tasks".

    I agree with cohen actually, although I had first found it cool that you were already moving on to mining.

    MSI should represent quality over quantity. After all, having all the SRL Members possibly working on it and the fact that 8 great scripters already worked together for it is pretty much a good hint at quality, and that is a nice "brand image" to have for MSI.

    ~RM

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

  10. #10
    Join Date
    Feb 2006
    Location
    Tracy/Davis, California
    Posts
    12,631
    Mentioned
    135 Post(s)
    Quoted
    418 Post(s)

    Default

    :'( I was just showing you guys. Fresh is good.

  11. #11
    Join Date
    Feb 2007
    Location
    Alberta,Canada
    Posts
    2,358
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by Rasta Magician View Post
    I agree with cohen actually, although I had first found it cool that you were already moving on to mining.

    MSI should represent quality over quantity. After all, having all the SRL Members possibly working on it and the fact that 8 great scripters already worked together for it is pretty much a good hint at quality, and that is a nice "brand image" to have for MSI.

    ~RM
    agreed, however it would be cool to show a starting point (not an end result) of a new project. I guess we all jumped on this without the realization that the varrock east bank chopper thing wasn't full completed/working well.

    Quote Originally Posted by Rasta Magician View Post
    Guys, let's not try to recycle any code... write it fresh, with new inspiration and methods. It'll also feel better, cus no one will really want to just simply update your work, so you end up not being able to switch between "tasks".
    Quote Originally Posted by YoHoJo View Post
    :'( I was just showing you guys. Fresh is good.
    samsies It's not the fact that we (as in me and you) were saying use our code it's amazing, but it was more for the concepts and to build off of these concepts. If you see an idea you like but want better implementation, why not make a fresh coded version that is more impressive than that of the original?

    anyways, lets focus on the our woodcutting script before we get too into making this bad boy.
    “Ignorance, the root and the stem of every evil.”

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Tags for this Thread

Posting Permissions

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