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

Inventory#getSelectedItem() bug w/ simple fix

Featured Replies

inventory# IsItemSelected() works fine

 

 

1. A description of the issue:

  • inventory# getSelectedItem() will not return null when nothing is selected. It will return its previous item.

2. Are you receiving any errors in the client canvas or the logger?

  • no error but check the output

3. How can you replicate the issue?

  • just calling the methods use my code below

4. Has this issue persisted through multiple versions? If so, how far back?

  • version: 2.3.99

 

solution

  • add a simple isItemSelected() check to the method. make it return null if its false. Else its current method.

 

code:

log("is item selected: " +getInventory().isItemSelected());
log("Selected Item name: " +getInventory().getSelectedItemName());

output:

[INFO][Bot #1][08/13 08:40:35 PM]: Started script : Script Testing
[INFO][Bot #1][08/13 08:40:36 PM]: is item selected: false
[INFO][Bot #1][08/13 08:40:36 PM]: Selected Item name: Steel bar
[INFO][Bot #1][08/13 08:40:37 PM]: is item selected: false
[INFO][Bot #1][08/13 08:40:37 PM]: Selected Item name: Steel bar
[INFO][Bot #1][08/13 08:40:38 PM]: is item selected: false
[INFO][Bot #1][08/13 08:40:38 PM]: Selected Item name: Steel bar
[INFO][Bot #1][08/13 08:40:39 PM]: is item selected: true
[INFO][Bot #1][08/13 08:40:39 PM]: Selected Item name: Steel bar
[INFO][Bot #1][08/13 08:40:40 PM]: is item selected: true
[INFO][Bot #1][08/13 08:40:40 PM]: Selected Item name: Steel bar
[INFO][Bot #1][08/13 08:40:41 PM]: is item selected: false
[INFO][Bot #1][08/13 08:40:41 PM]: Selected Item name: Steel bar
[INFO][Bot #1][08/13 08:40:42 PM]: is item selected: false
[INFO][Bot #1][08/13 08:40:42 PM]: Selected Item name: Steel bar
[INFO][Bot #1][08/13 08:40:43 PM]: is item selected: true
[INFO][Bot #1][08/13 08:40:43 PM]: Selected Item name: Ammo mould
[INFO][Bot #1][08/13 08:40:44 PM]: is item selected: true
[INFO][Bot #1][08/13 08:40:44 PM]: Selected Item name: Ammo mould

enjoy hope to have this fixed assap

  • 4 weeks later...

We fixed this a while back, also the default is not null because the hook does not return null. It will return "Cancel" if there is nothing (at least from what I remember).

Guest
This topic is now closed to further replies.

Recently Browsing 0

  • No registered users viewing this page.

Account

Navigation

Search

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.