Results 1 to 8 of 8

Thread: gametab.openTab(2) problem after opening bank screen

  1. #1
    Join Date
    Feb 2015
    Posts
    7
    Mentioned
    0 Post(s)
    Quoted
    1 Post(s)

    Default gametab.openTab(2) problem after opening bank screen

    I have a tiara making script that uses the Lumbridge furnace and am having a problem after I click the bank chest. Every time the bank screen opens, my mouse hovers over the area where the backpack tab would be to check if it is open. I don't want it to check if it's open because it wastes time and is irrelevant for this part of the script. My question is how do I get it to stop checking if the backpack is open?

    Here's the debug:
    Withdrawing bars
    -- TRSGameTabs.openTab(2)
    ---- Opening tab via gametab navigation bar
    -- TRSGameTabs.openTab(2): result = False

    Obviously it is false, because the bank screen is open.

    Code:
     if bankscreen.isOpen() then
        begin
          clearDebug();
          writeLn('Bank screen is open.');
          if bankScreen.getPackCountBitmap(SilverBar, 110) > 25 then
          begin
            clearDebug();
            if bankScreen.close() then
              walkToFurnace();
          end else
            clearDebug();
            writeLn('Withdrawing bars');
            withdrawBars();
            wait(RandomRange(785, 1024));
        end else
        begin
          if sps.getPlayerPos().isInBox(BankBox) then
          begin
            writeLn('Player is close to bank.');
            if tabBackpack.countBitmap(SilverBar, 110) > 26 then
            begin
              walkToFurnace();
              writeLn('Player has more than 26 silver bars. Walking to furnace.');
            end else
            begin
              writeLn('Looking for bank chest.');
              findBankChest();
            end;
          end;
         //Rest of script.
    Any suggestions?

  2. #2
    Join Date
    Jun 2012
    Posts
    4,867
    Mentioned
    74 Post(s)
    Quoted
    1663 Post(s)

    Default

    What's in the withdrawBars procedure?

  3. #3
    Join Date
    Dec 2011
    Location
    East Coast, USA
    Posts
    4,231
    Mentioned
    112 Post(s)
    Quoted
    1869 Post(s)

    Default

    Quote Originally Posted by dhbs View Post
    I have a tiara making script that uses the Lumbridge furnace and am having a problem after I click the bank chest. Every time the bank screen opens, my mouse hovers over the area where the backpack tab would be to check if it is open. I don't want it to check if it's open because it wastes time and is irrelevant for this part of the script. My question is how do I get it to stop checking if the backpack is open?

    Here's the debug:
    Withdrawing bars
    -- TRSGameTabs.openTab(2)
    ---- Opening tab via gametab navigation bar
    -- TRSGameTabs.openTab(2): result = False

    Obviously it is false, because the bank screen is open.

    Code:
     if bankscreen.isOpen() then
        begin
          clearDebug();
          writeLn('Bank screen is open.');
          if bankScreen.getPackCountBitmap(SilverBar, 110) > 25 then
          begin
            clearDebug();
            if bankScreen.close() then
              walkToFurnace();
          end else
            clearDebug();
            writeLn('Withdrawing bars');
            withdrawBars();
            wait(RandomRange(785, 1024));
        end else
        begin
          if sps.getPlayerPos().isInBox(BankBox) then
          begin
            writeLn('Player is close to bank.');
            if tabBackpack.countBitmap(SilverBar, 110) > 26 then
            begin
              walkToFurnace();
              writeLn('Player has more than 26 silver bars. Walking to furnace.');
            end else
            begin
              writeLn('Looking for bank chest.');
              findBankChest();
            end;
          end;
         //Rest of script.
    Any suggestions?
    The only bit of the function you provided that deals with the backpack is
    Simba Code:
    if tabBackpack.countBitmap(SilverBar, 110) > 26 then

    You may have to post the rest of your script, because there's nothing in that function (that I can see anyway) that is messing with the backpack.

    withdrawBars() may be the issue, as that is the only other bit that executes before the bankScreen is closed
    GitLab projects | Simba 1.4 | Find me on IRC or Discord | ScapeRune scripts | Come play bot ScapeRune!

    <BenLand100> we're just in the transitional phase where society reclassifies guns as Badâ„¢ before everyone gets laser pistols

  4. #4
    Join Date
    Feb 2015
    Posts
    7
    Mentioned
    0 Post(s)
    Quoted
    1 Post(s)

    Default

    I didn't know the etiquette about asking a question and then posting a bunch of random code so I avoided doing that. Here's the whole script:

    Code:
    program DamianTiaras;
    {$DEFINE SMART}
    {$i SRL-6/SRL.simba}
    {$i srl-6/lib/misc/srlplayerform.simba}
    {$I SPS/lib/SPS-RS3.Simba}
    
    var
      i, Tiara, SilverBar, BarsCrafted, TiaraCount, LoadsDone, InitialCount, Experience, ScriptRunTime, XPRate: integer;
      ScriptTimer, ChopTimer: TTimeMarker;
      BankBox, FurnaceBox: TBox;
    
    procedure DeclarePlayers; // Where all your players are to be setup
    begin
      Players.setup(['me'], 'default');
      currentplayer := 0;
    
    end;
    
    procedure loadBMPs;
    begin
    
       Tiara := BitmapFromString(30, 15, 'meJxdk+9rUlEYx+/2oryYNHvVft' +
            '2yW9ui7EV/yBgSjSEiIiIiE7G1FiLDtcS1JjYRJVwN6kV/Zp97v9d' +
            'ncuFwOD+e53O+53ues+w4L5+ktrzU08f3nq8lgn4jSb+9mWTK1vam' +
            'm82k3u480q7CaK/89DwgSW+DZcehZf10MZ9nICDrlgiNHuybF2lN2' +
            'Q0OXU0ogLFSCECY4KA+tVqFgwMGtUqFfslxLFI9TGUpxZrCYnAbgP' +
            'rYbL7b22PQOjwU+S4xvKM11Gb9u9xgN7MSnei5LL5+9hAZMgfUh0Z' +
            'DwF63u0hWriDckTEOyzprUaTnii/HEIDP7DZqNQHpJT50NRBmL2LW' +
            'VcvlcrHIi+T399/ncgHcc7WLYF1HpyjYyIN+X3A9lj20bvdrMpleX' +
            '48Hgx+Xl0R+Oz9XopgxDfZqIo+urrrttuAxh0X+ORoZuX92Zu4tyH' +
            'DlQ71a1e7WRrCCJNy2N43ePcwy8mQ4RIDIMQ2yl0po1usmeMd7QEk' +
            'z/d7rtY+PsUhZSqRH6u/pVGTTbMLsX1APi2TWIdOYkoUhBHAj+KVC' +
            'QSl/ZjPIs/FYZARA/tLpWJ1gLClgBY++xloCrL96n/oUnERs4Qj0Y' +
            'w4pf29uYmQCIOd2dykSSoWCqZRKxo80Z1b89WRADj8Ii8OLCy6uYs' +
            'BVOCKbG3Y098ITUAjgO9PbBwmez0sF5PX5pwuVo5ZcsPD/3d4aWbV' +
            'h5M7JCZGfj45oIhtWNPkMU1MVsOqHlK+np7gKjYcDy40oZrNLWDN8' +
            'af524Wd0qbr/z3Ep3Q==');
       SilverBar := BitmapFromString(30, 19, 'meJytlU1OwzAUhAsLSAgR7Q5CWh' +
            'pS0laiVJyiC87UFVep1AUSZ+RzJjJRfoxDK42sOHK+N5pnO0Uarp/' +
            'i1+c7RrScRoskWKQR0pvL0ehzv3eIBWZ9EuhzRqb5wzUSpBpLbPWQ' +
            'BH9ivw4HxDIkJ/owf4xWs9vfNzWr62zsibUSX8LwJp/A2WRxMYtFF' +
            'nwo1spGhOe3lwmyWZ2O/T4eIeAZ4Pz+Cg3K1oEVuUhvjNVsfC63lr' +
            'yaG6ZJo+b2Y7ez+gdWZLPrkoAOdmIb8sdelB2kdz7YTnIfFrGlPbF' +
            '95NOxbXIflniJgun7disNCqQXW541tlyd3CjRWcWNrW6klmefEg6s' +
            'mLot2XJucruEI9v6RUoH1UTJpwTqdAtQTA7dchqShk6KFniWaGOt7' +
            'J0GmdNtp54lGiHYnxFuy4cQYfgHflgigw==');
    
       end;
    
    procedure walkToFurnace;
    begin
      sps.walkToPos(Point(262,221));
    end;
    
    procedure walkToBank;
    begin
      sps.walkToPos(Point(210,214));
    end;
    
    function findBankChest(): boolean;
    var
      x, y, i: integer;
    begin
    
      repeat
        mainscreen.findObject(x, y, 4809091, 15, colorSetting(2, 0.07, 0.24), mainscreen.playerPoint, 25, 30, 25, ['ank', 'chest'], MOUSE_LEFT);
        //mouse(Point(x, y), MOUSE_MOVE, MOUSE_HUMAN);
        wait(randomRange(500, 600));
        //i := i + 1;
        result := true;
      until result;
    
    end;
    
    function depositItems(): boolean; //don't need this function because of quick withdraw option in bank screen
    begin
      repeat
         bankScreen.quickDeposit(QUICK_DEPOSIT_INVENTORY);
         if bankScreen.getPackCount() < 1 then
           result := true;
      until(result) or not bankScreen.isOpen(150);
    
    
    end;
    
    function withdrawBars(): boolean;
    var x, y: integer;
    
    begin
      x := randomRange(183, 212);
      y := randomRange(569, 586);
      repeat
        if bankScreen.isOpen(50) then
          mouse(Point(x, y), MOUSE_LEFT, MOUSE_HUMAN);
          //if bankScreen.isPackFull() then
          begin
            result := true;
            inc(LoadsDone);
          end;
      until(result)
    
    end;
    
    function clickFurnace(): boolean;
    var x, y: integer;
    
    begin
      repeat
        mainscreen.findObject(x, y, 6123381, 9, colorSetting(2, 0.13, 0.31), mainscreen.playerPoint, 80, 60, 25, ['melt', 'urnace'], MOUSE_LEFT);
        wait(randomRange(333, 555));
        if productionScreen.isOpen(1500) or progressScreen.isOpen(150) then
          result := true;
    
      until(result);
    end;
    
    function startCrafting(): boolean;
    var x, y: integer;
    
    begin
      repeat
    
        if productionScreen.isOpen(100) then
          if productionScreen.clickStart() then
            result := true;
    
        if progressScreen.isOpen(100) then
          result := true;
      until(result);
    end;
    
    begin
      setupSRL();
      //declarePlayers();
      //Players[currentPlayer].login();
      sps.setup('lumbridge_furnace_map', runescape_other);
      loadBMPs();
    
      bankBox.edit(200, 200, 235, 235);
      furnaceBox.edit(238, 214, 271, 234);
      LoadsDone = 0;
      //InitialCount := tabBackpack.countBitmap(Tiara, 110);
      ScriptTimer.Start();
    
      repeat
    
        if bankscreen.isOpen() then
        begin
          clearDebug();
          writeLn('Bank screen is open.');
          if bankScreen.getPackCountBitmap(SilverBar, 110) > 25 then
          begin
            clearDebug();
            if bankScreen.close() then
              walkToFurnace();
          end else
            clearDebug();
            writeLn('Withdrawing bars');
            withdrawBars();
            wait(RandomRange(785, 1024));
        end else
        begin
          if sps.getPlayerPos().isInBox(BankBox) then
          begin
            writeLn('Player is close to bank.');
            if tabBackpack.countBitmap(SilverBar, 110) > 26 then
            begin
              walkToFurnace();
              writeLn('Player has more than 26 silver bars. Walking to furnace.');
            end else
            begin
              writeLn('Looking for bank chest.');
              findBankChest();
            end;
          end;
          if sps.getPlayerPos().isInBox(FurnaceBox) then
          begin
            writeLn('Player is close to the furnace.');
            if tabBackpack.countBitmap(SilverBar, 110) > 0 then
            begin
              writeLn('Player still has silver bars left in your inventory.');
              if not progressScreen.isOpen(150) then
                if clickFurnace() then
                begin
                  BarsCrafted := LoadsDone*28 + tabBackPack.countBitmap(Tiara, 110) - InitialCount;
                  writeLn('Crafting tiaras.');
                  startCrafting();
                end;
            end;
            if tabBackpack.countBitmap(SilverBar, 110) < 1 then
            begin
              clearDebug();
              writeLn('Player has no more silver bars to craft. Walking to bank.');
              walkToBank();
            end;
          end;
        end;
    
        BarsCrafted := LoadsDone*28 + tabBackPack.countBitmap(Tiara, 110) - InitialCount;
        writeLn('Tiaras made ' + IntToStr(BarsCrafted));
        Experience := round(BarsCrafted*52.5);
        writeLn('Experience gained: ' + IntToStr(Experience));
        ScriptRunTime := round(scriptTimer.getTime()/1000);
        writeLn('Time running ' +  timeRunning);
        if (ScriptRunTime > 0) then
        begin
          XPRate := round(Experience*3600/ScriptRunTime);
          writeLn('XP/hour: ' +  IntToStr(XPRate));
        end;
    
    
    
      until(false);
    end.

  5. #5
    Join Date
    Jun 2012
    Posts
    4,867
    Mentioned
    74 Post(s)
    Quoted
    1663 Post(s)

    Default

    I see this is commented out now, was it when you were getting that debug?
    Simba Code:
    //if bankScreen.isPackFull() then

  6. #6
    Join Date
    Feb 2015
    Posts
    7
    Mentioned
    0 Post(s)
    Quoted
    1 Post(s)

    Default

    Quote Originally Posted by BMWxi View Post
    I see this is commented out now, was it when you were getting that debug?
    Simba Code:
    //if bankScreen.isPackFull() then
    Yep I was getting the same debug with that commented out.

  7. #7
    Join Date
    Feb 2015
    Posts
    7
    Mentioned
    0 Post(s)
    Quoted
    1 Post(s)

    Red face

    Wow just figured it out. This was the problem:

    Code:
    BarsCrafted := LoadsDone*28 + tabBackPack.countBitmap(Tiara, 110) - InitialCount;
    Changed it to this:

    Code:
    if not bankScreen.isOpen(1000) then
          BarsCrafted := LoadsDone*28 + tabBackPack.countBitmap(Tiara, 110) - InitialCount;
    Thanks for the quick replies

  8. #8
    Join Date
    Jul 2015
    Posts
    15
    Mentioned
    0 Post(s)
    Quoted
    4 Post(s)

    Default

    Hate to necro, but if this thread already exists, so be it ^_^.

    I'm now having this issue too! Our circumstances are similar, but I don't see how your change of code fixed it . Glad it worked for you, though!
    Here's my script. This issue happens every time it opens the bank. Thanks for your help in advance .
    Code:
    program GnarlyBows;
    
    {$DEFINE SMART}              
    {$I SRL-6/SRL.simba}         
    
    procedure declarePlayers();
    begin
      setLength(players, 1);
      with players[0] do
      begin
    
        isActive := true;
        isMember := true;
      end
      currentPlayer := 0;
    end;
    procedure setupPlayer;
    begin
      if not isLoggedIn() then
        exit;
      wait(gaussRangeInt(500, 3000));
      minimap.clickCompass;
      wait(gaussRangeInt(200, 1500));
      mainscreen.setAngle(MS_ANGLE_HIGH);
      wait(gaussRangeInt(500, 1000));
    end;
    procedure doBank();
    begin
     if not isLoggedIn() then
      exit;
        wait(gaussRangeInt(300, 600));
          bankScreen.__openChest(11);
        writeln('Found bank! Opening it up.');
        wait(gaussRangeInt(160, 300));
          bankScreen.quickDeposit(0);
        writeln('Depositing items and withdrawing logs');
        wait(gaussRangeInt(160, 300));
        if not tabBackpack.isFull() then
        begin
          bankScreen.withdraw(1, -1, ['']);  //withdrawing all from 1st bank slot
          bankScreen.close();
          wait(gaussRangeInt(100, 500));
        end;
    end;
    procedure doFletchBow();
    var
    failTimer : TTimeMarker;
    begin
      if not isLoggedIn() then
        exit;
      tabBackpack.open();
      wait(gaussRangeInt(160, 300));
      tabBackpack.mouseSlot(28, MOUSE_LEFT);
        if toolScreen.isOpen(2000) then
         toolScreen.select('Knife');
         if productionScreen.isOpen(5000) then
            begin
              failTimer.start();
              productionScreen.selectBox(2);
              productionScreen.clickStart();
              if productionScreen.clickStart(false) then
              begin
              productionScreen.close();
              end;
            end;
              if progressScreen.isOpen(5000) then
                begin
                  mouseOffClient(random(4));
                  wait(gaussRangeInt(1000, 5000));
                    writeLn('The progressScreen is open!');
                    repeat
                      wait(1000);
                    until (not progressScreen.isOpen());
                      wait(gaussRangeInt(160, 300));
                end;
                      if (failTimer.getTime() > 55000) then
                      begin
                      if productionScreen.isOpen() then
                      productionScreen.close();
                      end;
    end;
    
    begin
    clearDebug();
    smartEnableDrawing :=true;
    setupSRL();
    declarePlayers();
    setupPlayer();
    repeat
    if not isLoggedIn() then
      begin
       players[currentPlayer].login();
       exitSquealOfFortune();
       mainScreen.setAngle(MS_ANGLE_HIGH);
       minimap.setAngle(MM_DIRECTION_NORTH);
      end;
    doBank();
    doFletchBow();
    until players.getActive() < 1;
    end.
    And here is the error message:

    Code:
     
    Found bank! Opening it up.
    ---- bankScreen.quickDeposit(): Clicked quick deposit id 0
    Depositing items and withdrawing logs
    -- TRSGameTabs.openTab(2)
    ---- Opening tab via gametab navigation bar
    -- TRSGameTabs.openTab(2): result = False
    EDIT:: ahahaha and just to prove to everyone that I am, indeed, as nooby as it gets, I left my username and password in the code
    Also, removing the "if not tabBackpack.isfull() then blahblah" seemed to do the trick. Shame, 'cause I liked that function. Realized that was the issue when I didn't have that function on the other two bank commands. gg at necroing. and life. it's time for sleepsies.
    Last edited by Snoozie; 07-16-2015 at 11:26 AM.

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
  •