Jump to content
View in the app

A better way to browse. Learn more.

OSBot :: 2007 OSRS Botting

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Cant get bot to bank + withdraw food

Featured Replies

This is what i have:

 

 private State getState() {
        int HpPercent = (getSkills().getDynamic(Skill.HITPOINTS) * 100/getSkills().getStatic(Skill.HITPOINTS));
        NPC farmer = getNpcs().closest("Master Farmer");
        if (getInventory().isFull())
            return State.BANK;

case BANK:
            log("Bank");
            if(inventory.isFull() && !getInventory().contains("Lobster")) {
                NPC user = getNpcs().closest("Banker");
                getNpcs().closest("Banker").interact("Bank");
                user.interact("Bank");
                getBank().getItem("Lobster");
            }
 break;

I'm not really sure what you're trying to do with the code you have, I think you've misunderstood the idea behind some of the API methods and you might need to brush up a little on your general java understanding, however I think this should help:

case BANK:
    if (getBank().isOpen()) {
      getBank().withdraw("Lobster", 28);
    } else {
      NPC banker = getNpcs().closest("Banker");
      if (banker != null && banker.exists()) {
        banker.interact("Bank");
        sleep(2000); // Put a conditional sleep here!
      } else {
        stop(); // Stop if banker could not be found. You will probably need to add walking here
      }
    }
	break;

The code that i've given you above is very generalised and needs modifications, but it should hopefully be a good starting point for getting your code to do something!

-Apa

  • Author
Just now, Apaec said:

I'm not really sure what you're trying to do with the code you have, I think you've misunderstood the idea behind some of the API methods and you might need to brush up a little on your general java understanding, however I think this should help:


case BANK:
    if (getBank().isOpen()) {
      getBank().withdraw("Lobster", 28);
    } else {
      NPC banker = getNpcs().closest("Banker");
      if (banker != null && banker.exists()) {
        banker.interact("Bank");
        sleep(2000); // Put a conditional sleep here!
      } else {
        stop(); // Stop if banker could not be found. You will probably need to add walking here
      }
    }
	break;

The code that i've given you above is very generalised and needs modifications, but it should hopefully be a good starting point for getting your code to do something!

-Apa

Thanks bud. much appreciated

Does this even compile?

 if(inventory.isFull() && !getInventory().contains("Lobster")) {

this check if your inventory is Full and if it doens't contain a lobster, though nowhere later it deposits the stuff.

Try something like 

if (inventory.isFull()) {
  if (!bank.isOpen()) {
    NPC banker = getNpcs().closest("Banker");
    if (banker != null) {
      banker.interact("Bank");
   } else {
    bank.depositAll();
    bank.withdraw("Lobster", 1);
   bank.close();
  }
}
	

Add some sleeps in between and etc. Check if you're in the banking area, check your conditions when to bank and etc

Edited by nosepicker

Create an account or sign in to comment

Recently Browsing 0

  • No registered users viewing this page.

Account

Navigation

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.