Results 1 to 3 of 3

Thread: Max Guild Bonfire

  1. #1
    Join Date
    Jul 2014
    Posts
    86
    Mentioned
    3 Post(s)
    Quoted
    37 Post(s)

    Default Max Guild Bonfire

    Hello guys , this is my first script here. Decided to make it when i got bored of firemaking at maxguild.
    The script is obviously not flawless and any criticism is greatly appreciated.
    The only bug i found while running the script for few minutes was at 'waiting' part while throwing logs at bonfire

    Credits
    @Ashaman88 - took alot of stuff and ideas from his script
    @The Mayor - for his amazing tutorial
    @Coh3n - for his amazing tutorial
    ORIGINAL
    Simba Code:
    program MaxGuildBonfire;

    {$DEFINE SMART}              
    {$I SRL-6/SRL.simba}        
    {$I SPS/lib/SPS-RS3.Simba}  

    var
      logCount: extended;
      currentBTime, timeout, reset: TTimeMarker;
      w, x, y, z: integer;
      logDTM: integer;


    procedure declarePlayers();
    begin
      setLength(players, 1);
      with players[0] do
      begin
        loginName := 'user';
        password  := 'pass';
        isActive  := true;
        isMember  := true;
      end;
      currentPlayer := 0;
    end;

    procedure initScript();
    begin

      clearDebug();
      smartEnableDrawing := true;
      smartShowConsole := false;
      disableSrlDebug := true;
      smartPlugins := ['d3d9.dll'];
      setupSRL();
      addOnTerminate('terminate');
      if not isLoggedIn() then
      begin
      players[currentPlayer].login();
      end;

    end;

    procedure initPlayer();
    begin

        minimap.clickCompass;
        mainscreen.setAngle(MS_ANGLE_HIGH);

        if (not gameTabs.isTabActive(TAB_BACKPACK)) then
        gameTabs.openTab(TAB_BACKPACK);

    end;

    procedure setDTMs;
    begin

      logDTM := DTMFromString('mwQAAAHic42RgYOAFYmkgFgVibgYI4ILyZYBYEqpGFCrHAlUHEhcDYj4gZgViFx1OIMkIxExImBFJjJEhBaoWH2YkAsMBABO8AjM=');

      w := (players[currentPlayer].integers[0] * 60000);
      x := (players[currentPlayer].integers[1] * 60000);
      y := RandomRange(-13 * 60000, 13 * 60000);
      z := RandomRange(-7 * 60000, 7 * 60000);


    end;

    procedure terminate();
    begin
      freeDTM(logDTM);
    end;

    function countLogs: integer;
    var
      X,Y,I: Integer;
    begin
      result := tabBackpack.countDTM(LogDTM);
    end;

    Function maxguildbanking: Boolean;
    var
      x, y, i: integer;
      TPA: TPointArray;
      ATPA: T2DPointArray;

    begin
      if not isLoggedIn() then
        exit;

      repeat
      findColorsSpiralTolerance(x, y, TPA, 3776224, mainScreen.getBounds(), 23, colorSetting(2, 0.05, 1.18));

      if (Length(TPA) < 1) then
        exit;

      ATPA := TPA.toATPA(30, 30);
      ATPA.filterBetween(0, 70);
      ATPA.sortFromMidPoint(mainscreen.playerPoint);
      smartImage.debugATPA(ATPA);

      for i := 0 to high(ATPA) do
      begin
        mouse(middleTPA(ATPA[i]), MOUSE_MOVE);
        if isMouseOverText(['ank chest'], 500) then
        begin
          fastClick(MOUSE_LEFT);
          wait(randomRange(1500, 2500));
          smartimage.clear;
          break;
        end;
      end;
       until BankScreen.IsOpen();
    end;

    Function bankPrifddinas: Boolean;
    begin

      if not IsLoggedIn then
        Exit;

     repeat
      if BankScreen.IsOpen then
        begin
          typeSend('2', false);
          wait(randomrange(500,1000));
        end;
     Until (TabBackpack.IsItemInSlot(28));

     wait(randomrange(500,1000));

    end;

    Function addLogs: Boolean;
    var
      x, y, i: integer;
      TPA: TPointArray;
      ATPA: T2DPointArray;

    begin
      if not isLoggedIn() then
        exit;

        Result = false;

        findColorsSpiralTolerance(x, y, TPA, 4099397, mainScreen.getBounds(), 12, colorSetting(2, 0.96, 1.38));

        if (Length(TPA) < 1) then
          exit;

        ATPA := TPA.toATPA(30, 30);
        ATPA.filterBetween(0, 20);
        ATPA.sortFromMidPoint(mainscreen.playerPoint);
        smartImage.debugATPA(ATPA);

        for i := 0 to high(ATPA) do
        begin
          mouse(middleTPA(ATPA[i]), MOUSE_MOVE);
          if isMouseOverText(['Bonfire', 'onfire'], 500) then
          begin
            fastClick(MOUSE_LEFT);
            Result:= TabBackpack.WaitForShift(GaussRangeInt(2000,4000));
            smartImage.clear;
            break;
          end;
        end;

    end;

    Procedure Antiban();
    begin

      case random(600) of
        1..3:
          begin
            MouseOffClient(Random(4));
            Wait(GaussRangeInt(1000,7000));
          end;
        4..7:
          begin
            hoverSkill(Skill_Firemaking);
            Wait(GaussRangeInt(1000,2000));
            TabBackpack.Open;
          end;
        8..50:
          begin
            mousemovingobject;
          end;
        51..200:
          begin
            SleepAndMoveMouse(GaussRangeInt(1000,2500));
          end;
        201..400:
          begin
            MouseOffClient(Random(4));
            Wait(GaussRangeInt(1000,7000));
          end;
        401..600:
          begin
            Wait(RandomRange(250, 1500));
          end;
      end;

    end;

    procedure waiting;
    var
      inv1, time, inv2: integer;
      b: TBox;
      t: TTimeMarker;
    begin

      if not IsLoggedIn then
        Exit;

      T.Start;
      Inv1:= TabBackpack.Count;
      Inv2:= GaussRangeInt(0,5);
      Time:=GaussRangeInt(3500,5500);
      Repeat
        Wait(Random(100));
        if not IsLoggedIn then
          Exit;

        //if CountLogs>Inv2 then
          //AntiBan;

        if Inv1>TabBackPack.Count then
        begin
          Inv1:=TabBackPack.Count;
          T.Start;
          Timeout.Start;
          Reset.Start;
        end;

        if (ClaimTicket) Or (not IsLoggedIn) then
          Exit;
      Until (CountLogs=0) or (T.GetTime>Time);


    end;

    begin

      declarePlayers();
      initScript();
      initPlayer();

      setDTMs();


      Antiban();

      repeat

        maxguildbanking();
        bankprifddinas();

        repeat

          if addLogs then

              waiting();

         until TabBackpack.IsEmpty();

       until false;

       terminateScript();

    end.

    EDITED
    Simba Code:
    program MaxGuildBonfire;

    {$DEFINE SMART}              // Always have this to load smart
    {$I SRL-6/SRL.simba}         // To load the SRL include files
    {$I SPS/lib/SPS-RS3.Simba}   // To load the SPS include files

    var
      logDTM: integer;

    procedure declarePlayers();
    begin
      setLength(players, 1);
      with players[0] do
      begin
        loginName := 'user';
        password  := 'pass';
        isActive  := true;
        isMember  := true;
      end;
      currentPlayer := 0;
    end;

    procedure initScript();
    begin

      clearDebug();
      smartEnableDrawing := true;
      smartShowConsole := false;
      disableSrlDebug := true;
      smartPlugins := ['d3d9.dll'];
      setupSRL();
      addOnTerminate('terminate');
      if not isLoggedIn() then
      begin
      players[currentPlayer].login();
      end;

    end;

    procedure initPlayer();
    begin
        minimap.clickCompass;
        mainscreen.setAngle(MS_ANGLE_HIGH);
    end;

    procedure setDTMs;
    begin

      logDTM := DTMFromString('mwQAAAHic42RgYOAFYmkgFgVibgYI4ILyZYBYEqpGFCrHAlUHEhcDYj4gZgViFx1OIMkIxExImBFJjJEhBaoWH2YkAsMBABO8AjM=');

    end;

    procedure terminate();
    begin
      freeDTM(logDTM);
    end;

    function countLogs: integer;
    var
      X,Y,I: Integer;
    begin

      result := tabBackpack.countDTM(LogDTM);

    end;

    Function maxguildbanking: Boolean;
    var
      x, y, i: integer;
      TPA: TPointArray;
      ATPA: T2DPointArray;

    begin
      if not isLoggedIn() then
        exit;

      repeat
        findColorsSpiralTolerance(x, y, TPA, 3776224, mainScreen.getBounds(), 23, colorSetting(2, 0.05, 1.18));

        if (Length(TPA) < 1) then
          exit;

        ATPA := TPA.toATPA(30, 30);
        ATPA.filterBetween(0, 70);
        ATPA.sortFromMidPoint(mainscreen.playerPoint);
        smartImage.debugATPA(ATPA);

          for i := 0 to high(ATPA) do
            begin
              mouse(middleTPA(ATPA[i]), MOUSE_MOVE);
              if isMouseOverText(['ank chest'], 500) then

                begin
                  fastClick(MOUSE_LEFT);
                  smartimage.clear;
                  wait(randomRange(1500, 2000));
                  break;
                end;

            end;
      until BankScreen.IsOpen();
    end;

    Function bankPrifddinas: Boolean;
    begin

      if not IsLoggedIn then
        Exit;

      repeat
        if not bankScreen.isOpen() then
          break();

        if getItemAmount(bankScreen.getBankSlotBox(10)) < 28 then
          begin
            writeLn('Less than 28 logs left - shutting down');
            terminateScript();
          end;

        bankScreen.clickButton(BANK_BUTTON_PRESET_2)

      until tabBackpack.isItemInSlot(28);

      wait(randomrange(500,1000));

    end;

    Function addLogs: Boolean;
    var
      x, y, i: integer;
      TPA: TPointArray;
      ATPA: T2DPointArray;

    begin
      if not isLoggedIn() then
        exit;

      result := false;

      findColorsSpiralTolerance(x, y, TPA, 2855021, mainScreen.getBounds(), 15, colorSetting(2, 0.99, 1.42));

      if (Length(TPA) < 1) then
        exit;

        ATPA := TPA.toATPA(70, 70);
        ATPA.filterBetween(0, 70);
        ATPA.sortFromMidPoint(mainscreen.playerPoint);
        smartImage.debugATPA(ATPA);

        for i := 0 to high(ATPA) do

          begin
            mouse(middleTPA(ATPA[i]), MOUSE_MOVE);
            if isMouseOverText(['Bonfire', 'onfire'], 500) then
              begin
                fastClick(MOUSE_LEFT);
                Result:= TabBackpack.WaitForShift(GaussRangeInt(2500,4500));
                smartImage.clear;
                break;
              end;
          end;

    end;

    Function Antiban: Boolean;
    var
     r: Integer;
    begin
       r := random(300)
       case r of
        1..120:
          begin
            MouseOffClient(Random(4));
            Wait(GaussRangeInt(1000,7000));
            Result := True;
          end;
        121..130:
          begin
            hoverSkill(Skill_Firemaking);
            Wait(GaussRangeInt(1000,2000));
            TabBackpack.Open;
            Result := True;
          end;
        131..140:
          begin
            mousemovingobject;
            Result := True;
          end;
        141..170:
          begin
            SleepAndMoveMouse(GaussRangeInt(1000,2500));
            Result := True;
          end;
        171..300:
          begin
            MouseOffClient(Random(4));
            Wait(GaussRangeInt(1000,7000));
            Result := True;
          end;
      end;

    end;

    Function waiting(): Boolean;
    var
      prevCount, time: Integer;
      t: TTimeMarker;
    begin
      if not isLoggedIn() then
        exit();

      time := GaussRangeInt(4000,5500);
      prevCount := tabBackPack.count();
      t.start();

      repeat
        if not isLoggedIn() or claimTicket() then
          exit();

        if countLogs > 2 then
          Antiban;

        if prevCount > tabBackPack.count() then
        begin
          prevCount := tabBackPack.count();
          t.reset();                 // each time the count changes, reset timer
          t.start();
        end;

      until (t.getTime() > time) or (countLogs() = 0);

    end;

    begin

      declarePlayers();
      initScript();
      initPlayer();
      setDTMs();

       repeat
          if (tabBackpack.count >1) then
            begin
              repeat

                if addLogs then
                waiting;

              until TabBackpack.IsEmpty();
            end;

          maxguildbanking();
          bankprifddinas();

       until false;

      terminateScript();

    end.

  2. #2
    Join Date
    Jun 2007
    Location
    The land of the long white cloud.
    Posts
    3,702
    Mentioned
    261 Post(s)
    Quoted
    2006 Post(s)

    Default

    Looks good for a first script, good job


    o You can delete all of your global variables except LogDTM as they are not used.


    o There is no need for:
    Simba Code:
    if (not gameTabs.isTabActive(TAB_BACKPACK)) then
      gameTabs.openTab(TAB_BACKPACK);
    because openTab( ) checks that the tab is already open before clicking it, so delete the isTabActive( ).

    o I assume w, x, y, z are some sort of breaking variables that you never use?
    o You should avoid infinite loops like these:
    Simba Code:
    repeat
      if BankScreen.IsOpen then
        begin
          typeSend('2', false);
          wait(randomrange(500,1000));
        end;
     Until (TabBackpack.IsItemInSlot(28));
    what if typeSend('2) fails or you have less that 28 logs in the bank? You will keep spamming '2' until you manually stop the script. You can also use the preset button, maybe something like:
    Simba Code:
    repeat
      if not bankScreen.isOpen() then
        break();

      if getItemAmount(bankScreen.getBankSlotBox(10)) < 28 then
      begin
        writeLn('Less than 28 logs left - shutting down');
        terminateScript();
      end;

      bankScreen.clickButton(BANK_BUTTON_PRESET_2)

    until tabBackpack.isItemInSlot(28);

    o Your waiting procedure is a bit complicated and messy. You can clean it up by removing those unnecessary variables. Something like:
    Simba Code:
    procedure waiting();
    var
      prevCount, time: Integer;
      t: TTimeMarker;
    begin
      if not isLoggedIn() then
        exit();

      time := GaussRangeInt(3500,5500);
      prevCount := tabBackPack.count();
      t.start();

      repeat
        if not isLoggedIn() or claimTicket() then
          exit();

        if prevCount > tabBackPack.count() then
        begin
          prevCount := tabBackPack.count();
          t.reset();                 // each time the count changes, reset timer
          t.start();
        end;

      until (t.getTime() > time) or (countLogs() = 0);

    end;

  3. #3
    Join Date
    Jul 2014
    Posts
    86
    Mentioned
    3 Post(s)
    Quoted
    37 Post(s)

    Default

    Quote Originally Posted by The Mayor View Post
    o You should avoid infinite loops like these:
    Simba Code:
    repeat
      if BankScreen.IsOpen then
        begin
          typeSend('2', false);
          wait(randomrange(500,1000));
        end;
     Until (TabBackpack.IsItemInSlot(28));
    what if typeSend('2) fails or you have less that 28 logs in the bank? You will keep spamming '2' until you manually stop the script. You can also use the preset button, maybe something like:
    Simba Code:
    repeat
      if not bankScreen.isOpen() then
        break();

      if getItemAmount(bankScreen.getBankSlotBox(10)) < 28 then
      begin
        writeLn('Less than 28 logs left - shutting down');
        terminateScript();
      end;

      bankScreen.clickButton(BANK_BUTTON_PRESET_2)

    until tabBackpack.isItemInSlot(28);
    @The Mayor Thanks ! That clears some stuffs up
    Simba Code:
    repeat
          if not bankScreen.isOpen() then
            break();

          if BankScreen.IsOpen then
            begin
              typeSend('2', false);
              wait(randomrange(500,1000));

                if TabBackpack.count < 28 then
                  terminatescript;
            end;
      Until (TabBackpack.IsItemInSlot(28));
    This will be the same right ? Although your seems less complicated

    One more thing , is there any way i can make the bot click random atpa's between 1-3 ?

    Edit : Sometimes while waiting , it clicks on the bonfire again . I guess my colour is messed up ? and my antiban doesn't seem to work

    Also changed my main loop to work if it has existing logs
    Simba Code:
    begin

      declarePlayers();
      initScript();
      initPlayer();
      setDTMs();
      Antiban();

       repeat


        if (tabBackpack.count >=1) then
          begin

            repeat
              if addLogs then
                begin
                  if waiting then
                    Antiban();
                end;
            until TabBackpack.IsEmpty();

          end;

        maxguildbanking();
        bankprifddinas();

       until false;

       terminateScript();

    end.

    Edit : Antiban seems good now after adding this under waiting
    Simba Code:
    if countLogs > 2 then
          Antiban;

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
  •