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.

[help] cant figure out whats wrong with my banking state

Featured Replies

I'm writing my first script that involves banking and as of now the script kills cows, loots the hides and walks to the bank(not as efficiently as it should though, still learning to code) when the inventory is full but is unable to bank. I have screen shots of my error message, my getState method and my bank state. In my bank state i've tried using the commented code and the current uncommented code and haven't had any luck. Can anyone point me in the right direction or is there anyone who knows exactly what that error means? 

Screen Shot 2017-04-04 at 6.34.18 PM.png

Screen Shot 2017-04-04 at 6.34.50 PM.png

Screen Shot 2017-04-04 at 6.35.00 PM.png

if (!bank.isOpen) {

    if (banker!=null) {

    banker.interact("Bank");

   
	sleepconditon until bank is open; 
}
} else {


getBank().depositAll(); 



}

Also, your script is going to break if you're not in the cows or bank area since you only call it to walk when you're there. 
Structure the script like this:

If (inv is full and !bank contains my player){
walk to bank 
} 



If (inv is full and bank contains my player){
bank
} 



If (!inv is full and !cowpen contains my player){
walk to cowpen 
} 

If (!inv is full and cowpen contains my player){
lootHides
} 

This will make the script not get stuck walking 

Edited by Juggles

From the stack trace, you can see that you have an NPE thrown at line 61 of your code. An NPE (null pointer exception) is an exception which is thrown when attempting to work with a null value (it's a bit more complicated that this, but essentially a null check is what you're looking for).

eJx37qS.png

Unfortunately I cannot tell which line is 61 in your code, but i'm guessing it's in the bank state where you define 'NPC banker = npcs.closest(...).' The next line will try and interact even if the banker is not present. To fix this, slip this line in:

NPC banker = npcs.closest("Banker");
if (banker != null) { banker.interact("Bank"); }

Also, just a side note, in your getState, instead of comparing true to true, simply use the evaluation: myPlayer().isUnderAttack().

myPlayer#isUnderAttack returns a boolean value so you can use this directly.

Good luck! let me know if you have any further questions :)

~apa

Edited by Apaec

  • Author

Thank you for the help! I changed my wait condition statement like you suggested i'll add that into the bank state. Line 61 turns out to be my condition statement for attacking, any idea as why that line may be causing me issues? @Apaec

Thanks for the reply! My script uses a path with specific corrdinates to walk and clicks on the position again if doesn't reach it in a certain time, do you think it could still get stuck and break? @Juggles

 

Edited by zeroter5

2 minutes ago, zeroter5 said:

Thank you for the reply! I changed my wait condition statement like you suggested i'll add that into the bank state. Line 61 turns out to be my condition statement for attacking, any idea as why that line may be causing me issues?

You need to check if cow is != null.

if (!myPlayer().isUnderAttack() && cow != null && ....)

7 minutes ago, zeroter5 said:

Thank you for the help! I changed my wait condition statement like you suggested i'll add that into the bank state. Line 61 turns out to be my condition statement for attacking, any idea as why that line may be causing me issues? @Apaec

Thanks for the reply! My script uses a path with specific corrdinates to walk and clicks on the position again if doesn't reach it in a certain time, do you think it could still get stuck and break? @Juggles

 

Yes because if you're not in the cow area, then you're not going to return state walk to bank. Same for walking to cows

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.