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
  • Try asking for help in the chatbox
  • Advanced Message listener


    kamilo
     Share

    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

    Create an account or sign in to comment

    You need to be a member in order to leave a comment

    Create an account

    Sign up for a new account in our community. It's easy!

    Register a new account

    Sign in

    Already have an account? Sign in here.

    Sign In Now
     Share

    ×
    ×
    • 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.