choucter 1 Posted December 22, 2021 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?
camelCase 304 Posted December 22, 2021 game messages still count as messages so going with onMessage should pick it up either way
Phantomwire 2 Posted December 23, 2021 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; } }
choucter 1 Author Posted December 24, 2021 Thanks for the responses, and I appreciate the MessageType reference, Phantomwire. I somehow missed that enum in Javadocs but I have it now
Recommended Posts
Archived
This topic is now archived and is closed to further replies.