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.

How to pickup an item in bank when I hit a certain level?

Featured Replies

Yo. Basically, I'm trying to make a simple woodcutting script where when he's under level 21, he cuts trees with his iron axe and banks them. When he'd hit 21, he'd go at the bank and deposit everything and then, pickup a mithril axe to go back cut trees. At 31, he would go to bank, deposit all, withdraw an adamant axe and go cutting willows. However, I don't really know how to "say" it. It's like I would have needed a "when" statement for when I hit x level...

This is what it looks like right now. I know it is wrong.

6yM9XHt.png

Also, anyone knows why line 64 is underlined? It's pissing me off >_>

Thanks for the help :) 

Just put another If statement in the OnLoop that checks for your level and what axe to use for that level, ie:

 

// for pre-mith axe, if you're using just iron
if (getSkills.getStatic(Skill.WOODCUTTING) < 21) {
	// PUT REGULAR CODE HERE FOR CHOPPING W/ LESSER AXE
}
 
// example for mith axe                                             
else if (getSkills.getStatic(Skill.WOODCUTTING) >= 21) {                                              
	if (!getInventory.contains("Mithril axe") {
  		getWalking.webWalk(bank);
      	if bank.contains(myPlayer) {
        	if !getBank.isOpen() {
            	getBank.Open();
            }
         	if getBank.contains("Mithril axe") { // not checking if it is in inventory or not because we checked that prior to walking to bank
            	getBank.withdraw("Mithril axe")
            }
          	if getInventory.contains("Mithril axe") {
            	getBank.close();
            }
        }
  	}
  	else {
  		if !tree.contains(myPlayer) {
        	getWalking.webWalk(tree)
        }
      	else {
          // CHOPPING CODE HERE
        }
  	}
}
  
// onwards for the rest of the axes
else if (... >= 31) {}

...and so on.

 

EDITED IN A SAMPLE FOR WITHDRAWING THE AXE, MISREAD OP.

 

**don't copy my code directly, I wrote it here and I'm sure it has formatting and incorrect API use since I did it from memory, but use it as a basis if needed.

Edited by Magarac

Add a log to see if it throws anything at all for your first if statement, because it could just be a problem with the webwalk

Try making the line getSkills().getStatic(Skill.wc) > 20 rather than >= 21

Also change "Mithril Axe"  to "Mithril axe" as java is case sensitive :)

Edit: change "logs" to "Logs" aswell

and "Chop Down" to "Chop down"

  • Author
16 minutes ago, IHB said:

Add a log to see if it throws anything at all for your first if statement, because it could just be a problem with the webwalk

Try making the line getSkills().getStatic(Skill.wc) > 20 rather than >= 21

Also change "Mithril Axe"  to "Mithril axe" as java is case sensitive :)

Edit: change "logs" to "Logs" aswell

and "Chop Down" to "Chop down"

Logs is toLowerCase(). As for the rest, the Chop Down still works actually

2 minutes ago, Jeune Padawan said:

Logs is toLowerCase(). As for the rest, the Chop Down still works actually

For that maybe just do:

getDepositBox().depositAllExcept(Item -> item.getName.contains("axe"));

 

8 hours ago, Jeune Padawan said:

Yo. Basically, I'm trying to make a simple woodcutting script where when he's under level 21, he cuts trees with his iron axe and banks them. When he'd hit 21, he'd go at the bank and deposit everything and then, pickup a mithril axe to go back cut trees. At 31, he would go to bank, deposit all, withdraw an adamant axe and go cutting willows. However, I don't really know how to "say" it. It's like I would have needed a "when" statement for when I hit x level...

This is what it looks like right now. I know it is wrong.

6yM9XHt.png

Also, anyone knows why line 64 is underlined? It's pissing me off >_>

Thanks for the help :) 

Start by utilizing the boolean return on those method calls, this will make your script run smoother.

if(!bankArea.contains(myPlayer()) webwalk(bankArea)



if(!bank.isOpen())bank.open();

Even using dynamic sleeps is useful too

if(bank.isOpen()){

if(inventory.contains("logs")){

if(bank.depositAll(item -> item.getName().contains("logs"))){

new ConditionalSleep(4500, 500){ //timeout, recheck   so 4500ms is max sleep, check condition every 500ms

//condition method goes here. Returns boolean, if return true the sleeping will stop, if false it will continue to sleep until timeout

}.sleep();

}

}

 

Line 64, Item-> Item.getName()... Change the lambda variable to something like depositAll(it->i.getName().toLowerCase().contains("logs"). You're using a type as a variable name, but shouldn't be the issue. Read this http://stackoverflow.com/questions/1445233/is-it-possible-to-solve-the-a-generic-array-of-t-is-created-for-a-varargs-param

 

 

 

Edited by Polymorphism

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.