Jump to content
View in the app

A better way to browse. Learn more.

OSBot :: 2007 OSRS Botting

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Get item id for item not in inventory

Featured Replies

I know how to inventory.getItem("Lobster").getId()

 

But is there a way to get the id for an item you don't have? 

 

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

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

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

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.

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

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

5 hours ago, HeyImJamie said:

Stealing this :boge: Thanks scrubbo x

Meh, at least you got the decency to say that your gonna use it. It's meant to be public anyhow.

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. 

Create an account or sign in to comment

Recently Browsing 0

  • No registered users viewing this page.

Account

Navigation

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.