Jump to content

Successful tree felling counter


Recommended Posts

Posted (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 by trainux
Posted

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

Posted

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++;
		}
	}

 

  • Like 1
Posted
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.

  • Like 1

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...