mankel200 0 Share Posted August 27, 2022 (edited) Basically im trying to get my script read from chat I have tried this but didnt get it to work: public void onGameMessage(@NotNull Message message){ if (message.getMessage().contains("I can't")){ log("vituiks"); Walking.walk(TREES.getRandomTile()); sleep(Calculations.random(1000, 1500)); } } Edited August 27, 2022 by mankel200 Link to comment Share on other sites More sharing options...
420x69x420 69 Share Posted August 27, 2022 (edited) You have to implement ChatListener in your AbstractScript class: Then in the same class you Override the specific method you want to use. For ChatListener all the methods are optional to Override since implementing ChatListener gives u access to all types of Messages (GameMessage, PlayerMessage, etc). The method onMessage captures all messages that u can filter thru whereas the method onGameMessage only captures game messages. Edited August 27, 2022 by 420x69x420 Axolotl 1 Link to comment Share on other sites More sharing options...
Axolotl 31 Share Posted August 28, 2022 Everything 420 said is correct. Also onMessage captures gameMessages that gameMessage doesn't, like player being frozen. So personally I only use that. Just make sure to filter it with: @Override public void onMessage(Message message) { String gameMessage = message.getMessage(); if (message.getUsername().equals("")) { log("Not said by user"); if(gameMessage.contains("You have been frozen!") && !isFrozen) { log("Player has been frozen"); } } } So its not triggered if a person types what a game message contains Link to comment Share on other sites More sharing options...
mankel200 0 Author Share Posted August 29, 2022 Got it working, thanks guys Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now