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?