Jump to content
View in the app

A better way to browse. Learn more.

OSBot :: 2007 OSRS Botting

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Asking for help with my Farming Script

Featured Replies

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.

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 by Ragboys is back

  • Author

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!

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.

  • Author

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 by Athylus

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

Create an account or sign in to comment

Recently Browsing 0

  • No registered users viewing this page.

Account

Navigation

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.