Bryno 21 Share Posted May 26, 2022 Hi, so my class implements ChatListener and this is the code: public void onGameMessage(Message msg) { logError("Msg: " + msg.getMessage()); logError("result = " + msg.getMessage().contains("You get some oak logs")); } I've already tried putting: @Override on top of the method as well.. I am literally not getting ANY console output. My onGameMessage() method is just not getting invoked at all.. Any ideas? Link to comment Share on other sites More sharing options...
RSMasterGuard 19 Share Posted May 26, 2022 20 minutes ago, Bryno said: Hi, so my class implements ChatListener and this is the code: public void onGameMessage(Message msg) { logError("Msg: " + msg.getMessage()); logError("result = " + msg.getMessage().contains("You get some oak logs")); } I've already tried putting: @Override on top of the method as well.. I am literally not getting ANY console output. My onGameMessage() method is just not getting invoked at all.. Any ideas? why not just check your inventory for another logic being added? Link to comment Share on other sites More sharing options...
Pandemic 2789 Share Posted May 26, 2022 Are you implementing it in your main script class (the one with a ScriptManifest) or a separate class? If it's a separate class you'll need to register it manually via Instance#addEventListener. Link to comment Share on other sites More sharing options...
Bryno 21 Author Share Posted May 27, 2022 1 hour ago, RSMasterGuard said: why not just check your inventory for another logic being added? This is a good idea for a work around, however it will not work for my application. Just for too much detail, I am looking for a message of "You don't have an axe" to make sure I create a failsafe for the script to stop. Link to comment Share on other sites More sharing options...
Bryno 21 Author Share Posted May 27, 2022 1 hour ago, Pandemic said: Are you implementing it in your main script class (the one with a ScriptManifest) or a separate class? If it's a separate class you'll need to register it manually via Instance#addEventListener. Hi there, unfortunately it is in the same class as my ScriptManifester. The class extends AbstractScript and implements ChatListener. Still no luck 😕 Link to comment Share on other sites More sharing options...
Pandemic 2789 Share Posted May 27, 2022 4 minutes ago, Bryno said: Hi there, unfortunately it is in the same class as my ScriptManifester. The class extends AbstractScript and implements ChatListener. Still no luck 😕 You may want to use onMessage instead of onGameMessage as whatever message you're looking for may not be of that type (there are many different types of chat messages: https://dreambot.org/javadocs/org/dreambot/api/wrappers/widgets/message/MessageType.html). onMessage will catch ALL messages so you can check the type in there if you'd prefer using a more specific method Link to comment Share on other sites More sharing options...
RSMasterGuard 19 Share Posted May 27, 2022 1 hour ago, Bryno said: This is a good idea for a work around, however it will not work for my application. Just for too much detail, I am looking for a message of "You don't have an axe" to make sure I create a failsafe for the script to stop. what about checking for the axe in the equipment slot and inventory? Link to comment Share on other sites More sharing options...
camelCase 257 Share Posted May 27, 2022 6 hours ago, Bryno said: logError("result = " + msg.getMessage().contains("You get some oak logs")); getting logs is not a game message its a filtered message, not having an axe is a game message so if you arent getting that one you've set something up wrong Link to comment Share on other sites More sharing options...
Bryno 21 Author Share Posted May 27, 2022 4 hours ago, camalCase said: getting logs is not a game message its a filtered message, not having an axe is a game message so if you arent getting that one you've set something up wrong Wow that's so weird that a message that is under the "Game" tab in the client is considered a MessageType.FILTERED haha I would have never guessed, but okay thank you for this information! Appreciate it a lot! Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.