Results 1 to 3 of 3

Thread: DTMs not working

  1. #1
    Join Date
    Jan 2012
    Location
    127.0.0.1
    Posts
    702
    Mentioned
    11 Post(s)
    Quoted
    76 Post(s)

    Default DTMs not working

    Im making a AIO fletcher atm and its not working =[

    giving this error:Error: Exception: The given DTM Index[2] doesn't exist at line 462
    additionally the other items when banking arent found
    current code:
    Simba Code:
    program EnslavedAIOFletcher;
    {$DEFINE SMART}
    {$i srl/srl.simba}

    var
      Fletched, Counter: integer;
      //Break variables
      wb,xb,yb,zb,RealBTime,CurrentBTime,
      BreakRounds,TotalBreaks: Integer;
    const

     {****************************************************************************************}
     {========================================List of DTMs====================================}
     {****************************************************************************************}
      //DTMs-logs

      Normal = 'mggAAAHicY2NgYDADYgcgdgRiTSg2BeJXQPwIiN8B8QcgfgrEH4E4wVMbSDJhwdgBIw4MAQDRHQep';
      Oak = 'mggAAAHicY2NgYDADYgcgdgRiTSg2BeJXQPwIiN8B8QcgfgrEH4G4PAoky4QFYweMODAEAADgNAfb';
      Maple = 'mggAAAHicY2NgYOAFYh4GBJAAYnEg5gBifiBmBmI+JDV+xtxAkgkLxg4YcWAIAABj1QEf';
      Yew = 'mlwAAAHicY2dgYNgFxIeB+AQQ7wfizUC8GojXAvELIH4MxC+B+D0Qf4bST4HYXo8TSDLhwLgBIx4MBQCNXQwK';
      Magic = 'mlwAAAHicY2dgYNgFxIeB+AQQ7wfizUC8GojXAvELIH4MxC+B+D0Qf4bST4E4JsQESDLhwLgBIx4MBQCz+wx4';

      //DTM-LONGBOWS (U)

      NormalLongU = 'mggAAAHicY2NgYBBlZGCQAWJpIBYCYj4o+zlQ7iMQvwTiB1D8hgEEmDBwoZcAAy7AiANDAABn2gbc';
      OakLongU = 'mggAAAHicY2NgYBBlZGCQAWJpIBYCYj4o+zlQ7iMQvwTiB1D8hgEEmDBwoAMPAy7AiANDAABdgAau';
      MapleLongU = 'mggAAAHicY2NgYBBlZGCQAWJpIBYCYj4o+zlQ7iMQvwTiB1D8hgEEmDBwQ3E+Ay7AiANDAACJKQdz';
      YewLongU = 'mggAAAHicY2NgYBBlZGCQAWJpIBYCYj4o+zlQ7iMQvwTiB1D8hgEEmDBwbpwAAy7AiANDAABrZgbs';
      MagicLongU = 'mggAAAHicY2NgYBBlZGCQAWJpIBYCYj4o+zlQ7iMQvwTiB1D8hgEEmDCwXEIEAy7AiANDAABpsgbn';

      //DTM-ShortBOWS  (U)

      NormalShortU = 'mlwAAAHicY2dgYJjOyMAwG4jnAfFUIO4G4glAPBeInwHlHwDxEyB+DcTvgPgVED9mAAEmrNhdn4sBH2DEg6EAAPzzCw8=';
      OakShortU = 'mlwAAAHicY2dgYJjOyMAwG4jnAfFUIO4E4glAPBeInwHlHwDxEyB+DcRvgPgVED9mAAEmrDgtiJ8BH2DEg6EAAA2WC1I=';
      MapleShortU = 'mlwAAAHicY2dgYJjOyMAwG4jnAfFUIO4E4glAPBeInwHlHwDxEyB+DcRvgPgVED9mAAEmrDgmOIABH2DEg6EAABu7C4o=';
      YewShortU = 'mlwAAAHicY2dgYJjOyMAwG4jnAfFUIO4E4glAPBeInwHlHwDxEyB+DcRvgPgVED9mAAEmrDghmI8BH2DEg6EAAAwFC0w=';
      MagicShortU = 'mlwAAAHicY2dgYJjOyMAwG4jnAfFUIO4E4glAPBeInwHlHwDxEyB+DcRvgPgVED9mAAEmrFjM3ZEBH2DEg6EAAAKCCyk=';

      //DTM-LONGBOWS

      NormalLong = 'mlwAAAHicY2dgYLBjZGCwBmJnIHYDYk8gtoGynwDlHwDxSyB+DsTvofQrBhBgwooT7PkY8AFGPBgKANDvCPA=';
      OakLong = 'mlwAAAHicY2dgYLBjZGCwBmJnIHYDYk8gtoGynwDlHwDxSyB+DsTvofQrBhBgwoqbMoQZ8AFGPBgKAOWsCUA=';
      MapleLong = 'mlwAAAHicY2dgYLBjZGCwBmJnIHYDYk8gtoGynwDlHwDxSyB+DsTvofQrBhBgwop9XJwY8AFGPBgKANoxCRU=';
      YewLong = 'mlwAAAHicY2dgYLBjZGCwBmJnIHYDYk8gtoGynwDlHwDxSyB+DsTvofQrBhBgwoprsoUY8AFGPBgKAOSfCTw=';
      MagicLong = 'mlwAAAHicY2dgYLBjZGCwBmJnIHYDYk8gtoGynwDlHwDxSyB+DsTvofQrBhBgwopl48IY8AFGPBgKANmsCRQ';

      //DTM-ShortBOWS
      NormalShort = 'mlwAAAHicY2dgYMhiZGAoAuIMII4H4iRGiFghED8Hyj8B4jdA/A6InwHxAyhmYGDCioPNeRjwAUY8GAoAWe8J4w==';
      OakShort = 'mlwAAAHicY2dgYMhiZGAoAuIMII4H4iRGiFghED8Hyj8B4jdA/A6InwHxAyhmYGDCilMC+BnwAUY8GAoAZZcKEA==';
      MapleShort = 'mlwAAAHicY2dgYMhiZGAoAuIMII4H4iRGiFghED8Hyj8B4jdA/A6InwHxAyhmYGDCilOiwhnwAUY8GAoAenMKYg==';
      YewShort = 'mlwAAAHicY2dgYMhiZGAoAuIMII4H4iRGiFghED8Hyj8B4jdA/A6InwHxAyhmYGDCijOj+BnwAUY8GAoAaXoKHw==';
      MagicShort = 'mlwAAAHicY2dgYMhiZGAoAuIMII4H4iRGiFghED8Hyj8B4jdA/A6InwHxAyhmYGDCikXsrRjwAUY8GAoAVzAJ2g==';
      //DTM-OTHER
      BowString = 'mwQAAAHic42RgYNjPyMCwGYiPA/E5IN4HxIeB+CQQ74Sy9wLVbQfiPUB8CIiPA/ERKBskDpJnYGDCi2OC7RiIAYxEYDgAAJD1Dpk=';
      Knife = 'mbQAAAHicY2VgYPgHxEyMDAycQMwMxN+B/BtA+hwQHwfiE0D8FIjd9LgYEmNjQaqRMCZgxILBAABnvAfP';
      //MIS
      MIX3 = 600;
      MIY3 = 300;
      //Debug
      Debug = True;


      // Start Defining settings here
      WatBankTab = 9;
      Action = 'Fletch'; //Choose between String / Fletch
      LogType = maple; //Copy the dtm from   DTMs-logs
      BowTypeU = MapleLongU;  //Copy the dtm from DTM-LONGBOWS (U) or  DTM-ShortBOWS (U)
      OutputType = MapleLong; //Copy the DTM of the ENd Product
      ItemXP = 58;
       {================================Break settings============================================}
      Breaking     = False ;     //Are we going to take Breaks                (    True   /   False   )
      SwitchWorlds = True;     //Are we going to Hop worlds after breaks?    (    True   /   False   )
      BreakIn      = 140;     //How long before we take a break?             (minutes)
      BreakFor     = 30;      //How long will we break for?                  (minutes)
      Bir          = 15;      //Random minutes to add/subtract from how long until we break
      Bfr          = 15;       //Random minutes to add/subjtract from break duraction


    procedure DeclarePlayers;
    begin
      HowManyPlayers := 1;
      NumberOfPlayers(HowManyPlayers);
      CurrentPlayer := 0;
      Players[0].Name := ''';
      Players[0].Pass := '
    ';
      Players[0].Pin := '
    '';
      Players[0].Active := True;
    end;

    procedure AntiBan();
    begin
      if(not(LoggedIn))then Exit;
      FindNormalRandoms;
      //If Debug then Writeln('AntiBan');
      case (Random(1000)) of
        0 : MMouse(RandomRange(MSX1,MSX2),RandomRange(MSY1,MSY2),4,4);
        1 : HoverSkill('random', False);
        2..3 : ExamineInv;
        4 : begin HoverSkill('Fletching', False); Wait(RandomRange(2000, 4000)); end;
        5 : begin PickUpMouse; SleepAndMoveMouse(1500 + Random(500)); end;
        6 : begin GameTab(tab_Stats); Wait(1500 + Random(500)); GameTab(tab_Inv); end;
        7 .. 50 :  begin BoredHuman; SetAngle(SRL_ANGLE_HIGH); end;
        51  :  Wait(RandomRange(750, 2000));
      end;
    end;


    procedure WaitFinnish;
    var
      x, y,StringDTM, LogDTM: integer;
    begin
      If (Action='Fletch')then
      Begin

        LogDTM := DTMFromString(Logtype);
        wait(randomrange(1000, 2000));
        Marktime(Counter);
        while Existsitemdtm(LogDTM, x, y) do
        begin
          case random(100) of
            1..9: Sleepandmovemouse(Randomrange(500, 1000));
            10..15: Antiban;
          end;
          if timefrommark(Counter) > 60000 then
          begin
            FreeDTM(logDTM);
            Exit;
          end;
        end;
        FreeDTM(LogDTM);
      end else
      begin
        StringDTM := DTMFromString(BowString);
        wait(randomrange(1000, 2000));
        Marktime(Counter);
        while Existsitemdtm(StringDTM, x, y) do
        begin
          case random(100) of
            1..9: Sleepandmovemouse(Randomrange(500, 1000));
            10..15: Antiban;
          end;
          if timefrommark(Counter) > 30000 then
          begin
            FreeDTM(StringDTM);
            Exit;
          end;
        end;
        FreeDTM(StringDTM);
        end;
    end;
    function WaitFindDTMBank(DTM: integer; var x, y: integer; MaxTime: integer): boolean;
    var
      t: integer;
    begin
      MarkTime(t)

      while (t < MaxTime) do
      begin
        if (findDTM(DTM, x, y, MBX1, MBY1,MBX2,MBY2)) then
        begin
          result := true;
          exit;
        end;
      end;
    end;


    function WaitDTMOptions(DTM: integer; var x, y: integer; MaxTime: integer): boolean;
    var
      t: integer;
    begin
      MarkTime(t)

      while (t < MaxTime) do
      begin
        if (findDTM(DTM, x, y, MCX1, MCY1,MCX2,MCY2)) then
        begin
        IF Debug then WriteLn('Option Found');
          result := true;
          exit;
        end;
      end;
    end;

    Function ChooseOptionDTM(DTM:Integer) : boolean;
    var
    x,y:integer ;
    begin
     if WaitDTMOptions(DTM,x,y,300) then
     begin
     MMouse(x,y,7,7);
     ClickMouse2(true);
     IF Debug then WriteLn('Option Chosen');
     result := true;
     end;
    end;

    function WithdrawXYEx(Xa, Ya, Amount: Integer; Uptexts: TStringArray): Boolean;
    var
      BBox: TBox;
      X, Y: Integer;
    begin
      Result := False;
      FixBank;

      BBox := IntToBox(Xa-3,Ya-3,Xa+3,Ya+3);
      GetMousePos(X, Y);
      if (not PointInBox(Point(X, Y), BBox)) then
        MouseBox(BBox.X1 + 5, BBox.Y1 + 5, BBox.X2 - 5, BBox.Y2 - 5, mouse_move);

      if (Length(Uptexts) > 0) then
        if (not WaitUptextMulti(Uptexts, 500)) then
          Exit;

      if (Amount = 1) then
        ClickMouse2(mouse_left)
      else
        ClickMouse2(mouse_right);
      if (Amount = 1) then
      begin
        Result := True;
        Wait(RandomRange(250, 550));
        Exit;
      end;

      if (Amount = -1) then
      begin
        if (WaitOptionMultiEx(['Withdraw-All but', 'l b'], 'All', Nothing, 300)) then
          Result := ChooseOptionMulti(['Withdraw-All but', 'l b']);
      end else
        if (Amount = 0) then
        begin
          if (WaitOptionMultiEx(['Withdraw-All', 'w-A'], 'All', Nothing, 300)) then
            Result := ChooseOptionMulti(['Withdraw-All', 'w-A']);
        end else
          if (WaitOptionMultiEx(['Withdraw-' + IntToStr(Amount), 'w-' + IntToStr(Amount)], 'All', Nothing, 300)) then
            Result := ChooseOptionMulti(['Withdraw-' + IntToStr(Amount), 'w-' + IntToStr(Amount)]);

      if (not (Result)) and (Amount > 0) then
      begin
        if (not OptionsExist(['Withdraw', 'ithdraw', 'draw'], nothing)) then
          MouseBox(BBox.X1 + 5, BBox.Y1 + 5, BBox.X2 - 5, BBox.Y2 - 5, mouse_right);

        if WaitOptionMulti(['Withdraw-X', 'w-X'], 500) then
        begin
           X := GetSystemTime + 10000;
           while (X >= GetSystemTime) and (not (InRange(CountColor(0, 250, 396, 307, 410), 155, 165))) do
             Wait(50);
           Wait(RandomRange(75, 400));
           TypeSend(IntToStr(Amount));
           Result := True;
        end;
      end;
    end;


    function WithdrawXY(X, Y, Amount: Integer): Boolean;
    begin
      Result := WithdrawEx(X, Y, Amount,[]);
      IF Debug then WriteLn('Withdrew ' + inttostr(amount)+'at: x'+ inttostr(x)+'; y:'+inttostr(y));
    end;

    {*******************************************************************************
    Function BreakHandler(BreakIn, BreakFor, randBreakIn, randBreakFor: Integer): Boolean;
    His Breaking system
    By: Flight
    *******************************************************************************}

      Function BreakHandler(BreakIn, BreakFor, randBreakIn, randBreakFor: Integer): Boolean;
      Var
        h,m,s,timeleft: integer;
      begin
        if not LoggedIn then Exit;

        if (HowManyPlayers = 1) then
        begin
        timeleft:=(wb) + (yb) - GetTimeRunning ;
        ConvertTIME(Timeleft,H,M,S);
        Writeln('Time Until Break: '+IntToStr(h)+' Hours, '+Inttostr(m)+' Minutes and '+ IntToStr(s)+' Seconds');
          if (GetTimeRunning < ((wb) + (yb) + BreakRounds)) then Exit
          else
            if (GetTimeRunning > ((wb) + (yb) + BreakRounds)) then
            begin
              RealBTime := ((xb+zb)/60000);
              Writeln('Taking a break for about ' + IntToStr(RealBTime) + ' minutes.');
              Logout;
              MarkTime(CurrentBTime);
              repeat
                Wait(21000);
                ConvertTime((xb+zb)-TimeFromMark(CurrentBTime), h, m, s);
                ClearDebug;
                Writeln('Breaktime left: '+IntToStr(h)+':'+IntToStr(m)+':'+IntToStr(s));
              until(TimeFromMark(CurrentBTime)>(xb+zb));
              Writeln('Logging in.');
              if SwitchWorlds then
                if LoginPlayerToLob then
                  ChangeWorld(RandomWorld(True, False))
              else
                LoginPlayer;
              Wait(4000);
              Result := LoggedIn;
              ClickNorth(SRL_ANGLE_HIGH);
              IncEx(BreakRounds, (wb) + (xb));
              Inc(TotalBreaks);
              Writeln('The next break will occur in about ' + IntToStr(BreakIn) + ' minutes.');
              wb := (BreakIn * 60000);
              xb := (BreakFor * 60000);
              yb := RandomRange(-Bir * 60000, Bir * 60000);
              zb := RandomRange(-Bfr * 60000, Bfr * 60000);
            end;
        end;
      end;

    procedure Fletch;
    Var
    KnifeDTM,BowDTM:Integer;
    begin
      wait(randomrange(200, 300));
      Invmouse(1, 3);
      IF Debug then WriteLn('mouse moved to 1stinv slot');
      if Isuptext('Craft') then
      begin
        wait(randomrange(900, 1100));
        KnifeDTM := DTMFromString(Knife);
        ChooseOptionDTM(KnifeDTM);
        FreeDTM(KnifeDTM);
        BowDTM := DTMFromString(OutputType);
        ChooseOptionDTM(BowDTM);
        FreeDTM(BowDTM);
      end;
    end;

    Procedure StringBows;
    var
    x,y,BowDTM,StringDTM,DoneDTM:integer;
    Begin
      wait(randomrange(200, 300));
      BowDTM := DTMFromString(BowTypeU);
      If  ExistsItemDTM(BowDTM,x,y) then
      Begin
        FreeDTM(BowDTM);
        MMouse(x,y,7,7);
        wait(200);
        if Isuptext('Use') then
          ClickMouse2(True);
        StringDTM := DTMFromString(BowString);
        If  ExistsItemDTM(StringDTM,x,y) then
        Begin
          FreeDTM(StringDTM);
          MMouse(x,y,7,7);
          wait(200);
          ClickMouse2(True);
        end;
      End else
      begin
      FreeDTM(BowDTM);
      end;
      DoneDTM := DtmFromString(OutputType);
      ChooseOptionDTM(DoneDTM);
      FreeDTM(DoneDTM);
    End;

    procedure Bank;
    var
    x,y,chestDTM,failcount:Integer;
    aFound: Extended;
      begin

      ChestDTM := DTMFromString('mQwAAAHicY2ZgYOBkZmDgBWJhIFZmZGBQAmI5IM6MDWDITw5luHHuHAMHUB0MMyJhIAAAu7wFaA==');
      while not (bankscreen) and not (pinscreen) do
      begin
        Writeln('Time To Bank');
        if(finddtmrotated(ChestDTM,x,y,MSX1,MSY1,MSX2,MSY2,-Pi, Pi, Pi/30, aFound))then
        begin
          //WriteLn('x:'+inttostr(x));
          //WriteLn('y:'+inttostr(y));
          mmouse(x,y,10,10);
          if(WaitUpText('hest',1000))then
          Clickmouse2(True);
        end else
        begin
        ClickNorth(SRL_ANGLE_HIGH);
        Case (random(4)) of
        1:MakeCompass('E');
        2:MakeCompass('N');
        3:MakeCompass('S');
        4:MakeCompass('W');
        End;
        inc(failcount);
        end;
        if failcount>3 then
          terminatescript;
      end;
      freeDTM(ChestDtm);
      repeat
        if (PinScreen) then
           (InPin(Players[0].Pin));
      until (BankScreen);
      wait(randomrange(400, 800));
      Quickdeposit(SRL_DEPOSIT_ALL);
      IF (CurrentBankTab<>Watbanktab)then
      Banktab(Watbanktab);
    end;



    Procedure WithdrawFletch;
    var
    x,y,LogDTM:Integer;
    Begin
      LogDtm := DTMFromString(LogType);
      IF Debug then WriteLn('Withdraw log DTM Loaded');
      IF Debug then WriteLn(logtype);
      If WaitFindDTMBank(LogDTM,x,y,3000) then
      begin
      IF Debug then WriteLn('Log DTM found');
      FreeDTM(LogDTM);
      WithdrawXY(x,y,0);
      Closebank;
      wait(randomrange(400, 600));
      end;
      FreeDTM(LogDTM);
      Fletched := Fletched +28     ;
    end;

    Procedure Withdrawstring;
    var
    x,y,BowDTM,StringDTM:Integer;
    Begin
      BowDtm := DTMFromString(BowTypeU);
      IF Debug then WriteLn('Bank DTM Load');
      If WaitFindDTMBank(BowDtm,x,y,3000) then
      begin
          IF Debug then WriteLn('BowDTM Found');
        FreeDTM(BowDtm);
        WithdrawXY(x,y,14);
          StringDTM := DTMFromString(BowString);
          If WaitFindDTMBank(StringDTM,x,y,3000) then
          begin
          IF Debug then WriteLn('String DTM Found');
            FreeDTM(StringDTM);
            WithdrawXY(x,y,14);
          end;
        wait(randomrange(400, 600));
      end;
      Closebank;
      IF Debug then WriteLn('Freeing DTMs');
      FreeDTM(StringDTM);
      FreeDTM(BowDTM);
      Fletched := Fletched +14;
    end;

    Function SkillStarted:boolean;
    var
    x,y,ItemDTM,t : Integer;
    begin
      Marktime(t);
      IF Debug then WriteLn('Checking Started');
      IF Debug then WriteLn(OutputType);
      ItemDTM := DTMFromString(OutputType);
      While  (timefrommark(t)<5000)  do
      begin
      if (FindDTM(ItemDTM,x,y,MIX1,MIY1,MIX3,MIY3)) then
      begin
      IF Debug then WriteLn('Started');
      freeDTM(ItemDTM);
      Result := True;
      Exit;
      end;
      freeDTM(ItemDTM);
      Result := False;
      end;
    End;

    Procedure InvCheck;
    var
    Failcount:integer;
    begin
      IF Debug then WriteLn('checking Inv');
      while (Invcount < 28) and (Failcount < 3) Do
      begin
        Bank;
        Case Action of
          'String': WithdrawString;
          'Fletch': WithdrawFletch;
        end
        inc(failcount);
      end;
      If (Failcount >= 3) then
      terminatescript;
    End;

    procedure Proggy;
    var
      xp: integer;
    begin
      XP := Round(Fletched * ItemXP);
      Writeln('********************************');
      Writeln('AIO Fletcher by EnSlaved ');
      Writeln('Time running = ' + (timerunning));
      Writeln('Items Done = ' + IntToStr(fletched));
      Writeln('EXP Earned = ' + IntToStr(XP));
      Writeln('Post Feedback and Proggies On Forum Thread Please!');
      Writeln('********************************');
    end;


    Procedure DoString;
    var
    failed:integer;
    Begin
      repeat
        Bank;
        WithdrawString;
        StringBows;
        if SkillStarted then
        begin
        Failed:= 0;
        WaitFinnish;
        Proggy;
        if breaking then BreakHandler(BreakIn,BreakFor,Bir,Bfr);
        end else
        begin
        inc(Failed)
        if (failed>3) then
        TerminateScript;
        end;
      until (AllPlayersInactive);
    End;

    Procedure DoFletch;
    var
    failed:integer;
    Begin
      repeat
        Bank;
        WithdrawFletch;
        Fletch;
        if SkillStarted then
        begin
        Failed:= 0;
        WaitFinnish;
        Proggy;
        if breaking then BreakHandler(BreakIn,BreakFor,Bir,Bfr);
        end else
        begin
        inc(Failed)
        if (failed>3) then
        TerminateScript;
        end;
      until (AllPlayersInactive);
    End;

    begin
      {$IFDef Smart}
      SRL_SixHourFix:= True;
      Smart_FixSpeed:= True;
      {$ENDIF}
      SetupSRL;
      Declareplayers;
      Loginplayer;
      MakeCompass('E');
      SetAngle(0);
      ExitSquealOfFortune;
      Case Action of
      'String': DoString;
      'Fletch': DoFletch;
      end;
    end.
    Last edited by Enslaved; 08-15-2012 at 12:20 AM.

  2. #2
    Join Date
    Feb 2012
    Location
    Wonderland
    Posts
    1,988
    Mentioned
    41 Post(s)
    Quoted
    272 Post(s)

    Default

    Whoa, first off, my personal preference would be to take out the DTM strings from being constants, and placing them into a record / loading procedure. This was you only use the required DTM's you need, saving memory afaik. Plus loading the required ones will allow you to use them throughout the script, then free them at the end / free them on termination. (I think this should also help the error, DTM index doesnt exist (as a dtm is probably being freed, and then trying to be called again)). Hope this helps / gives some what of a beneficial idea to your script, cheers!

  3. #3
    Join Date
    Jan 2012
    Location
    127.0.0.1
    Posts
    702
    Mentioned
    11 Post(s)
    Quoted
    76 Post(s)

    Default

    Simba Code:
    program EnslavedFletcher;
    {$DEFINE SMART}
    {$i srl/srl.simba}

    var
      ItemADTM, ItemBDTM, Fletched, ExtrasDTM, Counter: integer;
      wb, xb, yb, zb, RealBTime, CurrentBTime, BreakRounds, TotalBreaks: Integer;
      ItemXp: Extended;

    const
      Action = 'Fletch';
      Bowtype = 'MapleLU';
      MIX3 = 600;
      MIY3 = 300;
      Debug = True;
      WatBankTab = 9;
      Breaking = False;
      SwitchWorlds = True;
      BreakIn = 140;
      BreakFor = 30;
      Bir = 15;
      Bfr = 15;

    procedure CallDTMs;
    begin
      case BowType of
        'NormalLU':
          begin
            ItemADTM := DTMFromString('mggAAAHicY2NgYDADYgcgdgRiTSg2BeJXQPwIiN8B8QcgfgrEH4E4wVMbSDJhwdgBIw4MAQDRHQep');
            ItemBDTM := DTMFromString('mggAAAHicY2NgYBBlZGCQAWJpIBYCYj4o+zlQ7iMQvwTiB1D8hgEEmDBwoZcAAy7AiANDAABn2gbc');
            ExtrasDTM := DTMFromString('mbQAAAHicY2VgYPgHxEyMDAycQMwMxN+B/BtA+hwQHwfiE0D8FIjd9LgYEmNjQaqRMCZgxILBAABnvAfP');
            ItemXp := 10;
          end;
        'NormalSU':
          begin
            ItemADTM := DTMFromString('mggAAAHicY2NgYDADYgcgdgRiTSg2BeJXQPwIiN8B8QcgfgrEH4E4wVMbSDJhwdgBIw4MAQDRHQep');
            ItemBDTM := DTMFromString('mlwAAAHicY2dgYJjOyMAwG4jnAfFUIO4G4glAPBeInwHlHwDxEyB+DcTvgPgVED9mAAEmrNhdn4sBH2DEg6EAAPzzCw8=');
            ExtrasDTM := DTMFromString('mbQAAAHicY2VgYPgHxEyMDAycQMwMxN+B/BtA+hwQHwfiE0D8FIjd9LgYEmNjQaqRMCZgxILBAABnvAfP');
            ItemXp := 5;
          end;
        'OakLU':
          begin
            ItemADTM := DTMFromString('mggAAAHicY2NgYDADYgcgdgRiTSg2BeJXQPwIiN8B8QcgfgrEH4G4PAoky4QFYweMODAEAADgNAfb');
            ItemBDTM := DTMFromString('mggAAAHicY2NgYBBlZGCQAWJpIBYCYj4o+zlQ7iMQvwTiB1D8hgEEmDBwoAMPAy7AiANDAABdgAau');
            ExtrasDTM := DTMFromString('mbQAAAHicY2VgYPgHxEyMDAycQMwMxN+B/BtA+hwQHwfiE0D8FIjd9LgYEmNjQaqRMCZgxILBAABnvAfP');
            ItemXp := 25;
          end;
        'OakSU':
          begin
            ItemADTM := DTMFromString('mggAAAHicY2NgYDADYgcgdgRiTSg2BeJXQPwIiN8B8QcgfgrEH4G4PAoky4QFYweMODAEAADgNAfb');
            ItemBDTM := DTMFromString('mlwAAAHicY2dgYJjOyMAwG4jnAfFUIO4E4glAPBeInwHlHwDxEyB+DcRvgPgVED9mAAEmrDgtiJ8BH2DEg6EAAA2WC1I=');
            ExtrasDTM := DTMFromString('mbQAAAHicY2VgYPgHxEyMDAycQMwMxN+B/BtA+hwQHwfiE0D8FIjd9LgYEmNjQaqRMCZgxILBAABnvAfP');
            ItemXp := 16.5;
          end;
        'MapleLU':
          begin
            ItemADTM := DTMFromString('mggAAAHicY2NgYDADYgcgdgRiTSg2BeJXQPwIiN8B8QcgfgrEH4G4PAoky4QFYweMODAEAADgNAfb');
            ItemBDTM := DTMFromString('mggAAAHicY2NgYBBlZGCQAWJpIBYCYj4o+zlQ7iMQvwTiB1D8hgEEmDBwQ3E+Ay7AiANDAACJKQdz');
            ExtrasDTM := DTMFromString('mbQAAAHicY2VgYPgHxEyMDAycQMwMxN+B/BtA+hwQHwfiE0D8FIjd9LgYEmNjQaqRMCZgxILBAABnvAfP');
            ItemXp := 58.3;
            writeln('maples chosen');
          end;
        'MapleSU':
          begin
            ItemADTM := DTMFromString('mggAAAHicY2NgYDADYgcgdgRiTSg2BeJXQPwIiN8B8QcgfgrEH4G4PAoky4QFYweMODAEAADgNAfb');
            ItemBDTM := DTMFromString('mlwAAAHicY2dgYJjOyMAwG4jnAfFUIO4E4glAPBeInwHlHwDxEyB+DcRvgPgVED9mAAEmrDgmOIABH2DEg6EAABu7C4o=');
            ExtrasDTM := DTMFromString('mbQAAAHicY2VgYPgHxEyMDAycQMwMxN+B/BtA+hwQHwfiE0D8FIjd9LgYEmNjQaqRMCZgxILBAABnvAfP');
            ItemXp := 50;
          end;
        'YewLU':
          begin
            ItemADTM := DTMFromString('mlwAAAHicY2dgYNgFxIeB+AQQ7wfizUC8GojXAvELIH4MxC+B+D0Qf4bST4HYXo8TSDLhwLgBIx4MBQCNXQwK');
            ItemBDTM := DTMFromString('mggAAAHicY2NgYBBlZGCQAWJpIBYCYj4o+zlQ7iMQvwTiB1D8hgEEmDBwbpwAAy7AiANDAABrZgbs');
            ExtrasDTM := DTMFromString('mbQAAAHicY2VgYPgHxEyMDAycQMwMxN+B/BtA+hwQHwfiE0D8FIjd9LgYEmNjQaqRMCZgxILBAABnvAfP');
            ItemXp := 75;
          end;
        'YewSU':
          begin
            ItemADTM := DTMFromString('mlwAAAHicY2dgYNgFxIeB+AQQ7wfizUC8GojXAvELIH4MxC+B+D0Qf4bST4HYXo8TSDLhwLgBIx4MBQCNXQwK');
            ItemBDTM := DTMFromString('mlwAAAHicY2dgYJjOyMAwG4jnAfFUIO4E4glAPBeInwHlHwDxEyB+DcRvgPgVED9mAAEmrDghmI8BH2DEg6EAAAwFC0w=');
            ExtrasDTM := DTMFromString('mbQAAAHicY2VgYPgHxEyMDAycQMwMxN+B/BtA+hwQHwfiE0D8FIjd9LgYEmNjQaqRMCZgxILBAABnvAfP');
            ItemXp := 67.5;
          end;
        'MagicLU':
          begin
            ItemADTM := DTMFromString('mlwAAAHicY2dgYNgFxIeB+AQQ7wfizUC8GojXAvELIH4MxC+B+D0Qf4bST4E4JsQESDLhwLgBIx4MBQCz+wx4');
            ItemBDTM := DTMFromString('mggAAAHicY2NgYBBlZGCQAWJpIBYCYj4o+zlQ7iMQvwTiB1D8hgEEmDCwXEIEAy7AiANDAABpsgbn');
            ExtrasDTM := DTMFromString('mbQAAAHicY2VgYPgHxEyMDAycQMwMxN+B/BtA+hwQHwfiE0D8FIjd9LgYEmNjQaqRMCZgxILBAABnvAfP');
            ItemXp := 91.5;
          end;
        'MagicSU':
          begin
            ItemADTM := DTMFromString('mlwAAAHicY2dgYNgFxIeB+AQQ7wfizUC8GojXAvELIH4MxC+B+D0Qf4bST4E4JsQESDLhwLgBIx4MBQCz+wx4');
            ItemBDTM := DTMFromString('mlwAAAHicY2dgYJjOyMAwG4jnAfFUIO4E4glAPBeInwHlHwDxEyB+DcRvgPgVED9mAAEmrFjM3ZEBH2DEg6EAAAKCCyk=');
            ExtrasDTM := DTMFromString('mbQAAAHicY2VgYPgHxEyMDAycQMwMxN+B/BtA+hwQHwfiE0D8FIjd9LgYEmNjQaqRMCZgxILBAABnvAfP');
            ItemXp := 83.2;
          end;
        'NormalL':
          begin
            ItemADTM := DTMFromString('mggAAAHicY2NgYBBlZGCQAWJpIBYCYj4o+zlQ7iMQvwTiB1D8hgEEmDBwoZcAAy7AiANDAABn2gbc');
            ItemBDTM := DTMFromString('mlwAAAHicY2dgYLBjZGCwBmJnIHYDYk8gtoGynwDlHwDxSyB+DsTvofQrBhBgwooT7PkY8AFGPBgKANDvCPA=');
            ExtrasDTM := DTMFromString('mwQAAAHic42RgYNjPyMCwGYiPA/E5IN4HxIeB+CQQ74Sy9wLVbQfiPUB8CIiPA/ERKBskDpJnYGDCi2OC7RiIAYxEYDgAAJD1Dpk=');
            ItemXp := 10;
          end;
        'NormalS':
          begin
            ItemADTM := DTMFromString('mlwAAAHicY2dgYJjOyMAwG4jnAfFUIO4G4glAPBeInwHlHwDxEyB+DcTvgPgVED9mAAEmrNhdn4sBH2DEg6EAAPzzCw8=');
            ItemBDTM := DTMFromString('mlwAAAHicY2dgYMhiZGAoAuIMII4H4iRGiFghED8Hyj8B4jdA/A6InwHxAyhmYGDCioPNeRjwAUY8GAoAWe8J4w==');
            ExtrasDTM := DTMFromString('mwQAAAHic42RgYNjPyMCwGYiPA/E5IN4HxIeB+CQQ74Sy9wLVbQfiPUB8CIiPA/ERKBskDpJnYGDCi2OC7RiIAYxEYDgAAJD1Dpk=');
            ItemXp := 5;
          end;
        'OakL':
          begin
            ItemADTM := DTMFromString('mggAAAHicY2NgYBBlZGCQAWJpIBYCYj4o+zlQ7iMQvwTiB1D8hgEEmDBwoAMPAy7AiANDAABdgAau');
            ItemBDTM := DTMFromString('mlwAAAHicY2dgYLBjZGCwBmJnIHYDYk8gtoGynwDlHwDxSyB+DsTvofQrBhBgwoqbMoQZ8AFGPBgKAOWsCUA=');
            ExtrasDTM := DTMFromString('mwQAAAHic42RgYNjPyMCwGYiPA/E5IN4HxIeB+CQQ74Sy9wLVbQfiPUB8CIiPA/ERKBskDpJnYGDCi2OC7RiIAYxEYDgAAJD1Dpk=');
            ItemXp := 25;
          end;
        'OakS':
          begin
            ItemADTM := DTMFromString('mlwAAAHicY2dgYJjOyMAwG4jnAfFUIO4E4glAPBeInwHlHwDxEyB+DcRvgPgVED9mAAEmrDgtiJ8BH2DEg6EAAA2WC1I=');
            ItemBDTM := DTMFromString('mlwAAAHicY2dgYMhiZGAoAuIMII4H4iRGiFghED8Hyj8B4jdA/A6InwHxAyhmYGDCilMC+BnwAUY8GAoAZZcKEA==');
            ExtrasDTM := DTMFromString('mwQAAAHic42RgYNjPyMCwGYiPA/E5IN4HxIeB+CQQ74Sy9wLVbQfiPUB8CIiPA/ERKBskDpJnYGDCi2OC7RiIAYxEYDgAAJD1Dpk=');
            ItemXp := 16.5;
          end;
        'MapleL':
          begin
            ItemADTM := DTMFromString('mggAAAHicY2NgYBBlZGCQAWJpIBYCYj4o+zlQ7iMQvwTiB1D8hgEEmDBwQ3E+Ay7AiANDAACJKQdz');
            ItemBDTM := DTMFromString('mlwAAAHicY2dgYLBjZGCwBmJnIHYDYk8gtoGynwDlHwDxSyB+DsTvofQrBhBgwop9XJwY8AFGPBgKANoxCRU=');
            ExtrasDTM := DTMFromString('mwQAAAHic42RgYNjPyMCwGYiPA/E5IN4HxIeB+CQQ74Sy9wLVbQfiPUB8CIiPA/ERKBskDpJnYGDCi2OC7RiIAYxEYDgAAJD1Dpk=');
            ItemXp := 58.3;
          end;
        'MapleS':
          begin
            ItemADTM := DTMFromString('mlwAAAHicY2dgYJjOyMAwG4jnAfFUIO4E4glAPBeInwHlHwDxEyB+DcRvgPgVED9mAAEmrDgmOIABH2DEg6EAABu7C4o=');
            ItemBDTM := DTMFromString('mlwAAAHicY2dgYMhiZGAoAuIMII4H4iRGiFghED8Hyj8B4jdA/A6InwHxAyhmYGDCikXsrRjwAUY8GAoAVzAJ2g==');
            ExtrasDTM := DTMFromString('mwQAAAHic42RgYNjPyMCwGYiPA/E5IN4HxIeB+CQQ74Sy9wLVbQfiPUB8CIiPA/ERKBskDpJnYGDCi2OC7RiIAYxEYDgAAJD1Dpk=');
            ItemXp := 50;
          end;
        'YewL':
          begin
            ItemADTM := DTMFromString('mggAAAHicY2NgYBBlZGCQAWJpIBYCYj4o+zlQ7iMQvwTiB1D8hgEEmDBwbpwAAy7AiANDAABrZgbs');
            ItemBDTM := DTMFromString('mlwAAAHicY2dgYLBjZGCwBmJnIHYDYk8gtoGynwDlHwDxSyB+DsTvofQrBhBgwoprsoUY8AFGPBgKAOSfCTw=');
            ExtrasDTM := DTMFromString('mwQAAAHic42RgYNjPyMCwGYiPA/E5IN4HxIeB+CQQ74Sy9wLVbQfiPUB8CIiPA/ERKBskDpJnYGDCi2OC7RiIAYxEYDgAAJD1Dpk=');
            ItemXp := 75;
          end;
        'YewS':
          begin
            ItemADTM := DTMFromString('mlwAAAHicY2dgYJjOyMAwG4jnAfFUIO4E4glAPBeInwHlHwDxEyB+DcRvgPgVED9mAAEmrDghmI8BH2DEg6EAAAwFC0w=');
            ItemBDTM := DTMFromString('mlwAAAHicY2dgYMhiZGAoAuIMII4H4iRGiFghED8Hyj8B4jdA/A6InwHxAyhmYGDCijOj+BnwAUY8GAoAaXoKHw==');
            ExtrasDTM := DTMFromString('mwQAAAHic42RgYNjPyMCwGYiPA/E5IN4HxIeB+CQQ74Sy9wLVbQfiPUB8CIiPA/ERKBskDpJnYGDCi2OC7RiIAYxEYDgAAJD1Dpk=');
            ItemXp := 67.5;
          end;
        'MagicL':
          begin
            ItemADTM := DTMFromString('mggAAAHicY2NgYBBlZGCQAWJpIBYCYj4o+zlQ7iMQvwTiB1D8hgEEmDCwXEIEAy7AiANDAABpsgbn');
            ItemBDTM := DTMFromString('mlwAAAHicY2dgYLBjZGCwBmJnIHYDYk8gtoGynwDlHwDxSyB+DsTvofQrBhBgwopl48IY8AFGPBgKANmsCRQ');
            ExtrasDTM := DTMFromString('mwQAAAHic42RgYNjPyMCwGYiPA/E5IN4HxIeB+CQQ74Sy9wLVbQfiPUB8CIiPA/ERKBskDpJnYGDCi2OC7RiIAYxEYDgAAJD1Dpk=');
            ItemXp := 91.5;
          end;
        'MagicS':
          begin
            ItemADTM := DTMFromString('mlwAAAHicY2dgYJjOyMAwG4jnAfFUIO4E4glAPBeInwHlHwDxEyB+DcRvgPgVED9mAAEmrFjM3ZEBH2DEg6EAAAKCCyk=');
            ItemBDTM := DTMFromString('mlwAAAHicY2dgYMhiZGAoAuIMII4H4iRGiFghED8Hyj8B4jdA/A6InwHxAyhmYGDCikXsrRjwAUY8GAoAVzAJ2g==');
            ExtrasDTM := DTMFromString('mwQAAAHic42RgYNjPyMCwGYiPA/E5IN4HxIeB+CQQ74Sy9wLVbQfiPUB8CIiPA/ERKBskDpJnYGDCi2OC7RiIAYxEYDgAAJD1Dpk=');
            ItemXp := 83.2;
          end;
      end;
    end;

    procedure FreeAllDTMs;
    begin
      FreeDtm(ItemADTM);
      FreeDtm(ItemBDTM);
      FreeDtm(ExtrasDTM);
    end;

    procedure DeclarePlayers;
    begin
      HowManyPlayers := 1;
      NumberOfPlayers(HowManyPlayers);
      CurrentPlayer := 0;
      Players[0].Name := '';
      Players[0].Pass := '';
      Players[0].Pin := '';
      Players[0].Active := True;
    end;

    procedure AntiBan();
    begin
      if (not (LoggedIn)) then
        Exit;
      FindNormalRandoms;
      case (Random(1000)) of
        0: MMouse(RandomRange(MSX1, MSX2), RandomRange(MSY1, MSY2), 4, 4);
        1: HoverSkill('random', False);
        2..3: ExamineInv;
        4:
          begin
            HoverSkill('Fletching', False);
            Wait(RandomRange(2000, 4000));
          end;
        5:
          begin
            PickUpMouse;
            SleepAndMoveMouse(1500 + Random(500));
          end;
        6:
          begin
            GameTab(tab_Stats);
            Wait(1500 + Random(500));
            GameTab(tab_Inv);
          end;
        7..50:
          begin
            BoredHuman;
            SetAngle(SRL_ANGLE_HIGH);
          end;
        51: Wait(RandomRange(750, 2000));
      end;
    end;

    procedure WaitFinnish;
    var
      x, y: integer;
    begin
      if (Action = 'Fletch') then
      begin
        wait(randomrange(1000, 2000));
        Marktime(Counter);
        CallDTMs;
        while Existsitemdtm(ItemADTM, x, y) do
        begin
          case random(100) of
            1..9: Sleepandmovemouse(Randomrange(500, 1000));
            10..15: Antiban;
          end;
          if timefrommark(Counter) > 60000 then
          begin
            FreeAllDTMs;
            Exit;
          end;
        end;
        FreeAllDTMs;
      end
      else
      begin
        CallDTMs;
        wait(randomrange(1000, 2000));
        Marktime(Counter);
        while Existsitemdtm(ExtrasDTM, x, y) do
        begin
          case random(100) of
            1..9: Sleepandmovemouse(Randomrange(500, 1000));
            10..15: Antiban;
          end;
          if timefrommark(Counter) > 30000 then
          begin
            FreeAllDTMs;
            Exit;
          end;
        end;
        FreeAllDTMs;
      end;
    end;

    function WaitFindDTMBank(DTM: integer; var x, y: integer; MaxTime: integer): boolean;
    var
      t: integer;
    begin
      MarkTime(t) while (t < MaxTime) do
      begin
        if (findDTM(DTM, x, y, MSX1, MSY1, MSX2, MSY2)) then
        begin
          result := true;
          exit;
        end;
      end;
    end;

    function WaitDTMOptions(DTM: integer; var x, y: integer; MaxTime: integer): boolean;
    var
      t: integer;
    begin
      MarkTime(t) while (t < MaxTime) do
      begin
        if (findDTM(DTM, x, y, MCX1, MCY1, MCX2, MCY2)) then
        begin
          if Debug then
            WriteLn('Option Found');
          result := true;
          exit;
        end;
      end;
    end;

    function ChooseOptionDTM(DTM: Integer): boolean;
    var
      x, y: integer;
    begin
      if WaitDTMOptions(DTM, x, y, 300) then
      begin
        MMouse(x, y, 7, 7);
        ClickMouse2(true);
        if Debug then
          WriteLn('Option Chosen');
        result := true;
      end;
    end;

    function WithdrawXYEx(Xa, Ya, Amount: Integer; Uptexts: TStringArray): Boolean;
    var
      BBox: TBox;
      X, Y: Integer;
    begin
      Result := False;
      FixBank;
      BBox := IntToBox(Xa - 3, Ya - 3, Xa + 3, Ya + 3);
      GetMousePos(X, Y);
      if (not PointInBox(Point(X, Y), BBox)) then
        MouseBox(BBox.X1 + 5, BBox.Y1 + 5, BBox.X2 - 5, BBox.Y2 - 5, mouse_move);
      if (Length(Uptexts) > 0) then
        if (not WaitUptextMulti(Uptexts, 500)) then
          Exit;
      if (Amount = 1) then
        ClickMouse2(mouse_left)
      else
        ClickMouse2(mouse_right);
      if (Amount = 1) then
      begin
        Result := True;
        Wait(RandomRange(250, 550));
        Exit;
      end;
      if (Amount = - 1) then
      begin
        if (WaitOptionMultiEx(['Withdraw-All but', 'l b'], 'All', Nothing, 300)) then
          Result := ChooseOptionMulti(['Withdraw-All but', 'l b']);
      end
      else if (Amount = 0) then
      begin
        if (WaitOptionMultiEx(['Withdraw-All', 'w-A'], 'All', Nothing, 300)) then
          Result := ChooseOptionMulti(['Withdraw-All', 'w-A']);
      end
      else if (WaitOptionMultiEx(['Withdraw-' + IntToStr(Amount), 'w-' + IntToStr(Amount)], 'All', Nothing, 300)) then
        Result := ChooseOptionMulti(['Withdraw-' + IntToStr(Amount), 'w-' + IntToStr(Amount)]);
      if (not (Result)) and (Amount > 0) then
      begin
        if (not OptionsExist(['Withdraw', 'ithdraw', 'draw'], nothing)) then
          MouseBox(BBox.X1 + 5, BBox.Y1 + 5, BBox.X2 - 5, BBox.Y2 - 5, mouse_right);
        if WaitOptionMulti(['Withdraw-X', 'w-X'], 500) then
        begin
          X := GetSystemTime + 10000;
          while (X >= GetSystemTime) and (not (InRange(CountColor(0, 250, 396, 307, 410), 155, 165))) do
            Wait(50);
          Wait(RandomRange(75, 400));
          TypeSend(IntToStr(Amount));
          Result := True;
        end;
      end;
    end;

    function WithdrawXY(X, Y, Amount: Integer): Boolean;
    begin
      Result := WithdrawEx(X, Y, Amount, []);
      if Debug then
        WriteLn('Withdrew ' + inttostr(amount) + 'at: x' + inttostr(x) + '; y:' + inttostr(y));
    end;

    function BreakHandler(BreakIn, BreakFor, randBreakIn, randBreakFor: Integer): Boolean;
    var
      h, m, s, timeleft: integer;
    begin
      if not LoggedIn then
        Exit;
      if (HowManyPlayers = 1) then
      begin
        timeleft := (wb) + (yb) - GetTimeRunning;
        ConvertTIME(Timeleft, H, M, S);
        Writeln('Time Until Break: ' + IntToStr(h) + ' Hours, ' + Inttostr(m) + ' Minutes and ' + IntToStr(s) + ' Seconds');
        if (GetTimeRunning < ((wb) + (yb) + BreakRounds)) then
          Exit
        else if (GetTimeRunning > ((wb) + (yb) + BreakRounds)) then
        begin
          RealBTime := ((xb + zb) / 60000);
          Writeln('Taking a break for about ' + IntToStr(RealBTime) + ' minutes.');
          Logout;
          MarkTime(CurrentBTime);
          repeat
            Wait(21000);
            ConvertTime((xb + zb) - TimeFromMark(CurrentBTime), h, m, s);
            ClearDebug;
            Writeln('Breaktime left: ' + IntToStr(h) + ':' + IntToStr(m) + ':' + IntToStr(s));
          until (TimeFromMark(CurrentBTime) > (xb + zb));
          Writeln('Logging in.');
          if SwitchWorlds then
            if LoginPlayerToLob then
              ChangeWorld(RandomWorld(True, False))
            else
              LoginPlayer;
          Wait(4000);
          Result := LoggedIn;
          ClickNorth(SRL_ANGLE_HIGH);
          IncEx(BreakRounds, (wb) + (xb));
          Inc(TotalBreaks);
          Writeln('The next break will occur in about ' + IntToStr(BreakIn) + ' minutes.');
          wb := (BreakIn * 60000);
          xb := (BreakFor * 60000);
          yb := RandomRange( - Bir * 60000, Bir * 60000);
          zb := RandomRange( - Bfr * 60000, Bfr * 60000);
        end;
      end;
    end;

    procedure Fletch;
    begin
      wait(randomrange(200, 300));
      Invmouse(1, 3);
      if Debug then
        WriteLn('mouse moved to 1st inv slot');
      if Isuptext('Craft') then
      begin
        wait(randomrange(900, 1100));
        CallDTMs;
        ChooseOptionDTM(ExtrasDTM);
        ChooseOptionDTM(ItemBDTM);
        FreeAllDTMs;
      end;
    end;

    procedure StringBows;
    var
      x, y: integer;
    begin
      wait(randomrange(200, 300));
      CallDTMs;
      if ExistsItemDTM(ItemADTM, x, y) then
      begin
        FreeAllDTMs;
        MMouse(x, y, 7, 7);
        wait(200);
        if Isuptext('Use') then
          ClickMouse2(True);
        CallDTMs if ExistsItemDTM(ExtrasDTM, x, y) then
        begin
          FreeAllDTMs;
          MMouse(x, y, 7, 7);
          wait(200);
          ClickMouse2(True);
        end;
      end
      else
      begin
        FreeAllDTMs;
      end;
      CallDTMs ChooseOptionDTM(ItembDTM);
      FreeAllDTMs;
    end;

    procedure Bank;
    var
      x, y, chestDTM, failcount: Integer;
      aFound: Extended;
    begin
      ChestDTM := DTMFromString('mQwAAAHicY2ZgYOBkZmDgBWJhIFZmZGBQAmI5IM6MDWDITw5luHHuHAMHUB0MMyJhIAAAu7wFaA==');
      while not (bankscreen) and not (pinscreen) do
      begin
        Writeln('Time To Bank');
        if (finddtmrotated(ChestDTM, x, y, MSX1, MSY1, MSX2, MSY2, - Pi, Pi, Pi / 30, aFound)) then
        begin
          mmouse(x, y, 10, 10);
          if (WaitUpText('hest', 1000)) then
            Clickmouse2(True);
        end
        else
        begin
          ClickNorth(SRL_ANGLE_HIGH);
          case (random(4)) of
            1: MakeCompass('E');
            2: MakeCompass('N');
            3: MakeCompass('S');
            4: MakeCompass('W');
          end;
          inc(failcount);
        end;
        if failcount > 3 then
          terminatescript;
      end;
      freeDTM(ChestDtm);
      repeat
        if (PinScreen) then
           (InPin(Players[0].Pin));
      until (BankScreen);
      wait(randomrange(400, 800));
      Quickdeposit(SRL_DEPOSIT_ALL);
      if (CurrentBankTab <> Watbanktab) then
        Banktab(Watbanktab);
    end;

    procedure WithdrawFletch;
    var
      x, y: Integer;
    begin
      CallDTMs;
      if Debug then
        WriteLn('Withdraw log DTM Loaded');
      if Debug then
        WriteLn(ItemaDTM);
      if WaitFindDTMBank(ItemaDTM, x, y, 3000) then
      begin
        if Debug then
          WriteLn('Log DTM found');
        FreeAllDTMs;
        WithdrawXY(x, y, 0);
        Closebank;
        wait(randomrange(400, 600));
      end;
      FreeAllDTMs;
      Fletched := Fletched + 28;
    end;

    procedure Withdrawstring;
    var
      x, y: Integer;
    begin
      CallDTMs;
      if Debug then
        WriteLn('Bank DTM Load');
      if WaitFindDTMBank(ItemaDTM, x, y, 3000) then
      begin
        if Debug then
          WriteLn('BowDTM Found');
        FreeAllDTMs;
        WithdrawXY(x, y, 14);
        CallDTMs;
        if WaitFindDTMBank(ExtrasDTM, x, y, 3000) then
        begin
          if Debug then
            WriteLn('String DTM Found');
          FreeAllDTMs;
          WithdrawXY(x, y, 14);
        end;
        wait(randomrange(400, 600));
      end;
      Closebank;
      if Debug then
        WriteLn('Freeing DTMs');
      FreeAllDTMs;
      Fletched := Fletched + 14;
    end;

    function SkillStarted: boolean;
    var
      x, y, t: Integer;
    begin
      Marktime(t);
      if Debug then
        WriteLn('Checking Started');
      CallDTMs;
      while (timefrommark(t) < 5000) do
      begin
        if (FindDTM(ItemBDTM, x, y, MIX1, MIY1, MIX3, MIY3)) then
        begin
          if Debug then
            WriteLn('Started');
          FreeAllDTMs;
          Result := True;
          Exit;
        end;
        FreeAllDTMs;
        Result := False;
      end;
    end;

    procedure InvCheck;
    var
      Failcount: integer;
    begin
      if Debug then
        WriteLn('checking Inv');
      while (Invcount < 28) and (Failcount < 3) do
      begin
        Bank;
        case Action of
          'String': WithdrawString;
          'Fletch': WithdrawFletch;
        end
        inc(failcount);
      end;
      if (Failcount >= 3) then
        terminatescript;
    end;

    procedure Proggy;
    var
      xp: integer;
    begin
      XP := Round(Fletched * ItemXP);
      Writeln('********************************');
      Writeln('AIO Fletcher by EnSlaved ');
      Writeln('Time running = ' + (timerunning));
      Writeln('Items Done = ' + IntToStr(fletched));
      Writeln('EXP Earned = ' + IntToStr(XP));
      Writeln('Post Feedback and Proggies On Forum Thread Please!');
      Writeln('********************************');
    end;

    procedure DoString;
    var
      failed: integer;
    begin
      repeat
        Bank;
        WithdrawString;
        StringBows;
        if SkillStarted then
        begin
          Failed := 0;
          WaitFinnish;
          Proggy;
          if breaking then
            BreakHandler(BreakIn, BreakFor, Bir, Bfr);
        end
        else
        begin
          inc(Failed) if (failed > 3) then
            TerminateScript;
        end;
      until (AllPlayersInactive);
    end;

    procedure DoFletch;
    var
      failed: integer;
    begin
      repeat
        Bank;
        WithdrawFletch;
        Fletch;
        if SkillStarted then
        begin
          Failed := 0;
          WaitFinnish;
          Proggy;
          if breaking then
            BreakHandler(BreakIn, BreakFor, Bir, Bfr);
        end
        else
        begin
          inc(Failed) if (failed > 3) then
            TerminateScript;
        end;
      until (AllPlayersInactive);
    end;

    begin
      {$IFDef Smart}
      SRL_SixHourFix := True;
      Smart_FixSpeed := True;
      {$ENDIF}
      SetupSRL;
      Declareplayers;
      Loginplayer;
      MakeCompass('E');
      SetAngle(0);
      ExitSquealOfFortune;
      case Action of
        'String': DoString;
        'Fletch': DoFletch;
      end;
    end.

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
  •