May 23, 20187 yr I know how to inventory.getItem("Lobster").getId() But is there a way to get the id for an item you don't have?
May 23, 20187 yr 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).
May 23, 20187 yr Author 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.
May 23, 20187 yr 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%.
May 23, 20187 yr 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.
May 24, 20187 yr Author 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.
May 24, 20187 yr 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 Thanks scrubbo x
May 24, 20187 yr 5 hours ago, HeyImJamie said: Stealing this Thanks scrubbo x Meh, at least you got the decency to say that your gonna use it. It's meant to be public anyhow.
May 24, 20187 yr 4 hours ago, dreameo said: Meh, at least you got the decency to say that your gonna use it. It's meant to be public anyhow. It's neat, I had a personal 'price grabber' already but it didn't use JSON, so if I had too many requests it'd struggle.
May 24, 20187 yr On 5/23/2018 at 3:05 PM, Night said: 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%. Word to the wise: http://wiki.c2.com/?PrematureOptimization
May 25, 20187 yr 1 hour ago, Lemons said: Word to the wise: http://wiki.c2.com/?PrematureOptimization ?
May 25, 20187 yr Instead of caching every item ID you need to know, you could also use this snippet made by @Explv. https://osbot.org/forum/topic/102611-ge-data-get-price-etc-by-item-name-no-external-libraries-required/
Create an account or sign in to comment