Results 1 to 4 of 4

Thread: Error: Out Of Range at line

  1. #1
    Join Date
    Sep 2010
    Posts
    5,762
    Mentioned
    136 Post(s)
    Quoted
    2739 Post(s)

    Default Error: Out Of Range at line

    So I get this out of range error when ever I try to use smart for RS07

    Code:
    Error: Out Of Range at line 446
    and it opens up "login"

    Script to see if anyone else gets the error:

    Simba Code:
    {$I SRL-OSR/SRL.Simba}
    {$DEFINE SMART8}
    var
      // I apologize for the obnoxious amount of Globals in this script
      {Credits to @Flight(Mouse Functions),

      {*****************************Integers****************************}


      DTM_Log, Fletched, Seconds, XpPerHour, FletchPerHour, XPGained:Integer;
      DTM_Make, Knife, FSX1, FSY1, FSX2, FSY2, NFSX1, NFSY1, NFSX2, NFSY2:Integer;
      ClickCont, fx, fy, nfx, nfy, DTM_String, DTM_Close, StartTime, XPGet:Integer;
      X, Y, DX1, DY1, DX2, DY2,  DTM_Made:Integer;

      {*****************************Strings****************************}
      Method, Make, StoreMethod, LogUse, NameUse, Reason:String;
      MethodStr, LocationStr, Status, speed, logs:String;
    Procedure DeclarePlayers;
    Begin
      HowManyPlayers := 1;
      NumberOfPlayers(HowManyPlayers);
      CurrentPlayer := 0;

      Players[0].Name := '';       // Username
      Players[0].Pass := '';       // Password
      Players[0].WorldInfo  := []; // World, leave blank if random
      Players[0].Nick := '';       // Part of display name you need this for randoms
      Players[0].Active := True;
    End;
    Procedure SetupGlobals;
    begin
      Logs := 'logs';
      speed := 'fast';
      method := 'shaft';
      make := 'longs';
    end;
    Procedure BrakeWindMouse(xs, ys, xe, ye, gravity, wind, minWait, maxWait, targetArea: extended);
    var
      veloX,veloY,windX,windY,veloMag,dist,randomDist,lastDist,D: extended;
      lastX,lastY,MSP,W,TDist,T: integer;
      sqrt2,sqrt3,sqrt5,PDist,maxStep: extended;
    Begin
      MSP  := MouseSpeed;
      sqrt2:= sqrt(2);
      sqrt3:= sqrt(3);
      sqrt5:= sqrt(5);

      TDist := Distance(Round(xs), Round(ys), Round(xe), Round(ye));
      if (TDist < 1) then
        TDist := 1;
      MarkTime(T);
      repeat
        if (TimeFromMark(T)>5000) then
          break;

        dist:= hypot(xs - xe, ys - ye);
        wind:= minE(wind, dist);
        if (dist < 1) then
          dist := 1;
        PDist := (dist/TDist);
        if (PDist < 0.01) then
          PDist := 0.01;
        if (PDist >= 0.15) then
        Begin
          D := (Round((Round(dist)*0.3))/5);
          if (D < 20) then
            D := 20;
        end else if (PDist < 0.15) then
        Begin
          if ((PDist <= 0.15) and (PDist >= 0.10)) then
            D := RanDomRange(8, 13)
          else if (PDist < 0.10) then
            D := RanDomRange(4, 7);
        end;

        if (D <= Round(dist)) then
          maxStep := D
        else
          maxStep := Round(dist);

        if dist >= targetArea then
        Begin
          windX:= windX / sqrt3 + (random(round(wind) * 2 + 1) - wind) / sqrt5;
          windY:= windY / sqrt3 + (random(round(wind) * 2 + 1) - wind) / sqrt5;
        end else
        Begin
          windX:= windX / sqrt2;
          windY:= windY / sqrt2;
        End;

        veloX:= veloX + windX;
        veloY:= veloY + windY;
        veloX:= veloX + gravity * (xe - xs) / dist;
        veloY:= veloY + gravity * (ye - ys) / dist;

        if (hypot(veloX, veloY) > maxStep) then
        Begin
          randomDist:= maxStep / 2.0 + random(round(maxStep) div 2);
          veloMag:= sqrt(veloX * veloX + veloY * veloY);
          veloX:= (veloX / veloMag) * randomDist;
          veloY:= (veloY / veloMag) * randomDist;
        End;

        lastX:= Round(xs);
        lastY:= Round(ys);
        xs:= xs + veloX;
        ys:= ys + veloY;

        if (lastX <> Round(xs)) or (lastY <> Round(ys)) then
          MoveMouse(Round(xs), Round(ys));

        W := (RanDom((Round(100/MSP)))*6);
        if (W < 5) then
          W := 5;
        W := Round(W*1.2);
        wait(W);
        lastdist:= dist;
      until(hypot(xs - xe, ys - ye) < 1)

      if (Round(xe) <> Round(xs)) or (Round(ye) <> Round(ys)) then
        MMouse(Round(xe), Round(ye), 0, 0);

      MouseSpeed := MSP;
    End;
    Procedure BrakeMMouse(eX, eY, ranX, ranY: Integer);
      var
        randSpeed: extended;
        X,Y,MS: integer;
      Begin
        MS := MouseSpeed;
        randSpeed := (random(MouseSpeed) / 2.0 + MouseSpeed) / 10.0;
        GetMousePos(X, Y);
        BrakeWindMouse(X, Y, RanDomRange(eX-ranX, eX+ranX), RanDomRange(eY-ranY,eY+ranY), 8, 5, 10.0 / randSpeed, 15.0 / randSpeed, 10.0 * randSpeed);
        MouseSpeed := MS;
      End;
    Procedure SuperWindMouse(xs, ys, xe, ye, gravity, wind, minWait, maxWait, maxStep, targetArea: extended);
    Var
      veloX,veloY,windX,windY,veloMag,dist,randomDist,lastDist,step: extended;
      lastX,lastY,MSP,W: integer;
      sqrt2,sqrt3,sqrt5: extended;
    Begin
      MSP  := MouseSpeed;
      sqrt2:= sqrt(2);
      sqrt3:= sqrt(3);
      sqrt5:= sqrt(5);
      While hypot(xs - xe, ys - ye) > 1 Do
      Begin
        dist:= hypot(xs - xe, ys - ye);
        wind:= minE(wind, dist);
        If dist >= targetArea Then
        Begin
          windX:= windX / sqrt3 + (random(round(wind) * 2 + 1) - wind) / sqrt5;
          windY:= windY / sqrt3 + (random(round(wind) * 2 + 1) - wind) / sqrt5;
        End Else
        Begin
          windX:= windX / sqrt2;
          windY:= windY / sqrt2;
          If (maxStep < 3) Then
          Begin
            maxStep:= random(3) + 3.0;
          End Else
          Begin
            maxStep:= maxStep / sqrt5;
          End;
        End;
        veloX:= veloX + windX;
        veloY:= veloY + windY;
        veloX:= veloX + gravity * (xe - xs) / dist;
        veloY:= veloY + gravity * (ye - ys) / dist;
        if hypot(veloX, veloY) > maxStep then
        Begin
          randomDist:= maxStep / 2.0 + random(round(maxStep) div 2);
          veloMag:= sqrt(veloX * veloX + veloY * veloY);
          veloX:= (veloX / veloMag) * randomDist;
          veloY:= (veloY / veloMag) * randomDist;
        End;
        lastX:= Round(xs);
        lastY:= Round(ys);
        xs:= xs + veloX;
        ys:= ys + veloY;

        Case RanDom(50) Of
          1..25: W := (MSP + (RanDom((MSP/4))));
          26..50: W := (MSP - (RanDomRange((MSP/2), MSP-1)));
        End;
        If (W < 1) Then
          W := 1;

        If (lastX <> Round(xs)) Or (lastY <> Round(ys)) Then
          MoveMouse(Round(xs), Round(ys));

        step:= hypot(xs - lastX, ys - lastY);
        wait(W);
        lastdist:= dist;
      End;

      If (Round(xe) <> Round(xs)) or (Round(ye) <> Round(ys)) Then
        MoveMouse(Round(xe), Round(ye));

      MouseSpeed := MSP;
    End;

    Procedure HumanMMouse(eX, eY, ranX, ranY: Integer);
    Var
      randSpeed: extended;
      X,Y,X2,Y2,j,Dist,MP: integer;
    Begin
      j := MouseSpeed;
      GetMousePos(X, Y);
      Dist := Distance(X, Y, eX, eY);
      MP := Round(Dist/150);
      If MP < 0 Then
        MP := 1;

      randSpeed := (random(MouseSpeed) / 2.0 + MouseSpeed) / 10.0;
      X2 := RanDomRange(eX-(j*MP), eX+(j*MP));
      Y2 := RanDomRange(eY-(j*MP), eY+(j*MP));
    SuperWindMouse(X, Y, X2, Y2, 11, 8, 10.0 / randSpeed, 12.0 / randSpeed, 10.0 * randSpeed, 10.0 * randSpeed);
      GetMousePos(X, Y);
      MMouse(eX, eY, ranX, ranY);
      MouseSpeed := j;
    End;
    Procedure HumanMoveSlowFletchN;
    Begin
      Case random(200) of
        1..160:   BrakeMMouse(RandomRange(nfX - 9, nfX + 9), RandomRange(nfy - 9, nfy + 9), 0, 0);
        161..190: BrakeMMouse(RandomRange(nfX - 12, nfX + 12), RandomRange(nfy - 12, nfy + 12), 0, 0);
        191..200: BrakeMMouse(RandomRange(nfX - 15, nfX + 15), RandomRange(nfy - 15, nfy + 15), 0, 0);
      End;
    End;
    Procedure HumanMoveFletchN;
    Begin
      Case random(200) of
         1..160:  HumanMMouse(RandomRange(nfX - 9, nfX + 9), RandomRange(nfy - 9, nfy + 9), 0, 0);
        161..190: HumanMMouse(RandomRange(nfX - 12, nfX + 12), RandomRange(nfy - 12, nfy + 12), 0, 0);
        191..200: HumanMMouse(RandomRange(nfX - 15, nfX + 15), RandomRange(nfy - 15, nfy + 15), 0, 0);
      End;
    End;
    Procedure HumanMoveSlowFletch;
    Begin
      Case random(200) of
        1..160:   BrakeMMouse(RandomRange(fX - 9, fX + 9), RandomRange(fy - 9, fy + 9), 0, 0);
        161..190: BrakeMMouse(RandomRange(fX - 12, fX + 12), RandomRange(fy - 12, fy + 12), 0, 0);
        191..200: BrakeMMouse(RandomRange(fX - 15, fX + 15), RandomRange(fy - 15, fy + 15), 0, 0);
      End;
    End;
    Procedure HumanMoveFletch;
    Begin
      Case random(200) of
         1..160:  HumanMMouse(RandomRange(fX - 9, fX + 9), RandomRange(fy - 9, fy + 9), 0, 0);
        161..190: HumanMMouse(RandomRange(fX - 12, fX + 12), RandomRange(fy - 12, fy + 12), 0, 0);
        191..200: HumanMMouse(RandomRange(fX - 15, fX + 15), RandomRange(fy - 15, fy + 15), 0, 0);
      End;
    End;
    Procedure HumanMoveSlowOff;
    Begin
      Case random(200) of
        1..160:   BrakeMMouse(RandomRange(X - 8, X + 8), RandomRange(y - 8, y + 8), 0, 0);
        161..190: BrakeMMouse(RandomRange(X - 10, X + 10), RandomRange(y - 10, y + 10), 0, 0);
        191..200: BrakeMMouse(RandomRange(X - 12, X + 12), RandomRange(y - 12, y + 12), 0, 0);
      End;
    End;
    Procedure HumanMoveOff;
    Begin
      Case random(200) of
        1..160:   HumanMMouse(RandomRange(X - 8, X + 8), RandomRange(y - 8, y + 8), 0, 0);
        161..190: HumanMMouse(RandomRange(X - 10, X + 10), RandomRange(y - 10, y + 10), 0, 0);
        191..200: HumanMMouse(RandomRange(X - 12, X + 12), RandomRange(y - 12, y + 12), 0, 0);
      End;
    End;
    Procedure HumanMoveSlow;
    Begin
      Case random(200) of
        1..160:   BrakeMMouse(RandomRange(X - 6, X + 6), RandomRange(y - 5, y + 5), 0, 0);
        161..190: BrakeMMouse(RandomRange(X - 8, X + 8), RandomRange(y - 7, y + 7), 0, 0);
        191..200: BrakeMMouse(RandomRange(X - 10, X + 10), RandomRange(y - 10, y + 10), 0, 0);
      End;
    End;
    Procedure HumanMove;
    Begin
      Case random(200) of
        1..160:   HumanMMouse(RandomRange(X - 5, X + 5), RanDomRange(y - 5, y + 5), 0, 0);
        161..190: HumanMMouse(RandomRange(X - 7, X + 7), RanDomRange(y - 7, y + 7), 0, 0);
        191..200: HumanMMouse(RandomRange(X - 10, X + 10), RanDomRange(y - 10, y + 10), 0, 0);
      End;
    End;
    Procedure SlowWait;
    Begin
      Case random(1000) of
        1..860:    Wait(RandomRange(500, 800));
        861..975:  Wait(RandomRange(600, 900));
        976..1000: Wait(RandomRange(700, 1500));
      End;
    End;
    Procedure FastWait;
    Begin
      Case random(1000) of
        1..860:    Wait(RandomRange(100, 400));
        861..975:  Wait(RandomRange(300, 600));
        976..1000: Wait(RandomRange(100, 800));
      End;
    End;
    Procedure RanDomBankWait;
    Begin
      Case random(1000) of
        1..700:    Wait(RandomRange(300, 1000));
        701..900:  Wait(RandomRange(400, 1500));
        901..1000: Wait(RandomRange(500, 3000));
      End;
    End;
    Procedure RandomChooseWait;
    Begin
      Case random(1000) of
        1..860:    Wait(RandomRange(200, 500));
        861..975:  Wait(RandomRange(300, 600));
        976..1000: Wait(RandomRange(400, 1000));
      End;
    End;
    Procedure RandomRightClick;
    Begin
      Case random(150) of
        1..2: clickmouse2(mouse_Right);
      End;
    End;
    Procedure RanDomLeftClick;
    Begin
      Case random(150) of
        1..3: clickmouse2(mouse_Left);
      End;
    End;
    Procedure RandomMouseFletchN;
    Begin
      Case random(101) of
        1..95:   HumanMoveSlowFletchN;
        96..101: HumanMoveFletchN;
      End;
    End;
    Procedure RandomMouseFletch;
    Begin
      Case random(101) of
        1..95:   HumanMoveSlowFletch;
        96..101: HumanMoveFletch;
      End;
    End;
    Procedure RandomMouseOff;
    Begin
      Case random(101) of
        1..95:  HumanMoveOff;
        96..101: HumanMoveSlowOff;
      End;
    End;
    Procedure RandomMouse;
    Begin
      Case random(101) of
        1..95:  HumanMove;
        96..101: HumanMoveSlow;
      End;
    End;
    function OpenReportFile(): integer;
    var
      fileName,Bot_SavePath: string;
    begin

      Bot_SavePath := 'C:/Simba/'
      if (not directoryExists(Bot_SavePath)) then
        forceDirectories(Bot_SavePath);

      fileName := 'Fletcher Log.txt';
      fileName := Bot_SavePath + fileName;

      try
        if (fileExists(fileName)) then
          result := appendFile(fileName)
        else
          result := createFile(fileName);
      except
        writeln('OpenSRLLogFile: '+exceptionToString(exceptionType, exceptionParam));
      end;
    end;
    procedure AddReport(s: string);
    var
      tmpFile: integer;
    begin
      writeln(s);

      tmpFile := OpenReportFile();

      if (tmpFile >= 0) then
        try
         writeFileString(tmpFile, '['+msToTime(getTimeRunning(), TIME_BARE)+']: '+s+#13+#10);
        except
          Writeln('Error writing File');
        finally
          closeFile(tmpFile);
        end;
    end;
    Procedure FreeTheDTMs;
    Begin
      FreeDTM(DTM_Log);
      FreeDTM(DTM_Close);
      FreeDTM(Knife);
      FreeBitmap(ClickCont);
      Writeln('report any bugs, to the thread!');
      AddReport('---------------------------------------------');
    End;
    Procedure PrintError;
    Begin
      Writeln('The script has stopped due to an error, if this is a bug then please report')
      Writeln('it on the script thread, the script automatically logged you out for safety purposes')
      Writeln('Error:' + Reason +'.')
    End;
    Procedure WriteProgress;
    Begin
      Seconds := (1 + ((Getsystemtime - StartTime) / 1000));
      XpPerHour := (3600 * XPGained) / (Seconds);
      FletchPerHour := (3600 * Fletched) / Seconds;

      ClearDebug;
      Writeln('*************************');
      Writeln('Time Running:' + TimeRunning + '');
      Writeln('Status:' + Status + '');
      //Writeln('' + MethodStr + 'Fletched' + IntToStr(Fletched) + '' );
      //WriteLn('' + MethodStr + 'Per Hour: ' + IntToStr(ItemsPerHour) + '');
      //Writeln('XP Gained:' + IntToStr(XpGained) + '');
      //writeLn('Fletching XP/H: ' + IntToStr(XpPerHour) + '');
      Writeln('*************************');
    End;
    Procedure FailSafeLogOut;
    Begin
      if FindColorTolerance(X, Y, 3691124, 626, 468, 658, 500, 15) then
      Begin
        RanDomMouse;
        clickmouse2(mouse_Left);
        Wait(RanDomRange(700, 2000));
        if FindColorTolerance(X, Y, 1974666, 572, 363, 708, 390, 15) then
        Begin
          AddReport('Logging out');
          RanDomMouse;
          clickmouse2(mouse_Left);
          Wait(RanDomRange(700, 2000));
        End;
      End;
    End;
    Procedure ToInventory;
    Begin
      X := 645;
      Y := 184;
      HumanMMouse(RandomRange(X - 5, X + 5), RandomRange(y - 5, y + 5), 0, 0);
      FastWait;
      clickmouse2(mouse_Left);
    End;
    Procedure CheckFreinds;
    Begin
      if FindColorTolerance(X, Y, 2341117, 563, 468, 592, 501, 10) then
      Begin
        AddReport('Checking Freinds');
        RanDomMouse;
        FastWait;
        clickmouse2(mouse_Left);
        Wait(RanDomRange(500, 2000));
      End;
    End;
    Procedure CheckFletching;
    Begin
      if FindColorTolerance(X, Y, 4819266, 559, 169, 594, 199, 10) then
      Begin
        RanDomMouse;
        FastWait;
        clickmouse2(mouse_Left);
        Wait(RanDomRange(200, 500));
        if FindColorTolerance(X, Y, 605562, 612, 363, 671, 391, 10) then
        Begin
          AddReport('Checking Fletching');
          RanDomMouse;
          Wait(RanDomRange(1500, 3500));
          ToInventory;
        End;
      End;
    End;
    Procedure AntiBan;
    Begin
      Case Random(100) of
        1: CheckFreinds;
        2: CheckFletching;
      End;
    End;
    function IsBankUp(): boolean;
    var
       Count: Integer;
    Begin
      Result := false;
      Count := CountColorTolerance(2070783, 183, 34, 336, 48, 15);
      If (Count>200) Then
      Begin
        Result := true;
      End;
    End;
    Procedure CloseBankHuman;
    Begin
      if FindDTM(DTM_Close, x, y, 473, 30, 500, 53)  Then
      Begin
        AddReport('Starting CloseBank Procedure');
        RandomMouse;
        FastWait;
        clickmouse2(mouse_Left);
        RandomBankWait;
        If IsBankUp Then
        Begin
          AddReport('Finished CloseBank Procedure');
          CloseBank;
          Exit;
        End;
      End;
    End;
    Procedure WithDrawHumanString;
    Begin
      if BankScreen then
      Begin
        if FindDTM(DTM_String, x, y, 22, 57, 464, 288)  Then
        Begin
          AddReport('Withdrawing strings');
          RandomMouse;
          FastWait;
          clickmouse2(mouse_Right);
          RandomChooseWait;
          ChooseOptionMulti(['ithdraw All','thdraw All']);
          RandomBankWait;
        End;
      End;
    End;
    Procedure WithDrawHumanBow;
    Begin
      if FindDTM(DTM_Made, x, y, 47, 60, 462, 272) then
      Begin
        AddReport('Withdrawing bows via');
        RandomMouse;
        FastWait;
        clickmouse2(mouse_Right);
        RandomChooseWait;
        ChooseOptionMulti(['ithdraw All','thdraw All']);
        RandomBankWait;
      End;
    End;
    Procedure WithDrawHuman;
    Begin
      if FindDTM(DTM_Log, x, y, 47, 60, 462, 272) then
      Begin
        AddReport('Withdrawing logs');
        RanDomMouse;
        FastWait;
        clickmouse2(mouse_Right);
        RanDomChooseWait;
        ChooseOptionMulti(['ithdraw All','thdraw All']);
        RanDomBankWait;
      End;
    End;
    Procedure MouseToRandomBow;
    Begin
      RandomMouseOff;
    End;
    Procedure Deposite;
    Begin
      Case LowerCase(StoreMethod) of
        'notshafts':
          Begin
              MouseToRandomBow;
              FastWait;
              clickmouse2(mouse_Right);
              RanDomChooseWait;
              ChooseOptionMulti(['tore Al','ore All']);
              RandomBankWait;
          End;
        'shafts':
          Begin
            Case random(100) of
            1..90:
            Begin
              Wait(RandomRange(0, 100));
            End;
            91..100:
            Begin
              if FindDTM(DTM_Made, x, y, 554, 209, 738, 468) then
              Begin
                AddReport('Starting storage method');
                RandomMouse;
                clickmouse2(mouse_Right);
                RandomChooseWait;
                ChooseOptionMulti(['tore Al','ore All']);
                RanDomBankWait;
                IncEx(XPGained, XPGet*27);
              End;
            End;
          End;
        End;
      End;
    End;
    Procedure SetDepositeInts;
    Begin
      Case random(100) of
        1..4:
        Begin
          X := 621;
          Y := 227;
          Exit;
        End;
        5..6:
        Begin
          X := 661;
          Y := 225;
          Exit;
        End;
        7..82:
        Begin
          X := 578;
          Y := 263;
          Exit;
        End;
        83..96:
        Begin
          X := 619;
          Y := 261;
          Exit;
        End;
        97..100:
        Begin
          X := 661;
          Y := 262;
          Exit;
        End;
      End;
    End;
    function Bank: Boolean;
    var
      i, CTS, Timeout: Integer;
      TPA, TPA1, TPA2: TPointArray;
      ATPA: T2DPointArray;
      P: TPoint;
    Begin
      Result := False;
      CTS := GetColorToleranceSpeed;
      ColorToleranceSpeed(2);
      Timeout := 5000 + RanDom(1000);
      SetColorSpeed2Modifiers(0.00, 0.00);
      FindColorsTolerance(TPA1, 5599869, DX1, DY1, DX2, DY2, 2);
      SetColorSpeed2Modifiers(0.06, 0.27);
      FindColorsTolerance(TPA2, 6847372, DX1, DY1, DX2, DY2, 12);
      SetColorSpeed2Modifiers(0.2, 0.2);
      ColorToleranceSpeed(CTS);
      CombineTPAWrap(TPA1, TPA2, TPA);
      SplitTPAWrap(TPA, 5, ATPA);
      SortATPASize(ATPA, True);
      if Length(TPA) < 1 then
        Exit;
      for i := 0 to High(ATPA) Do
        if Length(ATPA[i]) > 30 then
        Begin
          P := MiddleTPA(ATPA[i]);
          HumanMMouse(P.X, P.Y, RandomRange( - 5, 5), RandomRange( - 5, 5));
          if (IsUpTextMultiCustom(['Use', 'Bank', 'ooth'])) then
          Begin
           Case random(100) of
              1..90:
                Begin
                  AddReport('Banking [left click]');
                  Status := 'Banking' + LogUse + '.';
                  WriteProgress;
                  RandomLeftClick;
                  clickmouse2(mouse_left);
                  RanDomBankWait;
                  While (IsMoving) Do
                  FastWait;
                  If Not IsBankUp Then
                  Begin
                    Bank;
                  End;
                 Exit;
                End;
              91..100:
                Begin
                  AddReport('Banking [Right click]');
                  Status := 'Banking' + LogUse + '.';
                  WriteProgress;
                  RandomLeftClick;
                  clickmouse2(mouse_Right);
                  Wait(RandomRange(100, 700));
                  RandomBankWait;
                  ChooseOptionMulti(['Use','use']);
                  While (IsMoving) Do
                  FastWait;
                  If Not IsBankUp Then
                  Begin
                    Bank;
                  End;
                 Exit;
                End;
            End;
            Exit;
        End;
      End;
    End;
    function HasStrings(): boolean;
    var
       X, Y: Integer;
    Begin
      Result := false;
       if FindDTM(DTM_String, x, y, 549, 202, 741, 467) then
      Begin
        Result := true;
      End;
    End;
    function InputReady(): boolean;
    var
       Count: Integer;
    Begin
      Result := false;
      Count := CountColorTolerance(0, 212, 393, 305, 409, 15);
      If (Count>200) Then
      Begin
        Result := true;
      End;
    End;
    function InterfaceReady(): boolean;
    var
       Count: Integer;
    Begin
      Result := false;
      Count := CountColorTolerance(128, 134, 353, 373, 393, 15);
      If (Count>200) Then
      Begin
        Result := true;
      End;
    End;
    function StringReady(): boolean;
    var
       Count: Integer;
    Begin
      Result := false;
      Count := CountColorTolerance(128, 137, 361, 381, 379, 15);
      If (Count>200) Then
      Begin
        Result := true;
      End;
    End;
    function HasLogs(): boolean;
    var
       X, Y: Integer;
    Begin
      Result := false;
       if FindDTM(DTM_Log, x, y, 549, 202, 741, 467) then
      Begin
        Result := true;
      End;
    End;
    function ContainsUpLevel(): boolean;
    var
       X, Y: Integer;
    Begin
      Result := false;
       if FindBitMapToleranceIn(ClickCont, x, y, 190, 424, 378, 461,120) then
      Begin
        Result := true;
      End;
    End;
    Procedure WithDrawCorrect;
    Begin
      Bank;
      RandomChooseWait;
      Deposit(1,28,True);
      RandomChooseWait;
      if FindDTM(DTM_Made, x, y, 16, 23, 502, 327) then
      Begin
        AddReport('Withdrawing correct string amounts');
        RanDomMouse;
        FastWait;
        clickmouse2(mouse_Right);
        RandomChooseWait;
        ChooseOptionMulti(['Withdraw X','ithdraw X']);
        RandomChooseWait;
        TypeSend('14');
        RanDomChooseWait;
        RanDomChooseWait;
        if FindDTM(DTM_String, x, y, 16, 23, 502, 327) then
        Begin
          RanDomMouse;
          FastWait;
          clickmouse2(mouse_Right);
          FastWait;
          ChooseOptionMulti(['Withdraw X','ithdraw X']);
          Wait(RandomRange(900, 1700));
          TypeSend('14');
          Wait(RandomRange(900, 1700));
        End;
      End;
    End;
    Procedure StringAll;
    Begin
      X := 257;
      Y := 417;
      AddReport('Stringing all bows');
      RandomMouse;
      FastWait;
      clickmouse2(mouse_Right);
      RanDomChooseWait;
      ChooseOptionMulti(['Make Al','ake All']);
      RanDomChooseWait;
    End;
    Procedure MouseToBow;
    Begin
     if Not FindDTM(DTM_String, x, y, 604, 316, 682, 354) Then
     Begin
       WithDrawCorrect;
       CloseBankHuman;
       RanDomChooseWait;
     End;
     if FindDTM(DTM_String, x, y, 604, 316, 682, 354) and
     FindDTM(DTM_Made, x, y, 604, 316, 682, 354)  Then
     Begin
       RanDomMouse;
       FastWait;
       clickmouse2(mouse_Left);
       FastWait;
       if FindDTM(DTM_String, x, y, 604, 316, 682, 354) Then
       Begin
         RanDomMouse;
         FastWait;
         clickmouse2(mouse_Left);
         SlowWait;
       End;
     End;
    End;
    Procedure ChooseMethod;
    Var
      RandIHigh,RandILow:Integer;
      HighR,LowR:String;
    Begin
      Case LowerCase(LogUse) of
        'logs':
          Begin
              if InterfaceReady Then
              Begin
                AddReport('Starting Fletching method');
                RanDomMouseFletchN;
                clickmouse2(mouse_Right);
                RanDomChooseWait;
                ChooseOptionMulti(['ake x','Make X']);
                SlowWait;
                RandIHigh := RanDomRange(347,84372)
                RandILow := RanDomRange(28,100)
                HighR := IntToStr(RandIHigh)
                LowR := IntToStr(RandILow)
                If Not InputReady Then
                Begin
                  FastWait;
                  If Not InputReady Then
                  Begin
                    Exit;
                  End;
                End;
                Case random(100) of
                  1:       TypeSend(''+HighR+'');
                  2:       TypeSend(''+LowR);
                  3..98:   TypeSend('27');
                  99..100: TypeSend('54');
                End;
              End;
             Exit;
            End;
         // End;
        'other':
          Begin
            if InterfaceReady Then
              Begin
                AddReport('Starting Fletching method');
                RanDomMouseFletch;
                RanDomChooseWait;
                clickmouse2(mouse_Right);
                RanDomChooseWait;
                ChooseOptionMulti(['ake x','Make X']);
                SlowWait;
                RandIHigh := RanDomRange(347,84372)
                RandILow := RanDomRange(28,100)
                HighR := IntToStr(RandIHigh)
                LowR := IntToStr(RandILow)
                If Not InputReady Then
                Begin
                  FastWait;
                  If Not InputReady Then
                  Begin
                    Exit;
                  End;
                End;
                Case random(100) of
                  1:       TypeSend(''+HighR+'');
                  2:       TypeSend(''+LowR);
                  3..98:   TypeSend('27');
                  99..100: TypeSend('54');
                End;
              End;
             Exit;
            End;
          End;
    End;
    Procedure RandomFletch;
    Begin
      Case random(50) of
        1..3:
        Begin
          if FindDTM(DTM_Log, X, Y, 549, 202, 741, 467) then
          Begin
            AddReport('Clicking log to fletch[case 1 of 3]');
            RandomMouse;
            FastWait;
            clickmouse2(mouse_Left);
            FastWait;
            if FindDTM(Knife, X, Y, 555, 205, 604, 249) then
            Begin
              randomMouse;
              FastWait;
              clickmouse2(mouse_Left);
              FastWait;
            End;
          End;
        End;
        4..50:
        Begin
          AddReport('Clicking log to fletch[case 4 of 50]');
          if FindDTM(DTM_Log, X, Y, MIX1, MIY1, MIX2, MIY2) and
          FindDTM(Knife, X, Y, MIX1, MIY1, MIX2, MIY2) then
          Begin
            randomMouse;
            FastWait;
            clickmouse2(mouse_Left);
            FastWait;
            if FindDTM(DTM_Log, x, y, MIX1, MIY1, MIX2, MIY2) then
            Begin
              randomMouse;
              FastWait;
              clickmouse2(mouse_Left);
              FastWait;
            End;
          End;
        End;
      End;
    End;
    Procedure LoadDTMS;
    Begin
      AddReport('------RJJ95 FLETCHER VERSION 1.1------');
      AddReport('Loading DTMs');
      Knife := DTMFromString('mQwAAAHicY2ZgYHBiYmCwA2JXIH4M5L8C4ntAXF1cxBBhw8lQWVjAIAjkwzAjEgYCACQIBwc=');
      DTM_String := DTMFromString('mQwAAAHicY2ZgYMhiYmBIBOIiIC5lZGDIB+IGIG4uj2AoSPMBqmBk4AeSMMyIhIEAAOpZBVM=');
      DTM_Close := DTMFromString('mbQAAAHicY2VgYHjKyMDwBoifAfFdKK3BAMFKQKwJxIYMIMDIkBLuyFCQ6MbQVp3BEOJpzsAPFEXHjFgwGAAA6SkJ8g==');
      ClickCont := BitmapFromString(121, 5, 'meJyNlUFuwlAMRHP/RTcVUkVZ9B' +
      'SRoAHBrqgFpb1Q6mTCZDLfiZAs5O/Yjv2+Hbqq2hy+u6rqBgWCI2T' +
      '7+WMWuoXEU0h/bNoQi30/tpaTUfShonZaIkMIn27Pd/UZc85frRVq' +
      'nW/1V9nOWLwYX+trHOPX3/JIZXatNjUy/4pCT9Nz2k1bevaoBwh6F' +
      '0Z1d/kjTHv6cfqdIM9FKUW4QQMr/L7spygATBvUSdN5QB61T61JSJ' +
      'kK4ZY2VRBo4enMKPb0pWl3BpatAXvP+XjjXqgPR87eOx5xs03Lo02' +
      'Fklzhgy1Ir4CNGOoSIHUUnGJRILb+z6AGH8tpcAw1CadXYGLZtBFM' +
      'OAhPXzYpUlGso14aS7VbI+tTrT0u7YIqXKhQQspLScN1qeHMrdfPM' +
      'j2VA44Yckuu/wW6GijMxkADUUnZIPdFnQ17OQzPfIv+AfiVTIA=');
    End;
    Procedure ConductBot;
    Var
      TimeOut:Integer;
    Begin
      If (Not LoggedIn) Then
      Begin
        LogInPlayer;
        ConductBot;
        Exit;
      End;
      TimeOut := 0;
      Case LowerCase(Method) of
        'shaft':
         Begin
           Status := 'Making ' + MethodStr + '.';
           WriteProgress;
           randomFletch;
           FastWait;
           ChooseMethod;
           randomBankWait;
           Wait(randomRange(3000, 4000));
           if FindDTM(DTM_Log, x, y, 613, 219, 629, 233) then
            Begin
              ConductBot;
              Exit;
            End;
            MarkTime(TimeOut)
            Repeat
            If (Not LoggedIn) Then
            Begin
              LogInPlayer;
              ConductBot;
              Exit;
            End;
           randomBankWait;
           ContainsUpLevel;
           if (ContainsUpLevel) then
           Begin
             ClickToContinue;
             ConductBot;
             Exit;
           End;
           Until Not (HasLogs) or (TimeFromMark(TimeOut) > 45000)
           Bank;
           SetDepositeInts;
           FastWait;
           Deposite;
           WithDrawHuman;
           CloseBankHuman;
         End;
        'fletch':
         Begin
           Status := 'Making ' + MethodStr + '.';
           WriteProgress;
           randomFletch;
           FastWait;
           Wait(randomRange(30, 90));
           ChooseMethod;
           randomBankWait;
           Wait(randomRange(2000, 3000));
           MarkTime(TimeOut)
           Repeat
           If (Not LoggedIn) Then
            Begin
              LogInPlayer;
              ConductBot;
              Exit;
            End;
            randomBankWait;
            ContainsUpLevel;
            if (ContainsUpLevel) then
            Begin
             ClickToContinue;
             ConductBot;
             Exit;
           End;
           Until Not HasLogs or (TimeFromMark(TimeOut) > 45000)
           Bank;
           SetDepositeInts;
           Deposite;
           WithDrawHuman;
           CloseBankHuman;
         End;
         'string':
         Begin
          Status := 'Making ' + MethodStr + '.';
          WriteProgress;
          MouseToBow;
           If Not StringReady Then
           Begin
             FastWait;
             If Not StringReady Then
             Begin
               MouseToBow;
               Exit;
             End;
           End;
           StringAll;
           randomBankWait;
            MarkTime(TimeOut)
            Repeat
            If (Not LoggedIn) Then
            Begin
              LogInPlayer;
              ConductBot;
              Exit;
            End;
           randomBankWait;
           ContainsUpLevel;
           if (ContainsUpLevel) then
           Begin
             ClickToContinue;
             ConductBot;
             Exit;
           End;
           Until Not HasStrings or (TimeFromMark(TimeOut) > 30000)
           Bank;
           WithDrawHumanString;
           SetDepositeInts;
           Deposite;
           WithDrawHumanBow;
           CloseBankHuman;
         End;
      End;
    End;
    Procedure ShowInfo;
    var
      Reply:Integer;
    Begin
      Reply := MessageBox('Method:' + MethodStr + '  Fletching:' + NameUse + '', 'Are you sure you want to continue?',4);
      if Reply = 6 then
      Begin
        ConductBot;
      End;
      if Reply = 7 then
      Begin
        Reason := 'User wanted to Terminate the script';
        PrintError;
        TerminateScript;
      End;
    End;
    procedure SetSpeed;
    Begin
      Case LowerCase(speed) of
        'slow':
        Begin
          Writeln('Fletching Speed:Slow');
          MouseSpeed := randomRange(10,12);
        End;
        'meduim':
        Begin
          Writeln('Fletching Speed:Medium');
          MouseSpeed := randomRange(13,17);
        End;
        'fast':
        Begin
          Writeln('Fletching Speed:Fast');
          MouseSpeed := randomRange(18,22);
        End;
      End;
    End;
    procedure Setstring;
    Begin
      Case LowerCase(Make) of
        'shorts': // NEED MAPLES
          Begin
            Case LowerCase(NameUse) of
              'logs': DTM_Made := DTMFromString('mQwAAAHicY2ZgYBADYmkg5gNiESDmB2IJIO6vFWCY3AjB/FBxEGZEwkAAAJNPBBI=');
              'oaks': DTM_Made := DTMFromString('mQwAAAHicY2ZgYDjAxMBwDIh3APFzIP8hEL8C4q4CQYYpFYIMM6oFGfiBfBhmRMJAAAB65gh2');
              'willows': DTM_Made := DTMFromString('mQwAAAHicY2ZgYJAAYnkgFgBicSAWBGJpIG6p1WdIjlVm6GjUZ+AH8mGYEQkDAQCStgQJ');
              'maples': DTM_Made := DTMFromString('mQwAAAHicY2ZgYChgYmDIAOJiIH4G5D8F4odAHGbCCcf8QD4MMyJhIAAADAEF6g==');
              'yews': DTM_Made := DTMFromString('mQwAAAHicY2ZgYChgYmDIAOJiIH4G5D8F4odAHGbCCcf8QD4MMyJhIAAADAEF6g==');
              'magics': DTM_Made := DTMFromString('mQwAAAHicY2ZgYBAFYkkg5gViISgtDsTcrnYMnLbmYJofyIdhRiQMBABShQI+');
            End;
          End;
       'longs':
          Begin
            Case LowerCase(NameUse) of
              'logs': DTM_Made := DTMFromString('mQwAAAHicY2ZgYJjJxMAwGYjnAvEjIP8WEL8G4hnpgkCSEYz5gSQMMyJhIAAAFZAFvA==');
              'oaks': DTM_Made := DTMFromString('mQwAAAHicY2ZgYHBlYmBwBGIvIGZjBAoAMT8Q758jzrC8U4Rhdp0gAz9QGIYZkTAQAADBVgUC');
              'willows': DTM_Made := DTMFromString('mQwAAAHicY2ZgYHACYlsg9gRiISDmBmIZIG6p1WeYNdGMobfNiIEfyIdhRiQMBADArwUL');
              'maples': DTM_Made := DTMFromString('mQwAAAHicY2ZgYHAFYhsg9gViUSDmBWIlID6yegnDiv42hmkNFQz8QD4MMyJhIAAA+coGpA==');
              'yews': DTM_Made := DTMFromString('mQwAAAHicY2ZgYJAAYiEgVgBiQSDmAmIZIO4sF2AoS+cFshgZ+IEkDDMiYSAAAGiGArA=');
              'magics': DTM_Made := DTMFromString('mQwAAAHicY2ZgYBABYj4glgRiUShbDogF81MY+CICgCxGBn4gCcOMSBgIAFgUAks=');
            End;
          End;
       End;
    End;
    procedure SetMake;
    Begin
      Case LowerCase(Make) of
        'arrows':
        Begin
          Writeln('We are going to Shaft');
          Make := 'arrows';
          StoreMethod := 'shafts';
          DTM_Make := DTMFromString('mWAAAAHicY2FgYPAFYjsgjgZibyCeyMjAsAKK1wDx7tXdDBsX1oLpdQuaGfiBapAxIxoGAQBXYwuJ');
          DTM_Made := DTMFromString('mQwAAAHicY2ZgYChgYmDIAOJiIH4G5D8F4odAHGbCCcf8QD4MMyJhIAAADAEF6g==');
          NFSX1 := 56;
          NFSY1 := 395;
          NFSX2 := 104;
          NFSY2 := 432;
          fx := 73;
          fy := 412;
          MethodStr := 'Shafting';
        End;
        'shorts':
        Begin
          Writeln('We are going to Fletch short bows');
          Make := 'nonshafts';
          StoreMethod := 'all';
          DTM_Make := DTMFromString('mbQAAAHicY2VgYDgBxJeA+CgQHwbiM0A8hZGBYR4QLwLiyUDcB8QX9kxlOLN7FsPpXVPB+MLe2QwiQLXomBELBgMAx+gR9Q==');
          NFSX1 := 174;
          NFSY1 := 388;
          NFSX2 := 220;
          NFSY2 := 426;
          nfx := 195;
          nfy := 410;

          FSX1 := 69;
          FSY1 := 389;
          FSX2 := 132;
          FSY2 := 423;
          fx := 100;
          fy := 409;
          MethodStr := 'Shortbows';
        End;
        'longs':
        Begin
          Writeln('We are going to fletch LongBows');
          Make := 'longs';
          StoreMethod := 'nonshafts';
          DTM_Make := DTMFromString('mWAAAAHicY2FgYPAFYjsgjgZibyCeyMjAsAKK1wDx7tXdDBsX1oLpdQuaGfiBapAxIxoGAQBXYwuJ');
          NFSX1 := 295;
          NFSY1 := 393;
          NFSX2 := 333;
          NFSY2 := 424;
          nfx := 316;
          nfy := 408;

          FSX1 := 243;
          FSY1 := 398;
          FSX2 := 281;
          FSY2 := 422;
          fx := 253;
          fy := 407;
          MethodStr := 'LongBows';
        End;
      End;
    End;
    procedure SetLog;
    Begin
      Case LowerCase(Logs) of
        'logs':
        Begin
          Writeln('Logs');
          DTM_Log := DTMFromString('mbQAAAHicY2VgYMhjYmAoAeJUKC4F4iBGBgZPIPYB4nAgDgXionAThvxQY4amZGuG9X0BDC2pNgz8QP3omBELBgMAm6AJ3w==');
          LogUse := 'logs';
          NameUse := 'logs';
          //FletchingStr := 'Normal Logs';
        End;
        'oaks':
        Begin
          Writeln('Oaks');
          DTM_Log := DTMFromString('mggAAAHicY2NgYMhhYmDIAOICIC6D0ulA/Bgo9wqIXwLxCyC+D8X9BS4Mk4tc4XRvnhNDV44jgyBQDhtmxIEhAAAvCw/6');
          LogUse := 'other';
          NameUse := 'oaks';
         // FletchingStr := 'Oaks';
        End;
        'willows':
        Begin
          Writeln('Willows');
          DTM_Log := DTMFromString('mbQAAAHicY2VgYGAHYj4gZgRiHgYIYANiLiDmhfKZgNjXRZIh1EeOISfZGs4WBIqjY0YsGAwA/rwEfQ==');
          LogUse := 'other';
          NameUse := 'willows';
        End;
        'maples':
        Begin
          Writeln('Maples');
          DTM_Log := DTMFromString('mbQAAAHicY2VgYAgH4mAgjgfiaCD2B+LfQMzICMHfGCA4yZGDIc+LB4yz3SFYECiOjhmxYDAAAGDmCK0=');
          LogUse := 'other';
          NameUse := 'maples';
        End;
        'yews':
        Begin
          Writeln('Yews');
          DTM_Log := DTMFromString('mbQAAAHicY2VgYBAFYnEg5gZifiCWAWIBIOYCYh6ovDAQ+1tzMEQ6cjB46XAwxLpBsCBQHB0zYsFgAAD1wAQY');
          LogUse := 'other';
          NameUse := 'yews';
        End;
        'magics':
        Begin
          Writeln('Magics');
          DTM_Log := DTMFromString('mbQAAAHicY2VgYBACYlEg5gBibiCWAmJBIOYEYl6oHAiH+aozZCfbM4h11TBEB2mD2YJQtciYEQsGAwBVUQXd');
          LogUse := 'other';
          NameUse := 'magics';
        End;
      End;
    End;
    Procedure CleanMainLoop;
    Begin
      LoadDTMS;
      SetLog;
      SetMake;
      Setstring;
      SetSpeed;
      ShowInfo;
      Wait(1000);
      CheckFreinds;
      CheckFletching;
      Exit;
    End;

    Begin
      SetupSRL;
      Repeat
        ConductBot;
        AddOnTerminate('FreeTheDTMs');
      Until False;
        AddOnTerminate('FreeTheDTMs');
    END.

  2. #2
    Join Date
    Sep 2010
    Location
    Finland
    Posts
    299
    Mentioned
    8 Post(s)
    Quoted
    37 Post(s)

    Default

    There is no declarePlayers in the mainloop, which is why it gives an error.
    Rusting away

  3. #3
    Join Date
    Sep 2010
    Posts
    5,762
    Mentioned
    136 Post(s)
    Quoted
    2739 Post(s)

    Default

    Quote Originally Posted by Smidqe View Post
    There is no declarePlayers in the mainloop, which is why it gives an error.
    Lol thanks forgot to call it -.- wait I call it after setupSRL right? I have not used the official include for a while

  4. #4
    Join Date
    Sep 2010
    Location
    Finland
    Posts
    299
    Mentioned
    8 Post(s)
    Quoted
    37 Post(s)

    Default

    Quote Originally Posted by RJJ95 View Post
    Lol thanks forgot to call it -.- wait I call it after setupSRL right? I have not used the official include for a while
    Yes.
    Rusting away

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
  •