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 properly use return values

Featured Replies

Sorry if this is a stupid question, I'm new to writing bots. What's the proper way to use the return value of something like 

 

bank.withdraw(x, 1);

 

is something like this safe or is there some convention?

 

while (!bank.withdraw(x, 1)) {

     sleep(random(100, 500));

}

You should learn how to write a basic java program before trying to script. There are plenty of online resources that are great to learn from but if you don’t know what a return value is or how to use it you’re going to have a very hard time scripting. 

34 minutes ago, KevDev said:

Sorry if this is a stupid question, I'm new to writing bots. What's the proper way to use the return value of something like 

 

bank.withdraw(x, 1);

 

is something like this safe or is there some convention?

 

while (!bank.withdraw(x, 1)) {

     sleep(random(100, 500));

}

while (!inventory.contains("itemname")){

bank.withdraw(x,1);

sleep(500);

}

Will attempt to withdraw the item until the boolean is true which is when item is in your inventory.

do not use while loops

NO

bank.withdraw returns a boolean result

if (bank.withdraw(...)){

  //we got an item

You can see return types per method here

http://osbot.org/api

You're already in a loop, no need to start another one. Use what @Chris said. I suggest learning more before trying to script.

Learn java basics, check the API and some scripts written in here, and use conditional sleep and some failsafe checks.

if (getBank().withdraw("CamelToe",69)) { 

log ("We withdrew a camel toe.");

} else {

log ("Camel toe was not withdrawn");

}

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.