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.

Code being skipped ?

Featured Replies

Hey guys; I thought I should re-edit and make it a bit neater;

 

Here is my problem, this bit of code keeps getting skipped.

if (bank.isOpen()) {
			if(inventory.isEmpty()) {
				if (getBank().getWithdrawMode().equals(
						Bank.BankMode.WITHDRAW_NOTE)) {
					getBank().withdrawAll("Raw beef");
					log("Withdrawing Noted Beef");
					sleep(random(750, 1500));
				} else {
					bank.enableMode(Bank.BankMode.WITHDRAW_NOTE);
					log("changing to withdraw note mode");
					sleep(random(750, 1500));
				}
			} else {
					bank.depositAll();
			}
			sleep(random(1000, 2500));

The withdraw as a note method just constantly gets skipped;

 

I have a feeling its to do with my states, which are here;

private State getState() {
		if (!inventory.isFull() && cowArea.contains(myPlayer()))
			return State.PICKUP;
		if (inventory.contains("Raw Beef") && muleArea.contains(myPlayer()))
			return State.TRADE;
		if (!inventory.isFull() && !cowArea.contains(myPlayer()))
			return State.WALKTOPICKUP;
		if (inventory.isFull() && !muleArea.contains(myPlayer()))
			return State.WALKTOMULE;
		return State.WAIT;
	}

and

switch (getState()) {
		case PICKUP:
			doPickUp();
			break;
		case WALKTOMULE:
			getWalking().webWalk(muleArea);
			break;
		case TRADE:
			getNotedItems();
			tradeMule();
			offerItems();
			acceptTrade();
			break;
		case WALKTOPICKUP:
			getWalking().webWalk(cowArea);
			break;
		case STOP:
			this.stop();
			break;
		case WAIT:
			sleep(random(200, 300));
			break;
		}
		return random(200, 300);

	}

See I want to withdraw them as a note obviously so I can trade to my mule; however I think my return state for trade fails as I only want it to be recognized as a noted item; but it obviously just skips back to thinking it needs to walk back to cowarea which is not needed to be done till after its finished the trade method;

 

Any help would be appreciated as im stuck as lol

 

Edited by whipz


if open()

if withdrawmode is note

//withdraw

else setToNote()

else open()

  • Author
if open()
   if withdrawmode is note
      //withdraw
   else setToNote()
else open()

 

Thanks I have done that with this yet I still seem to have the problem it seems to skip it

if (bank.isOpen()) {
			if(inventory.isEmpty()) {
				if (getBank().getWithdrawMode().equals(
						Bank.BankMode.WITHDRAW_NOTE)) {
					getBank().withdrawAll("Raw beef");
					log("Withdrawing Noted Beef");
					sleep(random(750, 1500));
				} else {
					bank.enableMode(Bank.BankMode.WITHDRAW_NOTE);
					log("changing to withdraw note mode");
					sleep(random(750, 1500));
				}
			} else {
					bank.depositAll();
			}
			sleep(random(1000, 2500));
		} else {
				int rand = random(3);
				if (rand == 1) {
					closestBankBooth.interact("Bank");
					log("Using Bank Booth");
					sleep(random(750, 1500));
					
				} else {
					closestBanker.interact("Bank");
					log("Using NPC Banker");
					sleep(random(750, 1500));
				}
				sleep(random(1000, 2500));
				log("Opening Bank");
			}
		}
	}

what chris said.

 

also, you need to fix your bracketing and your comments. it is making your code more difficult to read than it needs to be

 

Its fine in my ide I just wasnt using the code thing at the top i was just using code in []

 

EDIT:

 

I just realised it could be with my states;

private State getState() {
		if (!inventory.isFull() && cowArea.contains(myPlayer()))
			return State.PICKUP;
		if (inventory.contains("Raw Beef") && muleArea.contains(myPlayer()))
			return State.TRADE;
		if (!inventory.isFull() && !cowArea.contains(myPlayer()))
			return State.WALKTOPICKUP;
		if (inventory.isFull() && !muleArea.contains(myPlayer()))
			return State.WALKTOMULE;
		return State.WAIT;
	}
public int onLoop() throws InterruptedException {
		switch (getState()) {
		case PICKUP:
			doPickUp();
			break;
		case WALKTOMULE:
			getWalking().webWalk(muleArea);
			break;
		case TRADE:
			getNotedItems();
			tradeMule();
			offerItems();
			acceptTrade();
			break;
		case WALKTOPICKUP:
			getWalking().webWalk(cowArea);
			break;
		case STOP:
			this.stop();
			break;
		case WAIT:
			sleep(random(200, 300));
			break;
		}
		return random(200, 300);

	}

Edited by whipz

  • Author

Does it do any of your bank method at all? 

 

Yeah mate, it does the deposit all then runs back to cows


if (!inventory.isFull() && !cowArea.contains(myPlayer()))
			return State.WALKTOPICKUP;

Well of course it will run back... inventory isnt full so its switching states

  • Author

if (!inventory.isFull() && !cowArea.contains(myPlayer()))
			return State.WALKTOPICKUP;

Well of course it will run back... inventory isnt full so its switching states

 

 

Yeah I just noticed it before that was the reason for edit; But i cant think of a way to get around it now while still needing to be in the same area to trade the mule;

 

If i was to add to that line that your on now that you quoted and added !bank.isOpen(); would that fix my problem ?

  • Author

In your run state, you can check if bank is open and contains raw beef. If it does, withdraw as noted 

 

run state ?

WalkToPickUp state. You know what i mean

 

just check bank for beef.

 

if contains beef

withdraw

 

then trade to mule

  • Author

WalkToPickUp state. You know what i mean

 

just check bank for beef.

 

if contains beef

withdraw

 

then trade to mule

 

I thought that was what you ment; wasnt sure if you wanted me to make another state to check bank haha sorry all new to this stuff; been a long time last time i did it we used nodes;

 

im testing it now (: 

WalkToPickUp state. You know what i mean

 

just check bank for beef.

 

if contains beef

withdraw

 

then trade to mule

 

if (!inventory.isFull() && !bank.isOpen() && !bank.contains("Raw beef")  && !cowArea.contains(myPlayer()))
return State.WALKTOPICKUP;
 
So I have done this now; and now it just sits at the bank with it open;
 
can close opened new thread open sourced

Edited by whipz

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.