Jump to content

Don't understand PriceLookup


sudoinit6

Recommended Posts

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?

Link to comment
Share on other sites

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
Link to comment
Share on other sites

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.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

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