Jump to content

Picking Up Bronze Pick Error


Freak

Recommended Posts


import java.awt.Rectangle;

import org.osbot.legacy.script.mouse.RectangleDestination;
import org.osbot.rs07.api.map.Position;
import org.osbot.rs07.api.model.Entity;
import org.osbot.rs07.api.model.GroundItem;
import org.osbot.rs07.api.ui.Tab;
import org.osbot.rs07.script.Script;
import org.osbot.rs07.script.ScriptManifest;
import org.osbot.rs07.utility.Area;










@ScriptManifest(author="Freak",info="Mines Tin in Lumb Swamp",logo="",name="Freaky Miner", version = 0.1)	
public class Tin extends Script {
	
	private enum State {     MINE, WALKTOMINE, COLLECTPICK, HOMETELE};
	public static final Area Tele = new Area(3232,3209,3215,3229);
	public static final Area Lada = new Area(3229,3214, 3230, 3225);
	public static final Area Lada2 = new Area(3228,3223, 0, 0);
;
	public static final Position Roof = new Position(3229,3214, 2);
	public static final Position Roof2 = new Position(3229,3223, 2);
	public static final Position Roof3 = new Position(3228,3213, 2);
	public static final Position Roof4 = new Position(3228,3224, 2);
	
		@Override public void onStart(){
			 
			
		
	}
		
		private State getState() {
			
			if(!inventory.contains("Bronze pickaxe")){	
	if(Tele.contains(myPlayer())){
				return State.COLLECTPICK; 
				}
		}if(!Tele.contains(myPlayer())){
			return State.HOMETELE; 
		}
			
	
	
	return State.MINE;
				
	}
	public int onLoop() throws InterruptedException {
		switch (getState()) {
		
		case COLLECTPICK:
				
			
				Entity Door = objects.closest("Door");
				if(Door.exists()){
			mouse.setSpeed(2);
			if(!Door.interact("Close")){
			Door.interact("Open");	
			}
			}
			sleep(random(250,3500));
		Entity Ladder = objects.closest("Ladder");
		Ladder.interact("Climb-up");
		
													 
						 if(myPlayer().getPosition().equals(Roof)){
							 GroundItem x = this.groundItems.closest("Bronze pickaxe");
								if (x != null && x.exists()) {
									x.interact("Take");
								}
							 
						 }if(myPlayer().getPosition().equals(Roof2)){

							 GroundItem x = this.groundItems.closest("Bronze pickaxe");
								if (x != null && x.exists()) {
									x.interact("Take");
								}
						 }if(myPlayer().getPosition().equals(Roof3)){

							 GroundItem x = this.groundItems.closest("Bronze pickaxe");
								if (x != null && x.exists()) {
									x.interact("Take");
								}
						 }if(myPlayer().getPosition().equals(Roof4)){
							 log("Here");

							 GroundItem x = this.groundItems.closest("Bronze pickaxe");
								if (x != null && x.exists()) {
									x.interact("Take");
								}
						 }
	log("error");
						 objects.closest("Ladder").interact("Climb-up");
		 
		
	
	
		sleep(random(250,3500));
		log("hometele");
		
	
	
		
		break;
		case HOMETELE:
			tabs.open(Tab.MAGIC);
				Rectangle optionRect = new Rectangle(571, 238, 10, 10);
				RectangleDestination optionDestination = new RectangleDestination (optionRect);
				if(!myPlayer().isAnimating()){
				 mouse.move(optionDestination);
				mouse.click(optionDestination,false);
				sleep(random(300000,400000));
			
				
				}
			break;
		case MINE:
			break;
		case WALKTOMINE:
			break;
		default:
			break;}
		
						 
		
		
	
			
	
			
			
			
		return 0;
			
			
		
		}
}
		
			
			
				
				
				
			
			
			
		
		  
		
	

	
	


	


	
	

gives the error

[ERROR][Bot #1][06/07 12:24:04 PM]: Error in script executor!
java.lang.NullPointerException
	at Tin.onLoop(Tin.java:63)
	at org.osbot.rs07.event.ScriptExecutor$InternalExecutor.run(ri:145)
	at java.lang.Thread.run(Unknown Source)

Link to comment
Share on other sites

This will kill you

import org.osbot.legacy.script.mouse.RectangleDestination;

import org.osbot.rs07.api.map.Position;

import org.osbot.rs07.api.model.Entity;

import org.osbot.rs07.api.model.GroundItem;

import org.osbot.rs07.api.ui.Tab;

import org.osbot.rs07.script.Script;

import org.osbot.rs07.script.ScriptManifest;

import org.osbot.rs07.utility.Area;

Change the first line to make it match the rest

  • Like 2
Link to comment
Share on other sites

  • 2 weeks later...
Guest
This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...