trainux Posted April 17, 2018 Share Posted April 17, 2018 (edited) Successful tree felling counter Attempt to capture the logging by capturing the chat message that says "You get some logs." as follows: public void onMessage(String message){ if(message.contains("You get some logs.")){ logsChooped++; } } But I can not capture the events of the chat, I do not understand how to initialize that function and that it keeps capturing the messages for that counter. Thank you in advance and if there is a more ethical solution, I would appreciate the information. Edited April 17, 2018 by trainux Quote Link to comment Share on other sites More sharing options...
Guy Fieri Posted April 17, 2018 Share Posted April 17, 2018 Perhaps store an variable for an int which is called after every interaction with a tree ( for instance in a loop). Thus, each time a tree is cut, an increase of one to the integer is given. This can then be called for a gui of sorts if that is what you are looking for. Hope this helped get you on the right track with the thought process atleast Quote Link to comment Share on other sites More sharing options...
ProjectPact Posted April 17, 2018 Share Posted April 17, 2018 I’m assuming what you are after is MessageListener Quote Link to comment Share on other sites More sharing options...
Theorems Posted April 17, 2018 Share Posted April 17, 2018 Kinda confused by your wording, what do you mean by "the events of the chat"? And you don't need to 'initialize' that method, just put in in your class which extends script with the @override annotation. Then it will automatically run in a sperate thread. @Override public void onMessage(Message message) throws java.lang.InterruptedException { String msg = message.getMessage().toLowerCase(); if (msg.contains("you get some logs")) { woodCut++; } } 1 Quote Link to comment Share on other sites More sharing options...
FrostBug Posted April 17, 2018 Share Posted April 17, 2018 You're using an old version of the MessageListener interface. It takes a Message argument now instead of String. 1 Quote Link to comment Share on other sites More sharing options...
01053 Posted April 17, 2018 Share Posted April 17, 2018 I'm kind of confused what you're asking for are you asking for a counter for how many logs you have received or a counter for how many trees are cut? @Override public void onMessage(Message msg) { if (msg.getMessage().contains("You get some logs")) logsChopped++; } Quote Link to comment Share on other sites More sharing options...
trainux Posted April 18, 2018 Author Share Posted April 18, 2018 20 hours ago, Theorems said: Kinda confused by your wording, what do you mean by "the events of the chat"? And you don't need to 'initialize' that method, just put in in your class which extends script with the @override annotation. Then it will automatically run in a sperate thread. @Override public void onMessage(Message message) throws java.lang.InterruptedException { String msg = message.getMessage().toLowerCase(); if (msg.contains("you get some logs")) { woodCut++; } } Thanks, solved. 1 Quote Link to comment Share on other sites More sharing options...