killsmh Posted July 13, 2023 Share Posted July 13, 2023 (edited) getBot().addMessageListener(f2pWc.this); @Override public void onMessage(Message message) { if (message.getType() == Message.MessageType.GAME && message.getMessage().contains("It's ready to add to the sapling.")) { sapling.interact("Add-mulch"); } } It doesn't seem to be working.. :c My bad everything seems to be a-okay! Edited July 13, 2023 by killsmh Quote Link to comment Share on other sites More sharing options...
Khaleesi Posted July 13, 2023 Share Posted July 13, 2023 (edited) 42 minutes ago, killsmh said: getBot().addMessageListener(f2pWc.this); @Override public void onMessage(Message message) { if (message.getType() == Message.MessageType.GAME && message.getMessage().contains("It's ready to add to the sapling.")) { sapling.interact("Add-mulch"); } } It doesn't seem to be working.. :c No need to do addMessageListener if it's you main class extending from Script Just add some debug logs to check what codes gets executed and which not. I'm not sure where the sapling variable is coming from, I asusme you set it in the onLoop? Just load the sapling ad hoc BUT those are bad habbits, do this instead: Never use any interaction code in the messageListener, only in the onLoop thread. You can set a boolean in the onMessage and check that boolean in the onLoop to execute your code and reste the boolean after that Edited July 13, 2023 by Khaleesi 1 Quote Link to comment Share on other sites More sharing options...
killsmh Posted July 13, 2023 Author Share Posted July 13, 2023 Khaleesi, I'm very thankful for the tips and information! God bless. 1 Quote Link to comment Share on other sites More sharing options...
Elsandoral Posted July 19, 2023 Share Posted July 19, 2023 On 7/13/2023 at 11:21 PM, Khaleesi said: No need to do addMessageListener if it's you main class extending from Script Just add some debug logs to check what codes gets executed and which not. I'm not sure where the sapling variable is coming from, I asusme you set it in the onLoop? Just load the sapling ad hoc BUT those are bad habbits, do this instead: Never use any interaction code in the messageListener, only in the onLoop thread. You can set a boolean in the onMessage and check that boolean in the onLoop to execute your code and reste the boolean after that Thank you for helping everyone! 1 Quote Link to comment Share on other sites More sharing options...