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.

Listener

Featured Replies

I would like to add in a inventory Listener

could just run it on a different thread

I would like to add in a inventory Listener

 

 

If you know how to multithread you can easily make a listener in a new class that implements Runnable. You can basically make this new thread constantly watch your inventory slots and check if anything changes, or whatever you are trying to make it do. Just make a new class that implements Runnable, make that class do whatever you want, then in Script thread, Thread thread = new Thread(ClassName) then start the thread. I haven't used that in a while, but its something like that. Just look up the basics of multi threading and you can easily find how to make it. ^_^

Whatever you do, at least add a small sleep in between inventory updates. You don't want to kill your CPU because you want to be notified the exact millisecond your inventory changes. Waiting for even just a second will consume such little resources it won't even make a noticeable impact on the CPU usage of your script.

  • Author

Whatever you do, at least add a small sleep in between inventory updates. You don't want to kill your CPU because you want to be notified the exact millisecond your inventory changes. Waiting for even just a second will consume such little resources it won't even make a noticeable impact on the CPU usage of your script.

How big of a sleep you think it's good, 200 mil second

How big of a sleep you think it's good, 200 mil second

More like 1200 milliseconds (2 game ticks) unless you absolutely need to be notified of a change right away.
  • Author

Just curious, what exactly would it be listening for ? :|

when you have a change of items in the inventory.

 

tbh im still a little confused on how to set it up. Ive tried so many different things

Edited by josedpay

when you have a change of items in the inventory.

 

tbh im still a little confused on how to set it up. Ive tried so many different things

 

If you are going to compare inventories for equality, couldn't you just use these lines (at appropriate places of course,not stacked like this tongue.png)?

 

Item[] compareThis = getInventory().getItems();

 

Item[] withThis = getInventory().getItems();

 

boolean equaliThis = compareThis  != null && withThis != null && Arrays.equals(compareThis withThis);

Edited by Botrepreneur

when you have a change of items in the inventory.

 

tbh im still a little confused on how to set it up. Ive tried so many different things

Cache them and then compare the cache to the current items 

when you have a change of items in the inventory.

 

tbh im still a little confused on how to set it up. Ive tried so many different things

Depends what you're attempting to monitor and how you want to receive notifications about changes. This should help you get started (or provide an answer for you): http://osbot.org/forum/topic/51856-inventory-monitor-keep-live-track-of-your-items/

  • Author

I already created my own listener, it just people were telling me to put it in a thread, which make sences. And have the thread loop it's self.

So far I have created the thread started it once. And that's it -.-

Guest
This topic is now closed to further replies.

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.