Bryno 21 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?
RSMasterGuard 20 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?
Pandemic 2853 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.
Bryno 21 Author 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.
Bryno 21 Author 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 😕
Pandemic 2853 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
RSMasterGuard 20 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?
camelCase 324 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
Bryno 21 Author 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!
Recommended Posts
Archived
This topic is now archived and is closed to further replies.