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.

SwiftFlax

Featured Replies

SwiftFlax

 

Current version: N/A

Date started: 29/09/2013

 

Hello reader, I'm creating a script called "SwiftFlax". The script will obviously pick flax, and then proceed to bank them once the bots inventory is full. So far, I have created the picking part of the script. I wish to improve my proficiency with scripting a bot, so I will start with a pretty basic script.

 

If you wish to leave your support, a tip, or anything that could potentially help me, I would greatly appreciate it.

 

So far, I have created a way for the bot to pick the flax. This is all made off the top of my head, I do not have an account for me to test it with because of the bans that took place on three of my accounts last night.

 

I'll leave this here, and build off on it whenever I get a chance to. I believe in open-sourcing your work, to an extent.

 

This is just the class to execute "picking" the flax.

 

I would like to thank exuals for providing the node tutorial. I really like the organization, and this way helps me understand how to structure things properly.

package swiftflax.nodes;

import org.osbot.script.Script;
import org.osbot.script.rs2.model.Entity;
import org.osbot.script.rs2.utility.Area;

import swiftflax.api.Node;

public class PickNode extends Node {

	private Area FLAX_FIELD = new Area(0000, 0000, 0000, 0000); // Get the coordinates.

	private Entity flax;

	public PickNode(Script script) {
		super(script);
	}

	@Override
	public boolean validate() throws InterruptedException {
		return !inventoryIsFull();
	}

	@Override
	public boolean execute() throws InterruptedException {
		return pickFlax();
	}

	private boolean inventoryIsFull() {
		return s.client.getInventory().isFull();
	}

	private boolean playerBusy() {
		return s.client.getMyPlayer().isUnderAttack()
				|| s.client.getMyPlayer().isMoving();
	}

	private boolean inFlaxField() {
		return s.client.getMyPlayer().isInArea(FLAX_FIELD);
	}

	private boolean flaxAvailable() {
		flax = s.closestObjectForName("Flax");

		return flax.exists() && flax.isVisible() && flax.isInArea(FLAX_FIELD) && flax != null;
	}

	private boolean pickFlax() throws InterruptedException {
		flax = s.closestObjectForName("Flax");
		
		if (!playerBusy()) {
			if (inFlaxField()) {
				if (flaxAvailable() && flax.interact("Pick")) {
					return true;
				}
			} else {
				s.log("Not in flax field.");
				// Walk to the flax field.
			}
		} else {
			s.log("Busy.");
			return false;
		}
		return false;
	}

}

Guest
This topic is now closed to further replies.

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.