Jump to content

Get item id for item not in inventory


sudoinit6

Recommended Posts

Programatically getting the id from a string is a lot harder than vice versa but there are two main ways I can think of to do it. First is to scrape a site such as the one @Apaec linked, second is to loop the Item Definition cache until you find the string you're looking for (make sure to check that it's not noted or anything). 

Link to comment
Share on other sites

1 minute ago, Apaec said:

I believe there's a list here: http://www.itemdb.biz/

I am looking for a way for the bot to get the id without the item. The GE api requires the item id for

buyItem(int itemId, java.lang.String searchTerm, int price, int quantity) 

 

Makes it difficult to buy an item if it does not have one, and the list of items I want to buy is long, so I am trying to loop it.

3 minutes ago, Night said:

Programatically getting the id from a string is a lot harder than vice versa but there are two main ways I can think of to do it. First is to scrape a site such as the one @Apaec linked, second is to loop the Item Definition cache until you find the string you're looking for (make sure to check that it's not noted or anything). 

Thanks! I will look into that.

Link to comment
Share on other sites

2 minutes ago, sudoinit6 said:

I am looking for a way for the bot to get the id without the item. The GE api requires the item id for

buyItem(int itemId, java.lang.String searchTerm, int price, int quantity) 

  

Makes it difficult to buy an item if it does not have one, and the list of items I want to buy is long, so I am trying to loop it.

Thanks! I will look into that.

A word to the wise, you don't need to iterate every item in the cache as approximately half are noted. Find the pattern and this will cut down the execution time by roughly 50%.

  • Like 1
Link to comment
Share on other sites

6 hours ago, dreameo said:

Here you can use this:

https://pastebin.com/5TWTBqNh

Usage would be:


ItemData.get("Cannonball","ID")

You can include another level of cache via map if you want but, the way it's now is fine. Other properties can also be retrieved, check inside the code.

You are a saint, thanks. 

Link to comment
Share on other sites

15 hours ago, dreameo said:

Here you can use this:

https://pastebin.com/5TWTBqNh

Usage would be:


ItemData.get("Cannonball","ID")

You can include another level of cache via map if you want but, the way it's now is fine. Other properties can also be retrieved, check inside the code.

Stealing this :boge: Thanks scrubbo x

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