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.

Script won't run whatsoever

Featured Replies

import org.osbot.rs07.api.model.Entity;
import org.osbot.rs07.input.mouse.MouseDestination;
import org.osbot.rs07.script.Script;
import org.osbot.rs07.script.ScriptManifest;
import org.osbot.rs07.api.map.Area;
import org.osbot.rs07.api.map.Position;
import org.osbot.rs07.api.map.constants.Banks;
import org.osbot.rs07.api.model.NPC;
import org.osbot.rs07.api.model.RS2Object;
import org.osbot.rs07.api.ui.Skill;
import org.osbot.rs07.api.ui.Tab;
import org.osbot.rs07.script.Script;
import org.osbot.rs07.script.ScriptManifest;
import org.osbot.rs07.api.util.ItemContainer;
import org.osbot.rs07.api.Equipment;

import java.awt.*;

@SuppressWarnings("unused")
@ScriptManifest(author = "CloudCode", info = "Simple Treecutting script", name = "Logger", version = 1, logo = "")
public class Main extends Script {
	private long timeStart;
	private String state = "Initializing..";
	private int invCount = 0;
	private int LogsChopped = 0;
	private int lastMA = 0;
	int staticLevel = getSkills().getStatic(Skill.WOODCUTTING);
	Area westBank = new Area( new Position(3167,3414,0), new Position(3184,3435,0));
	Area VarrockOak = new Area( new Position(3185, 3436, 0), new Position(3168, 3418, 0));
	
	@Override
	public void onStart() {
		log("Welcome to 'Logger' by CloudCode");
		log("Submit any Errors to me on the forums and i'd be happy to take a look.");
		timeStart = System.currentTimeMillis();
		getExperienceTracker().start(Skill.WOODCUTTING);
	}
	
	@Override
	public void onPaint(Graphics2D g) {
		long timeElapsed = System.currentTimeMillis() - timeStart;
		long seconds = (timeElapsed / 1000) % 60;
		long minutes = (timeElapsed / (1000 * 60)) % 60;
		long hours = (timeElapsed / (1000 * 60 * 60)) % 24;
		g.setFont(new Font("Trebuchet MS", Font.PLAIN, 14));
		g.setColor(Color.white);
		
		g.drawString("x", (int)getMouse().getPosition().getX() - 4, (int)getMouse().getPosition().getY() + 5);
		g.drawString(state, 8, 50);
		g.drawString("Time Running: " + (hours >= 10 ? "" + hours : "0" + hours) + ":" + (minutes >= 10 ? "" + minutes : "0" + minutes) + ":" + (seconds >= 10 ? "" + seconds : "0" + seconds), 8, 65);
		g.drawString("XP Gained: " + getExperienceTracker().getGainedXP(Skill.WOODCUTTING) + " (" + getExperienceTracker().getGainedLevels(Skill.WOODCUTTING) + ")", 8, 80);
		g.drawString("Logs Chopped " + LogsChopped, 8, 95);
	}
	@Override
	public int onLoop() throws InterruptedException {
		if (getInventory().isFull() && !westBank.contains(myPlayer()) && !getBank().isOpen()) {
			state = "Banking...";
			getWalking().webWalk(new Position(Banks.VARROCK_WEST.getRandomPosition()));
			if (staticLevel < 6 && !getInventory().contains(1349, 1350,1351, 1352)) {
				getWalking().webWalk(new Position(Banks.VARROCK_WEST.getRandomPosition()));
				bank.open();
				bank.withdraw(1349, 1350);
			}
		}
		if (getInventory().isFull() && westBank.contains(myPlayer()) && !getBank().isOpen()) {
			RS2Object bank = getObjects().closest("Bank booth");
			state = "Opening bank";
			if (bank != null) {
				if (bank.interact("Bank")) {
					state = "Depositing items";
					sleep(1000);
				}
			}
		}
		if (getInventory().isFull()) {
			getWalking().webWalk(new Position(Banks.VARROCK_WEST.getRandomPosition()));
			bank.open();
			bank.depositAll(1521, 1522);
		}
		if (!getInventory().contains(1349, 1350, 1351, 1352, 1353, 1354, 1355, 1356, 1357, 1358, 1359, 1360, 1361, 1362)) {
			state = "Getting a hatchet...";
			getWalking().webWalk(new Position(Banks.VARROCK_WEST.getRandomPosition()));
			getBank().open();
			bank.withdraw(1349 | 1350, 1);
		}
		if (getInventory().isFull() && westBank.contains(myPlayer()) && getBank().isOpen()) {
			getBank().depositAllExcept("Axe");
			while (getInventory().contains("Logs, Oak Logs, Yew Logs")) {
				sleep(100);
			}
			state = "Closing bank";
			getBank().close();
		}
		if (!getInventory().isFull() && !VarrockOak.contains(myPlayer()) && !getBank().isOpen() ) {
			state = "Walking to Oak Trees";
			getWalking().webWalk(new Position(3168 + random(3), 3418 + random(3), 0));
		}
		if (!getInventory().isFull() && VarrockOak.contains(myPlayer())) {
			NPC spot = getNpcs().closest("Oak");
			state = "Finding Tree";
			Entity tree = getObjects().closestThatContains("Oak");
    		if (tree != null){
    			if (tree.isVisible()){
    				if (!myPlayer().isMoving() && !myPlayer().isAnimating()){
    					tree.interact("Chop down");
    					sleep(random(500,800));
    				}
    			}
    		}
		}
		while (myPlayer().isAnimating()) {
			state = "Chopping Tree..";
			if (getInventory().getEmptySlots() != invCount && VarrockOak.contains(myPlayer())) {
				invCount = getInventory().getEmptySlots();
				LogsChopped += 1;
			}
			sleep(random (500, 1000));
		}
		return random (200, 300);	
	}
	
	@Override
	public void onExit() {
	}
}
	

Am i missing something? My code won't run at all. I can select it as a local script but when i hit start it does nothing.

move - 

int staticLevel = getSkills().getStatic(Skill.WOODCUTTING);

 

to onstart and see if anything has changed

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.