Jump to content

Don't understand PriceLookup


Recommended Posts

Posted
40 minutes ago, sudoinit6 said:

So I need to figure out how to make use of this:

 

https://osbot.org/forum/topic/115417-item-id-tofrom-name-api-revised-pricelookup-api/#comment-1297366

 

 

Difficulty: I don't really know java.

 

Do I need to add a class to my script? Add something to my build path? Could someone please explain to me how to incorporate this into my scripts?

It's going to be hard to do stuff like this if you do not understand java. Please consider actually learning Java first :D

  • Like 1
Posted

If you want something easy just use this:

    private static int getPrice(final int id){
        try {
            URL url = new URL("http://api.rsbuddy.com/grandExchange?a=guidePrice&i=" + id);
            URLConnection con = url.openConnection();
            con.setUseCaches(true);
            BufferedReader br = new BufferedReader(new InputStreamReader(con.getInputStream()));
            String[] data = br.readLine().replace("{", "").replace("}", "").split(",");
            return Integer.parseInt(data[0].split(":")[1]);
        } catch(Exception e){
        	
        }
        return -1;
    }

put in the Item ID when you use it and if the item is tradeable it will return the osb price, if not it will return -1.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...