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.

Broke my own bot! PM handling

Featured Replies

I have created my bot by doing each task as a separate class instead of using switches (never again!)

Because i have done it this way i have to trigger the statement to be true on the can process.

This is making it hard to use a message listener also as it always says the variables wrong.

 

Here is the current code i have, it used to work, all i need it to do is become true when it receives a specific private message become true.

The current code i have i cant even debug as it makes the bot run slowly (as if being ddossed) but i believe it keeps looping.

 

import org.osbot.rs07.api.Chatbox.MessageType;
import org.osbot.rs07.script.MethodProvider;

public class Contact extends Task {
    
    private MessageType messageType;

    public Contact(MethodProvider api) {
        super(api);
    }

    public boolean canProcess() {

        return api.getChatbox().contains(messageType, "help me");
        
    }

    @Override
    public void process() throws InterruptedException {

        api.log("we have just been asked for help");
    }

}

 

This is just an example of what the bot will do should it receive that message.
 

  • Author
25 minutes ago, Token said:

messageType is null so "the bot run slowly" = it's throwing NPE's 

Any idea how i can fix. This part is a key part for the whole Bot

3 minutes ago, olstan said:

Any idea how i can fix. This part is a key part for the whole Bot

Yes... give it a value I guess

As Token said you're getting NPE's.

Open the logger, find where you are getting an NPE and decide if it needs a value or a null check. Keep doing this until all the NPE's are gone and you have buttery code

Edited by Zappster

  • Author
6 minutes ago, Zappster said:

As Token said you're getting NPE's.

Open the logger, find where you are getting an NPE and decide if it needs a value or a null check. Keep doing this until all the NPE's are gone and you have buttery code

I never get a chance to go through all the log as i have to shut osbot down as even the logger crashes.

I need to find out how to give it a value without getting errors in my code which i have struggled with since breaking it!

7 minutes ago, olstan said:

I never get a chance to go through all the log as i have to shut osbot down as even the logger crashes.

I need to find out how to give it a value without getting errors in my code which i have struggled with since breaking it!

Go carefully thru your code and look for any part where a null piece of data will break everything

@olstan

You have already posted this question twice in scripting help. If you want people to answer your question (which they already did), bump your original thread. Don't just keep posting again until someone spoon feeds you the solution.

Edited by Explv

  • Author
27 minutes ago, Explv said:

@olstan

You have already posted this question twice in scripting help. If you want people to answer your question (which they already did), bump your original thread. Don't just keep posting again until someone spoon feeds you the solution.

i think you'll find that was for trading and i solved that, without the method you suggested.
 

3 minutes ago, olstan said:

i think you'll find that was for trading and i solved that, without the method you suggested.
 

The principle is exactly the same is it not?

Your original question was checking if the chatbox contained a trade message, and then acting upon it:

https://osbot.org/forum/topic/116527-how-to-trade-other-players/

You then posted the same question again:

https://osbot.org/forum/topic/116539-trading-players/

How is this question any different?

You are checking the chatbox for a message  "help me" instead of a trade message? Apply whatever logic you used for trading here as well.

Also in the future post in the scripting help section: https://osbot.org/forum/forum/249-scripting-help/

 

  • Saiyan locked this topic
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.