Jump to content
Frequently Asked Questions
  • Are you not able to open the client? Try following our getting started guide
  • Still not working? Try downloading and running JarFix
  • Help! My bot doesn't do anything! Enable fresh start in client settings and restart the client
  • How to purchase with PayPal/OSRS/Crypto gold? You can purchase vouchers from other users
  • Advanced Message listener


    kamilo

    Recommended Posts

    what the hell happened to class implements advancedmessagelistener its not avalible anymore? whats the new one

    and please show me a sample so i understand how the new thing works

    Link to comment
    Share on other sites

    7 minutes ago, kamilo said:

    what the hell happened to class implements advancedmessagelistener its not avalible anymore? whats the new one

    and please show me a sample so i understand how the new thing works

     Hey @kamilo! I'll go ahead and paste the message I posted for someone else on the forums below.

    You can achieve what you've set out to do using the "ChatListener" interface. Simply implement the ChatListener in your script and override the method you'd like to use. I've provided an example for you below.

    public class TestScript implements ChatListener {
        ... some code here ...
          
        @Override
        public void onGameMessage(Message message) {
            if (message.getMessage().contains("The fire catches and the logs begin to burn")) {
                shouldLightFire = true;
            }
        }
    }

    You can view all of the methods that can be overridden for ChatListener here: https://dreambot.org/javadocs/org/dreambot/api/script/listener/ChatListener.html

    You can view all of the information provided by a "Message" here: https://dreambot.org/javadocs/org/dreambot/api/wrappers/widgets/message/Message.html

    The different overrides are for the different types of message (game message, clan message, etc.). You can also use the catch-all "onMessage()" method.

    Hope that helps! Best of luck 🙂

    Link to comment
    Share on other sites

    41 minutes ago, Bonfire said:

     Hey @kamilo! I'll go ahead and paste the message I posted for someone else on the forums below.

    You can achieve what you've set out to do using the "ChatListener" interface. Simply implement the ChatListener in your script and override the method you'd like to use. I've provided an example for you below.

    
    public class TestScript implements ChatListener {
        ... some code here ...
          
        @Override
        public void onGameMessage(Message message) {
            if (message.getMessage().contains("The fire catches and the logs begin to burn")) {
                shouldLightFire = true;
            }
        }
    }

    You can view all of the methods that can be overridden for ChatListener here: https://dreambot.org/javadocs/org/dreambot/api/script/listener/ChatListener.html

    You can view all of the information provided by a "Message" here: https://dreambot.org/javadocs/org/dreambot/api/wrappers/widgets/message/Message.html

    The different overrides are for the different types of message (game message, clan message, etc.). You can also use the catch-all "onMessage()" method.

    Hope that helps! Best of luck 🙂

    ah so it was just renamed then?

    Link to comment
    Share on other sites

    Just now, kamilo said:

    ah so it was just renamed then?

    I'm not too familiar with DB2's API, but I would guess that is the case.

    Link to comment
    Share on other sites

    Archived

    This topic is now archived and is closed to further replies.

    ×
    ×
    • Create New...

    Important Information

    We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.