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.

In game message listener trouble

Featured Replies

getBot().addMessageListener(f2pWc.this); 

@Override
    public void onMessage(Message message) {
        if (message.getType() == Message.MessageType.GAME && message.getMessage().contains("It's ready to add to the sapling.")) {
                 sapling.interact("Add-mulch");
        }
    }

It doesn't seem to be working.. :c

My bad everything seems to be a-okay! 

Edited by killsmh

  • Developer
42 minutes ago, killsmh said:

getBot().addMessageListener(f2pWc.this); 

@Override
    public void onMessage(Message message) {
        if (message.getType() == Message.MessageType.GAME && message.getMessage().contains("It's ready to add to the sapling.")) {
                 sapling.interact("Add-mulch");
        }
    }

It doesn't seem to be working.. :c


No need to do addMessageListener if it's you main class extending from Script :) 

Just add some debug logs to check what codes gets executed and which not.
I'm not sure where the sapling variable is coming from, I asusme you set it in the onLoop? Just load the sapling ad hoc

BUT those are bad habbits, do this instead:
Never use any interaction code in the messageListener, only in the onLoop thread.
You can set a boolean in the onMessage and check that boolean in the onLoop to execute your code and reste the boolean after that :)

Edited by Khaleesi

  • Author

Khaleesi, I'm very thankful for the tips and information! God bless.

On 7/13/2023 at 11:21 PM, Khaleesi said:


No need to do addMessageListener if it's you main class extending from Script :) 

Just add some debug logs to check what codes gets executed and which not.
I'm not sure where the sapling variable is coming from, I asusme you set it in the onLoop? Just load the sapling ad hoc

BUT those are bad habbits, do this instead:
Never use any interaction code in the messageListener, only in the onLoop thread.
You can set a boolean in the onMessage and check that boolean in the onLoop to execute your code and reste the boolean after that :)

Thank you for helping everyone!

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.