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.

Help with onMessage

Featured Replies

This is code http://pastebin.com/mRq0sijB

Problem is that it spamms if it sees Hi AND HAVE NO IDEA how to fix it!?

 

maybe try giving it a timer and check if it's the last thing said in the chatbox messages instead of just contained by the chatbox messages? it's just going to loop repeatedly if you leave it as it is because the condition is continuously met - it's going to continue saying 'hellow' until there's no 'hi' in the chatbox

  • Author

maybe try giving it a timer and check if it's the last thing said in the chatbox messages instead of just contained by the chatbox messages? it's just going to loop repeatedly if you leave it as it is because the condition is continuously met - it's going to continue saying 'hellow' until there's no 'hi' in the chatbox

 

if i understand coreccly onMessage should have that timer implemented?

Just check what the latest message was, you don't need the chatbox api.

 

m.getMessage() i think it would be, or something similar.

 

What you are doing is checking the entire chatbox every time someone sends a message, which of course it contains the same thing that was said before.

 

Also, String#contains is case sensetive, so this would only work if it was a capital H, you should change it to

 

m.getMessage().toLowerCase().contains("hi")

Edited by Tom

The onMessage method gets triggered when a new message gets added to the chatbox.

There is no point in looping over the chatbox and all that...

 

Example for logs chopped:

public void onMessage(Message message) {
   if (message.getMessage().contains("You get some"))
      logCount++;
}

Enjoy! smile.png

 

tryin steal my thunder br0?

  • Author

Just check what the latest message was, you don't need the chatbox api.

 

m.getMessage() i think it would be, or something similar.

 

What you are doing is checking the entire chatbox every time someone sends a message, which of course it contains the same thing that was said before.

 

Also, String#contains is case sensetive, so this would only work if it was a capital H, you should change it to

 

m.getMessage().toLowerCase().contains("hi")

 

But runescape Automaticly canges hi to Hi :/

The onMessage method gets triggered when a new message gets added to the chatbox.

There is no point in looping over the chatbox and all that...

 

Example for logs chopped:

public void onMessage(Message message) {
   if (message.getMessage().contains("You get some"))
      logCount++;
}

Enjoy! smile.png

 

Will test later when have time but thanks for in front

But runescape Automaticly canges hi to Hi :/

 

Will test later when have time but thanks for in front

 

Not if its mid sentence, you are checking 'contains' after all.

If you wanted to check the start of the sentence, use startsWith i believe.

 

The solution i provided will work none the less, it converts the message received to lower case afterwards so runescape wont fuck around with it

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.