Skip 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.

Loot Above Price Range

Featured Replies

How would I make my combat script loot items above a certain price? 

I'm assuming you need to connect it to an external site that has the price of items or maybe directly connect it to the GE but I've searched the API and have failed to find something like this.

API

package me.Sinatra.Machine.Data;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.URL;

public class GrandExchangeAPI
{
  private static final String BASE = "https://api.rsbuddy.com/grandExchange?a=guidePrice&i=";
  
  public int getOverallPrice(int itemID)
    throws IOException
  {
    return parse(itemID, "overall");
  }
  
  public int getBuyingPrice(int itemID)
    throws IOException
  {
    return parse(itemID, "buying");
  }
  
  public int getSellingPrice(int itemID)
    throws IOException
  {
    return parse(itemID, "selling");
  }
  
  private int parse(int itemID, String choice)
    throws IOException
  {
    URL url = new URL("https://api.rsbuddy.com/grandExchange?a=guidePrice&i=" + itemID);
    BufferedReader file = new BufferedReader(new InputStreamReader(url.openStream()));
    
    String price = null;
    String line;
    while ((line = file.readLine()) != null)
    {
      if (line.contains("{")) {
        price = line.trim();
      }
    }
    if (choice.equals("buying")) {
      price = price.substring(price.indexOf(",") + 10, nthOccurrence(price, ',', 1)).trim();
    } else if (choice.equals("selling")) {
      price = price.substring(nthOccurrence(price, ',', 2) + 11, price.indexOf("sellingQuantity") - 2).trim();
    } else {
      price = price.substring(price.indexOf(":") + 1, price.indexOf(",")).trim();
    }
    file.close();
    return Integer.parseInt(price);
  }
  
  private int nthOccurrence(String str, char c, int n)
  {
    int pos = str.indexOf(c, 0);
    while ((n-- > 0) && (pos != -1)) {
      pos = str.indexOf(c, pos + 1);
    }
    return pos;
  }
}

Usage

//in some class
private GrandExchangeAPI grandExchange;



//loot usage
this.grandExchange = new GrandExchangeAPI();

if conditions for loot
int worth = this.grandExchange.getSellingPrice(loot.getId());
if worth condition
     take

//Simple layout..clean it up and try to use it yourself.
//hope I managed to give insight

Edited by Sinatra

Create an account or sign in to comment

Recently Browsing 0

  • No registered users viewing this page.

Account

Navigation

Search

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.