karijuana Posted February 14, 2015 Share Posted February 14, 2015 (edited) I'm trying to empty a players inventory into the bank then continue the script, but the above two lines do nothing without error. if (!inventory.isEmpty()) { //banks if anything in inventory map.walk([sample coords]); //walk to bank bankbooth.interact("Bank"); //open bank bank.depositAll(); //empty inventory into bank bank.close(); //close bank window } Edited February 14, 2015 by karijuana Link to comment Share on other sites More sharing options...
Alek Posted February 14, 2015 Share Posted February 14, 2015 What version of OSBot are you using? Link to comment Share on other sites More sharing options...
karijuana Posted February 14, 2015 Author Share Posted February 14, 2015 What version of OSBot are you using? 2.3.28 Link to comment Share on other sites More sharing options...
Joseph Posted February 14, 2015 Share Posted February 14, 2015 if you are scripting like this you better be safe. you should be using more if statement to ensure the safety of the script. Link to comment Share on other sites More sharing options...
Mysteryy Posted February 14, 2015 Share Posted February 14, 2015 I'm trying to empty a players inventory into the bank then continue the script, but the above two lines do nothing without error. if (!inventory.isEmpty()) { //banks if anything in inventory map.walk([sample coords]); //walk to bank bankbooth.interact("Bank"); //open bank bank.depositAll(); //empty inventory into bank bank.close(); //close bank window } You have one conditional, its obvious that this code wouldn't work. You need to first walk the path until your in the bank, then if your in a bank or a bank is near by, you can interact with the bank, then if the bank is open you can deposit all. You are just throwing it all in sequential order, there is no way this should work. If it does it would be completely unstable. Link to comment Share on other sites More sharing options...
karijuana Posted February 14, 2015 Author Share Posted February 14, 2015 You have one conditional, its obvious that this code wouldn't work. You need to first walk the path until your in the bank, then if your in a bank or a bank is near by, you can interact with the bank, then if the bank is open you can deposit all. You are just throwing it all in sequential order, there is no way this should work. If it does it would be completely unstable. if you are scripting like this you better be safe. you should be using more if statement to ensure the safety of the script. I realize this now, thanks for the advice as it's my first time bot scripting. I need to sleep after each action as well. Link to comment Share on other sites More sharing options...
Mysteryy Posted February 14, 2015 Share Posted February 14, 2015 I realize this now, thanks for the advice as it's my first time bot scripting. I need to sleep after each action as well. Not necessarily. If you have well formed conditional statements you can avoid alot of sleeping. 1 Link to comment Share on other sites More sharing options...
pitoluwa Posted February 15, 2015 Share Posted February 15, 2015 You have to check everything everytime, to make sure, that step will be made 100%, not so hard to switch to that type of thinking Link to comment Share on other sites More sharing options...
Khaleesi Posted February 15, 2015 Share Posted February 15, 2015 (edited) I'm trying to empty a players inventory into the bank then continue the script, but the above two lines do nothing without error. if (!inventory.isEmpty()) { //banks if anything in inventory map.walk([sample coords]); //walk to bank bankbooth.interact("Bank"); //open bank bank.depositAll(); //empty inventory into bank bank.close(); //close bank window } Try to put everything in a statements, so only 1 action gets ran every loop. For example: if(inventory.isFull()){ if(inbank){ if(bank.isopen){ bank.depositAll(); }else{ //open bank } }else{ //walk bank } }else{ //whatever u have to do } This is way easier to debugg if anything goes wrong and doesn't take as much errors/ memory. Goodluck Edited February 15, 2015 by Khaleesi 1 Link to comment Share on other sites More sharing options...