Athylus Posted August 2, 2018 Share Posted August 2, 2018 Fellow Script Writers, I have a 'working' farming bot, but it does not necessarily function the way I want it to. There's a problem: I cannot seem to check whether a patch has been treated with ultracompost. What I've tried: config bits, but they only tell us the stages of the weed in the patch or whether a crop has been planted. When treating the patch with compost the id of that patch does not change either. When right-clicking inspect on a patch, the game will tell us whether it has been treated with compost or not. So how can we get this data? Reliably. Checking the amount of compost in our inventory is not fool proof and can cause the script to get stuck. Quote Link to comment Share on other sites More sharing options...
Ragboys is back Posted August 2, 2018 Share Posted August 2, 2018 (edited) I might be wrong, but since you said you can inspect the patch to check if it's been treated, you should be able to make your script work the way you want. I haven't looked into the API, but you can possibly grab the text from the chatbox, meaning your script can understant if the patch has been treated or not. Edit: check this public void onMessage(Message message) throws java.lang.InterruptedException { if(message.getType() == Message.MessageType.PLAYER) { if (message.getMessage().contains("noob") || message.getMessage().contains("nub")) { getKeyboard().typeString("im not a noob you are!"); } } } The example above will check if a message from another PLAYER contains the string "noob" or "nub". If it does, it'll reply back "I'm not a noob, you are". Since the osbot API can check message from other players, it can check other messageTypes, just take a better look in the API That example should set you up easily Edited August 2, 2018 by Ragboys is back 1 Quote Link to comment Share on other sites More sharing options...
Athylus Posted August 3, 2018 Author Share Posted August 3, 2018 Cool idea! I was thinking of that. But what if you get to the next farming patch, and the same message from the previous patch is still there? Maybe I can work around it. Definitely worth trying! Quote Link to comment Share on other sites More sharing options...
liverare Posted August 4, 2018 Share Posted August 4, 2018 Perhaps a combination of the interact function and message listener. If you interact with a patch, take note of which patch that was. If you receive a message that says you've used ultra-compost, then make a note that you used said compost with said patch. Then clear the patch reference so that it's not used again by mistake. 1 Quote Link to comment Share on other sites More sharing options...
Athylus Posted August 4, 2018 Author Share Posted August 4, 2018 (edited) Doesn't the message listener only work on the class that extends Script tho? So I would have to place that in the main loop, even though my farming patches are handled in separate classes. Kind of like explv's tutorial island script. In the meantime I'll see what if I can work this out. Edit: Just using the message listener in my main class now, it's working like a charm! Now I will just have to pass that info around to my other classes, make some variables and setters... and actually, I need to use configs now as well instead of counting the seeds. And optimize the whole damn thing, my I5 6500 can barely handle two of these scripts! And it's only OSBot that is lagging, not my other open applications. So it must be my script. Thanks for the helps bros! Another thing I want to add is a circular linked list with accounts so that multiple accounts can take turns. You will have to wait after a farming run, so better to let another acc do a run. That would mean a complete overhaul of the script... if anyone is interested in helping me you can shoot a PM. Edited August 4, 2018 by Athylus 1 Quote Link to comment Share on other sites More sharing options...
dreameo Posted August 4, 2018 Share Posted August 4, 2018 Spoiler 1 hour ago, Athylus said: Doesn't the message listener only work on the class that extends Script tho? So I would have to place that in the main loop, even though my farming patches are handled in separate classes. Kind of like explv's tutorial island script. In the meantime I'll see what if I can work this out. Edit: Just using the message listener in my main class now, it's working like a charm! Now I will just have to pass that info around to my other classes, make some variables and setters... and actually, I need to use configs now as well instead of counting the seeds. And optimize the whole damn thing, my I5 6500 can barely handle two of these scripts! And it's only OSBot that is lagging, not my other open applications. So it must be my script. Thanks for the helps bros! Another thing I want to add is a circular linked list with accounts so that multiple accounts can take turns. You will have to wait after a farming run, so better to let another acc do a run. That would mean a complete overhaul of the script... if anyone is interested in helping me you can shoot a PM. Just look in the API to see if message listener is available: https://imgur.com/a/Zzyv8rX Quote Link to comment Share on other sites More sharing options...