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
  • How to associate Chatbox Messages with onMessage Types


    choucter
     Share

    Recommended Posts

    Javadocs show 9 different types of messages, such as onMessage, onGameMessage, onPlayerMessage, etc. Is there a way to tell which chatbox messages belong to each type?

    For example, I found through trial and error that logs collected while woodcutting are captured by onMessage only, but I can't find anything in Javadocs that would have led me to that conclusion. 

    Now I am trying to identify which message type will capture the chatbox comment that the ship arrives at Karamja in Pirates Treasure. 

    My only option seems to be to place code into all message types and see if one of them captures the info. Is there an easier way that I am missing?


     

    Link to comment
    Share on other sites

    As camalCase mentioned, you can just use onMessage to pick up all messages.

    If you want to be more specific, a quick way to figure what type you're looking out for would be to use the logging functionality of Dreambot.

    (Non-extensive example below on how to log the message type + filter down based on that message type using onMessage rather than "onPlayerMessage" etc.)

    public static void onMessage(Message m) {
    		
    		MessageType typeFilter = m.getType();
    		
    		// Debugging to determine message type
    		log("MESSAGE: " + m.getType() + " | | " + m.getMessage());
    		
    		// Switch statement to narrow down which type you want to use
    		switch(typeFilter) {
    		
    		case AUTO:
    			break;
    		case CHAT_CHANNEL:
    			break;
    		case GAME:
    			
    			// Maybe put some stuff here to do with wood being chopped
    			
    			break;
    		case PLAYER:
    			break;
    		case TRADE:
    			break;
    		default:
    			break;
    		
    		}
    		
    	}

     

    Link to comment
    Share on other sites

    Thanks for the responses, and I appreciate the MessageType  reference, Phantomwire. I somehow missed that enum in Javadocs but I have it now :) 

    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.