Jump to content
Goddness

getting error while loading local script

Recommended Posts

i made my simple first script, i followed trilez tutorial. Moved miner.class to .tribot/bin/scripts  but got error loading local script : miner! where is the problem ?


import org.tribot.api.DynamicClicking;
import org.tribot.api.General;
import org.tribot.api.Timing;
import org.tribot.api.types.generic.Condition;
import org.tribot.api2007.Inventory;
import org.tribot.api2007.Objects;
import org.tribot.api2007.Player;
import org.tribot.api2007.Walking;
import org.tribot.api2007.types.RSObject;
import org.tribot.api2007.types.RSTile;
import org.tribot.script.Script;
import org.tribot.script.ScriptManifest;

@ScriptManifest(authors = { "Test" }, category = "Mining", name = "SIMPLECOPPERMINER")
public class miner extends Script {

	private RSTile last_ore_tile = null;
	
	public boolean atcopper() {
		final RSObject[] copper = Objects.findNearest(20, 7484,7453);
		if (copper.length < 1)
		return false;
		
		return copper[0].isOnScreen();
		
	}
	
	public boolean mining() {
		if(ismining()) {
			final long timeout = System.currentTimeMillis() + General.random(60000,90000);
			while (ismining() && System.currentTimeMillis() < timeout) {
				sleep(150,200);
				if (this.last_ore_tile != null) {
					if (Objects.isAt(this.last_ore_tile, 7484,7453)) {
						break;
					}
					
				}
			}
		}
		
		final RSObject[] copperore = Objects.findNearest(50, 7484,7453);
		if(copperore.length < 1)
		return false;
		
		if (!copperore[0].isOnScreen()) {
			if(!Walking.walkPath(Walking.generateStraightPath(copperore[0])))
				return false;
	
		if (!Timing.waitCondition(new Condition() {
			@Override
			public boolean active() {
			     General.sleep(100); // Sleep to reduce CPU usage.
			     return copperore[0].isOnScreen();
			}
		}, General.random(8000, 9300)))
			return false;
		}
		if(!DynamicClicking.clickRSObject(copperore[0], "Mine"))
			return false;
		 Timing.waitCondition(new Condition() {
			  @Override
			  public boolean active() {
			   return !ismining();
			  }
			 }, General.random(1000, 1200));
		 if(Timing.waitCondition(new Condition() {
			 @Override
			 public boolean active() {
				 return ismining();
			 }
		 
			 },General.random(8000, 9000))) {
			 this.last_ore_tile = copperore[0].getPosition().clone();
			 return true;
		 }
	
		
		return false;
			
		
	}
	
	public boolean drop() {
		final String[] pics = {"Bronze_Pickaxe", "Iron_Pickaxe"};
		if(Inventory.isFull())
			Inventory.dropAllExcept(pics);
		return false;
	}
	
	public boolean ismining() {
		
	return Player.getAnimation() > 0;
	}
	
	
	@Override
	public void run() {
		if(atcopper()) {
			if(Inventory.isFull()) {
				drop();
			} else 
					mining();
			
				}
			}
	}

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.

×