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.

reading text from chat box

Featured Replies

Hi, I noticed when i am trying to search for multi word sentences from chatbox e.g. "has happened", it doesn't compute. Thanks to some of the comments in this forums, I understand that rsns use non breaking linebreak, what about inside the chatbox?

What are you using to search the chatbox?

You can use OnMessage to do something whenever the message you want has appeared in the chatbox.

  • Author
10 minutes ago, d0zza said:

What are you using to search the chatbox?

You can use OnMessage to do something whenever the message you want has appeared in the chatbox.

Thanks for your reply.

Would that method overwrite work for searching substrings with spaces?

I am using

getChatbox().contains()
15 minutes ago, Thanfor said:

Thanks for your reply.

Would that method overwrite work for searching substrings with spaces?

I am using


getChatbox().contains()

contains method in Chatbox checks for MessegeType instances

You want to use the message listener and then do a contains method that checks for sub strings equaling "has happened". You may encounter issues (depending on the method) with, exact phrases though. ("has happened" vs  "has happened.")

23 minutes ago, Thanfor said:

Thanks for your reply.

Would that method overwrite work for searching substrings with spaces?

I am using


getChatbox().contains()

Spaces don't need any work for the chatbox, only for player names.

Like dreameo said, use the message listener that is part of the osbot api.

Here is how you would go about doing this.

If a player (anyone) types "noob" or "nub" your bot will then reply "im not a noob you are!".

    public void onMessage(Message message) throws java.lang.InterruptedException {
	if(message.getType() == Message.MessageType.PLAYER) {
			if (message.getMessage().contains("noob") || message.getMessage().contains("nub")) {
				getKeyboard().typeString("im not a noob you are!");
			}
		}
    }

 

Edited by DeadPk3r

And if you want to get recent messages from the chatbox after a while, here is what you will want to do.

You add this to your class

implements MessageListener

and this is the code

getChatbox().getMessages(MessageType.PLAYER).get(0).contains("noob")

Gets the last player message sent containing noob. I find it useful because I have a message tracking system inside my script.

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.