Jump to content

GE Data (get price etc. by item name) no external libraries required


Explv

Recommended Posts

Thanks for the tutorial! 

 

How could I identify what ground item has been picked up and get the price of that item using this?

 

I have an array of items the script picks up but haven't been able to figure out how exactly to document the profit being made..

 

EDIT: NVM, got it.

Edited by Temsei
Link to comment
Share on other sites

  • 1 month later...

I'm making use of the ExchangeItem.java class multiple times throughout my code. On some occasions, fetching the price works and other times all price checks simply return 0.
Here's an example of price checks which return 0:
 

		Item[] inventoryItems = getInventory().getItems();
                    int j;
                    for(j = 0; j < inventoryItems.length; j++){
                        Item currentItem = inventoryItems[j];
                        if (currentItem != null) {
                            log("currentItem: " + currentItem.toString());
                            int jId = currentItem.getId();
                            String jName = currentItem.getName();
                            ExchangeItem jItem = new ExchangeItem(jName, jId);
                            int jPrice = jItem.getPrice();
                            log("Price: " + jPrice); //returns 0
                        }
                    }

Log example:
 

[INFO][Bot #1][02/22 12:54:38 AM]: currentItem: Item id: 995, Name: Coins, Amount: 8000
[INFO][Bot #1][02/22 12:54:38 AM]: Price: 0
[INFO][Bot #1][02/22 12:54:38 AM]: currentItem: Item id: 12288, Name: Mithril platebody (t), Amount: 1
[INFO][Bot #1][02/22 12:54:38 AM]: Price: 0
[INFO][Bot #1][02/22 12:54:38 AM]: currentItem: Item id: 1051, Name: Santa hat, Amount: 17
[INFO][Bot #1][02/22 12:54:39 AM]: Price: 0
[INFO][Bot #1][02/22 12:54:39 AM]: currentItem: Item id: 6740, Name: Dragon axe, Amount: 11
[INFO][Bot #1][02/22 12:54:39 AM]: Price: 0

Why is this happening?

Edited by Adept
Link to comment
Share on other sites

13 hours ago, Adept said:

I'm making use of the ExchangeItem.java class multiple times throughout my code. On some occasions, fetching the price works and other times all price checks simply return 0.
Here's an example of price checks which return 0:
 


		Item[] inventoryItems = getInventory().getItems();
                    int j;
                    for(j = 0; j < inventoryItems.length; j++){
                        Item currentItem = inventoryItems[j];
                        if (currentItem != null) {
                            log("currentItem: " + currentItem.toString());
                            int jId = currentItem.getId();
                            String jName = currentItem.getName();
                            ExchangeItem jItem = new ExchangeItem(jName, jId);
                            int jPrice = jItem.getPrice();
                            log("Price: " + jPrice); //returns 0
                        }
                    }

Log example:
 


[INFO][Bot #1][02/22 12:54:38 AM]: currentItem: Item id: 995, Name: Coins, Amount: 8000
[INFO][Bot #1][02/22 12:54:38 AM]: Price: 0
[INFO][Bot #1][02/22 12:54:38 AM]: currentItem: Item id: 12288, Name: Mithril platebody (t), Amount: 1
[INFO][Bot #1][02/22 12:54:38 AM]: Price: 0
[INFO][Bot #1][02/22 12:54:38 AM]: currentItem: Item id: 1051, Name: Santa hat, Amount: 17
[INFO][Bot #1][02/22 12:54:39 AM]: Price: 0
[INFO][Bot #1][02/22 12:54:39 AM]: currentItem: Item id: 6740, Name: Dragon axe, Amount: 11
[INFO][Bot #1][02/22 12:54:39 AM]: Price: 0

Why is this happening?

The item IDs are different to on rsbuddy (where I am getting the data from)

On rsbuddy Mithril platebody(t) is 12287 for example.

You should make use of the RSExchange class I wrote on the first page, passing the names of the items, to ensure that the correct IDs are used.

Edited by Explv
Link to comment
Share on other sites

3 hours ago, Explv said:

The item IDs are different to on rsbuddy (where I am getting the data from)

On rsbuddy Mithril platebody(t) is 12287 for example.

You should make use of the RSExchange class I wrote on the first page, passing the names of the items, to ensure that the correct IDs are used.

What a silly goose I am. I was passing the ID's of the noted version. RSbuddy needs the IDs of the unnoted version. One can avoid using the other class you provided by simply finding the unnoted ID's using the getUnnotedID() method.
Thanks for your help :)
 

Link to comment
Share on other sites

22 minutes ago, Adept said:

What a silly goose I am. I was passing the ID's of the noted version. RSbuddy needs the IDs of the unnoted version. One can avoid using the other class you provided by simply finding the unnoted ID's using the getUnnotedID() method.
Thanks for your help :)
 

Ah noted id, that makes sense

Link to comment
Share on other sites

  • 4 months later...
  • 2 months later...
  • 10 months later...

Hi @Explv, thanks for the snippet,

Map<String, ExchangeItem> exchangeItems = new RSExchange().getExchangeItems("Lobster",weapon(),ammo(),"Amulet of glory(6)","Ranging potion(4)");
rangingPotPrice = exchangeItems.get("Ranging potion(4)").getSellAverage()) 

This returns -1 sometimes and the correct answer othertimes, Its 50/50, am i doing something wrong

Link to comment
Share on other sites

2 hours ago, Luke Reading said:

Hi @Explv, thanks for the snippet,


Map<String, ExchangeItem> exchangeItems = new RSExchange().getExchangeItems("Lobster",weapon(),ammo(),"Amulet of glory(6)","Ranging potion(4)");

rangingPotPrice = exchangeItems.get("Ranging potion(4)").getSellAverage()) 

This returns -1 sometimes and the correct answer othertimes, Its 50/50, am i doing something wrong

No, you aren’t doing anything wrong. Sometimes if the price has not updated, being that an item has not been purchased to record data, on OSBuddy in the past 15 minutes (don’t quote me on that exactly, but it is within a specific time frame), the last cached value gets reset to a non existent price (-1). You should multi-cach these values, and have a static backup to reference to. Or you could create a method to obtain the buy-sell prices and go off of those. 

 

EDIT:

Another thing you could do is do is try grabbing prices off of RuneScape’s GE database as a backup. Lots of things you can try!

 

Hope this helps!

 

Edited by ProjectPact
  • Like 1
Link to comment
Share on other sites

  • 1 year later...
  • 1 month later...

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