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.

Bolt tip cutter (source)

Featured Replies

I was trying to bot some diamond bolt tips because I saw they have a nice profit margin but osfletcher doesn't seem to have that, and acerds fletcher seemed to be broken when I used it for that purpose. Change the RAW_MATERIAL variable to a different type of gem to cut that instead, but note that it is case sensitive: 

package boltTips;

import org.osbot.rs07.api.ui.Message;
import org.osbot.rs07.api.ui.Message.MessageType;
import org.osbot.rs07.script.Script;
import org.osbot.rs07.script.ScriptManifest;
import org.osbot.rs07.utility.ConditionalSleep;

@ScriptManifest(author = "theorems", info = "t", logo = "", name = "bolt tips", version = 0.1)
public class Main extends Script {

	private String RAW_MATERIAL = "Diamond";
	private int KEYCODE_SPACE = 32;
	private String FINISHED_MATERIAL = RAW_MATERIAL + " bolt tips";
	private String[] boltTip = { "Chisel", FINISHED_MATERIAL };
	private String[] unfBoltTip = { "Chisel", RAW_MATERIAL };
	private String[] makingBolt = { "Chisel", RAW_MATERIAL, FINISHED_MATERIAL };
	private String lastMsg = "";

	@Override
	public int onLoop() throws InterruptedException {
		if (getDialogues().isPendingContinuation()) {
			// when level up
			getKeyboard().pressKey(KEYCODE_SPACE);
		} else {
			if (getWidgets().isVisible(270, 14, 38)) {
				getKeyboard().pressKey(KEYCODE_SPACE); // this returns void
				sleep(random(500, 1000));
				getMouse().moveOutsideScreen();
				new ConditionalSleep(100000, 5000) {
					@Override
					public boolean condition() throws InterruptedException {
						return !getInventory().contains(RAW_MATERIAL) && !myPlayer().isAnimating();
					}

				}.sleep();
			} else if (getInventory().contains("Chisel") && getInventory().contains(RAW_MATERIAL)) {
				if (getBank().isOpen()) {
					getBank().close();
				} else {
					if (getInventory().isItemSelected()) {
						if (getInventory().getSelectedItemName().equals("Chisel")) {
							if (getInventory().interact("Use", RAW_MATERIAL)) {
								sleep(500);
							}
						} else {
							getInventory().deselectItem();
						}
					} else {
						getInventory().interact("Use", "Chisel");
					}
				}
			} else if (getInventory().contains("Chisel") && getInventory().contains(FINISHED_MATERIAL)
					&& !getInventory().contains(RAW_MATERIAL)) {
				bank();
				if (!getInventory().onlyContains(makingBolt)) {
					getBank().depositAllExcept(makingBolt);
				} else {
					getBank().depositAll(FINISHED_MATERIAL);
				}
			} else if (getInventory().contains("Chisel")) {
				log("only chisel");
				bank();
				getBank().withdrawAll(RAW_MATERIAL);
			} else {
				setup();
			}
		}
		return 500;
	}

	public void setup() {
		if (!getBank().isOpen()) {
			bank();
		} else {
			if (getInventory().isEmpty()) {
				getBank().withdraw("Chisel", 1);
			} else {
				getBank().depositAll();
			}
		}
	}

	public void bank() {
		if (getInventory().isItemSelected()) {
			getInventory().deselectItem();
		}
		if (!getBank().isOpen()) {
			try {
				if (getBank().open()) {
					new ConditionalSleep(2500) {
						@Override
						public boolean condition() throws InterruptedException {
							return getBank().isOpen();
						}

					}.sleep();
				}
			} catch (InterruptedException e) {
				log("Error banking: " + e.getMessage());
				e.printStackTrace();
			}
		}
	}

	@Override
	public void onMessage(Message message) throws java.lang.InterruptedException {
		if (message.getType() == MessageType.GAME) {
			String msg = message.getMessage().toLowerCase();
			String er = "you don't have enough inventory space.";
			if (msg.equals(er) && lastMsg.equals(er)) {
				log("Shutting down for safety");
				stop();
			}
			lastMsg = msg;
		}
	}
}

EDIT: completely rewrote the script except for the msg failsafe. It is now quite robust, I tried to break it in every way I could think of and was unable to do so.

Edited by Theorems
Complete rewrite

  • Author
8 minutes ago, Alek said:

Lots of tinfoil and stuff that will break within 2 weeks :/ 

Edit: Not a bad try though

The thing I know that might break after 2 weeks is the widget ID which will probably change when rs updates. Anything else you see which could break easily so I know for the next script I make?

  • Author

I completely re-wrote it except for the onMessage() -- no tinfoiling this time!

 

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.