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.

Feedback

Featured Replies

Hey guys, I recently made this code for one of my scripts. Its the part that handles the GE interactions. It would be awesome if you could leave me some feedback because i just recently started with scripting and im also not very familiar with java. The snippet i use for getting the prices for the certain items returns it in Optional<String>.

 

Spoiler

import java.io.IOException;
import java.util.Optional;

import org.osbot.rs07.api.model.NPC;
import org.osbot.rs07.script.MethodProvider;
import org.osbot.rs07.utility.ConditionalSleep;

import data.ItemLookup;
import data.Property;


public class GE {

	public GE(MethodProvider mp) throws IOException, InterruptedException {
		
		Optional<String> braceletMax = null;
		Optional<String> braceletMin = null;
		Optional<String> etherMax = null;
		Optional<String> etherMin = null;
		Optional<String> runeMax = null;
		Optional<String> runeMin = null;
		
		int braceletPrice;
		int etherPrice;
		int runePrice;
		int buyingAmount;
		
		
		if(!mp.getGrandExchange().isOpen()) {
			NPC clerk = mp.getNpcs().closest("Grand Exchange Clerk");
			if(clerk != null) {
				if(clerk.interact("Exchange")) new ConditionalSleep(2000) {
					
					@Override
					public boolean condition() throws InterruptedException {
						return mp.getGrandExchange().isOpen();
					}
				}.sleep();
			}
					
		} else {
			
			braceletMax = ItemLookup.get("Bracelet of ethereum (uncharged)", Property.BUY_AVERAGE); 
			braceletMin = ItemLookup.get("Bracelet of ethereum (uncharged)", Property.SELL_AVERAGE); 
			etherMax = ItemLookup.get("Revenant ether", Property.BUY_AVERAGE); 
			etherMin = ItemLookup.get("Revenant ether", Property.SELL_AVERAGE); 
			runeMax = ItemLookup.get("Nature rune", Property.BUY_AVERAGE); 
			runeMin = ItemLookup.get("Nature rune", Property.SELL_AVERAGE); 
			
			braceletPrice = Math.max(Integer.valueOf(braceletMax.get()), Integer.valueOf(braceletMin.get())) + 500;
			etherPrice = Math.max(Integer.valueOf(etherMax.get()), Integer.valueOf(etherMin.get())) + 20;
			runePrice = Math.max(Integer.valueOf(runeMax.get()), Integer.valueOf(runeMin.get())) + 20;
			buyingAmount = (int) (mp.getInventory().getAmount("Coins") / (braceletPrice + etherPrice + runePrice));
			
			
				if(mp.getGrandExchange().buyItem(21817, "ether", braceletPrice, buyingAmount)) new ConditionalSleep(5000) {
					
					@Override
					public boolean condition() throws InterruptedException {
						return !mp.getGrandExchange().isBuyOfferOpen();
					}
				}.sleep();
			
			if(!mp.getGrandExchange().isBuyOfferOpen()) {
				if(mp.getGrandExchange().buyItem(21820, "ether", etherPrice, buyingAmount)) new ConditionalSleep(5000) {
					
					@Override
					public boolean condition() throws InterruptedException {
						return !mp.getGrandExchange().isBuyOfferOpen();
					}
				}.sleep();
			}
			
			if(!mp.getGrandExchange().isBuyOfferOpen()) {
				if(mp.getGrandExchange().buyItem(561, "nature", runePrice, buyingAmount)) new ConditionalSleep(5000) {
					
					@Override
					public boolean condition() throws InterruptedException {
						return !mp.getGrandExchange().isBuyOfferOpen();
					}
				}.sleep();
			}
			
			if(mp.getGrandExchange().collect(true)) {
				new ConditionalSleep(2000) {
					
					@Override
					public boolean condition() throws InterruptedException {
						return !mp.getWidgets().isVisible(465, 6);
					}
				}.sleep();
			}
			
			if(mp.getGrandExchange().close()) new ConditionalSleep(2000) {
				
				@Override
				public boolean condition() throws InterruptedException {
					return !mp.getGrandExchange().isOpen();
				}
			}.sleep();
			
			Banker.bankStocked = true;
			
		}
	}
	
}

 

 

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.