Jump to content

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


Recommended Posts

Posted (edited)

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
  • 1 month later...
Posted (edited)

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
Posted (edited)
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
Posted
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 :)
 

Posted
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

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

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

Posted (edited)
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
  • 1 year later...
  • 1 month later...

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