Hey guys, recently started developing with the OSbot API & Java, was wondering if some more experienced developers could take a look at my script and help with a few issues.
Most notably, it seems to loop over trading twice or three times before buying / hoping worlds and ive noticed it wont deposit the vials until the second trip has been completed.
Thanks!
@Override
public final int onLoop() throws InterruptedException {
if (!STORE.contains(myPosition())) {
getWalking().webWalk(STORE);
} else if (!getInventory().contains("Example item")) {
if (!getStore().isOpen()) {
getNpcs().closest("Assistant").interact("Trade");
}
if (getStore().getAmount("Example item") >= 950 && getStore().isOpen()) {
getStore().buy("Example item", 50);
getStore().close();
} else {
getStore().close();
getWorlds().hopToP2PWorld();
sleep(5000);
}
} else if (getInventory().contains("Example item")) {
getWalking().webWalk(BANK);
if (!getBank().isOpen()) {
getBank().open();
}
getBank().depositAll("Example item");
getBank().withdraw("Energy potion(1)",1);
getInventory().getItem("Energy potion(1)").interact("Drink");
sleep(500);
getBank().depositAll("Vial");
getBank().close();
}
if (!getInventory().contains("Coins") || getInventory().getAmount("Coins") <= 200) {
stop();
}
return 0;
}
** the vial issue seems to be everynow and again. Im sure this has something to do with waits and sleeps but any help would be appreciated.