Kenn Posted December 14, 2015 Share Posted December 14, 2015 if (!getInventory().contains("Lobster pot")) { if (!getBank().open()) { getBank().open(); if (getBank().contains("Lobster pot")) getBank().getItem("Lobster pot"); System.out.println("Taken a lobster pot out of the bank to fish with."); while (!getBank().isOpen()) { sleep(random(200, 300)); localWalker.walkPath(backFishing); } return 2000; } } I'm not sure why but this doesn't seem to work.. If my inv doesn't contain the item lobster pot, open bank and get the item out and then it should go fish... It opens the bank but just closes it and walks away.. ? Quote Link to comment Share on other sites More sharing options...
blm95 Posted December 14, 2015 Share Posted December 14, 2015 (edited) bank.withdraw("Lobster pot", 1); Edited December 14, 2015 by blm95 1 Quote Link to comment Share on other sites More sharing options...
FrostBug Posted December 14, 2015 Share Posted December 14, 2015 There are quite a few logical flaws in this code :| first off if (!getBank().open()) { You will only enter this if-statement if the attempt to open the bank fails. Did you mean !getBank().isOpen() ? Even if that is the case, doing something only if the bank is not open is a strange way to proceed. next: getBank().open(); if (getBank().contains("Lobster pot")) getBank().open() will only do the interaction. It will not wait for the actual bank widget to appear. So odds are the bank is still not open when you check for the lobster pot. getBank().getItem("Lobster pot"); This simply gets the item instance. It does not withdraw an item from the bank. To withdraw an item, use the withdraw methods. while (!getBank().isOpen()) { sleep(random(200, 300)); localWalker.walkPath(backFishing); } Not sure what to even say to this part. You walk back to the finishing spot in an eternal loop until the bank is open again? How is walking back to the fishing spot ever going to result in the bank opening?I can only see this piece of code locking the script Try to revise it a bit; generally you should avoid doing multiple interactions in the same loop cycle, and also avoid potentially infinite loops. 1 Quote Link to comment Share on other sites More sharing options...
Chris Posted December 14, 2015 Share Posted December 14, 2015 getBank().withdraw("Lobster pot", 1); Quote Link to comment Share on other sites More sharing options...
Explv Posted December 14, 2015 Share Posted December 14, 2015 if (!getInventory().contains("Lobster pot")) { if (!getBank().open()) { getBank().open(); if (getBank().contains("Lobster pot")) getBank().getItem("Lobster pot"); System.out.println("Taken a lobster pot out of the bank to fish with."); while (!getBank().isOpen()) { sleep(random(200, 300)); localWalker.walkPath(backFishing); } return 2000; } } I'm not sure why but this doesn't seem to work.. If my inv doesn't contain the item lobster pot, open bank and get the item out and then it should go fish... It opens the bank but just closes it and walks away.. ? You should take a look at using a state based system for your scripts. That code could potentially have some bugs in it. For example, what happens if the bank opening process gets interrupted? Your script will just walk back to the fishing spot without having retrieved a lobster pot. Quote Link to comment Share on other sites More sharing options...
liverare Posted December 14, 2015 Share Posted December 14, 2015 I won't spoon feed you the answer, but your logic should be structured similarly to this: IF inventory does not contain lobster pot --IF bank is open ----IF bank contains lobster pot ------DO withdraw one lobster pot ----ELSE ------DO stop script --ELSE IF in bank ----DO open bank ELSE DO some fishing Quote Link to comment Share on other sites More sharing options...