April 17, 20187 yr 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, 20187 yr by trainux
April 17, 20187 yr 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
April 17, 20187 yr 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++; } }
April 17, 20187 yr You're using an old version of the MessageListener interface. It takes a Message argument now instead of String.
April 17, 20187 yr 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++; }
April 18, 20187 yr Author 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.
Create an account or sign in to comment