Jump to content

Successful tree felling counter


trainux

Recommended Posts

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
Link to comment
Share on other sites

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

Link to comment
Share on other sites

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
Link to comment
Share on other sites

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
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

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