July 13, 20232 yr 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, 20232 yr by killsmh
July 13, 20232 yr Developer 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, 20232 yr by Khaleesi
July 19, 20232 yr 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!
Create an account or sign in to comment