Jump to content

Loading script error


Sense

Recommended Posts

Can anyone figur this out? 

[ERROR][06/30 05:57:53 PM]: Failed to load jar file : UnicowSlayer.jar
[ERROR][06/30 05:57:53 PM]: Failed to load local scripts!
java.lang.NullPointerException
	at org.osbot.Con.iiIIiiIIII(d:209)
	at org.osbot.nUl.IiIIIiIIII(i:210)
	at org.osbot.BotApplication.IIIIiiIIII(hn:419)
	at org.osbot.BotApplication.main(hn:119)
[INFO][06/30 05:57:53 PM]: Loaded 0 local scripts and 0 custom random solvers!
[DEBUG][06/30 05:57:53 PM]: OSBot is now ready!

And heres the script

import java.awt.Graphics;


import org.osbot.rs07.script.MethodProvider;
import org.osbot.rs07.script.Script;

import org.osbot.rs07.script.ScriptManifest;
import org.osbot.rs07.api.map.Position;
import org.osbot.rs07.api.model.GroundItem;
import org.osbot.rs07.api.model.NPC;
import org.osbot.rs07.api.model.Player;
import org.osbot.rs07.api.model.RS2Object;
import org.osbot.rs07.api.Bank;
import org.osbot.rs07.api.Inventory;
import org.osbot.rs07.api.ui.Spell;


@ScriptManifest(author = "Ikke", name = "2", version = 1.0, info = "3")


public class UnicowSlayer extends Script {


	
	int walkpath;
	
	private int[][] BankToTowerDoor = new int[][]{
            
            {2637,3289},
            {2618,3290},
            {2608,3275},
            {2616,3257},
            {2634,3251},
            {2636,3234},
            {2649,3225},
          
            };
	
	
	private int[][] ToAltar = new int[][]{
			{3038,4376},
			{3032,4392},
			{3020,4405},
			{3019,4409},
			
	};
	int parent = 241;
	int child = 3;
	
	int opendoor;
	int climbdown;
	
	
	
	
	public int onLoop() throws InterruptedException{
		
		
		Inventory i = client.getInventory();
		Player p = client.getMyPlayer();
		RS2Object door = closestObjectForName("Tower door");
		RS2Object trapdoor = closestObjectForName("Trapdoor");
		RS2Object bank = closestObjectForName("booth");
		RS2Object altar = closestObjectForName("Symbol of life");
		NPC cow = closestAttackableNPCForName("Unicow");
		GroundItem horn = closestGroundItemForName("Unicorn horn");
		Bank b = client.getBank();
		 int amount = i.getItemForName("Unicorn horn").getAmount();
		
		
		
		if(i.contains("Cowhide") && i.contains("Unicorn horn") && altar == null && trapdoor == null){
			WalkAlongPath(BankToTowerDoor , true);
		}
		if(door != null){
		if(door.isVisible()){
			door.interact("Open");
			opendoor++;
			sleep(random(1300 , 1700));
			walkExact(new Position(2648,3213 , 0));
			if(trapdoor != null){
				if(trapdoor.isVisible()){
					trapdoor.interact("Climb-down");
					climbdown++;
					sleep(random(1300 , 1700));
				WalkAlongPath(ToAltar , true);
				}
			}
		}
		}
		if(altar != null){
			if(altar.isVisible()){
				if(i.contains("Cowhide") && i.contains("Unicorn horn") && client.getInterface(241).getChild(3) == null && cow == null){
					i.interactWithName("Unicorn horn", "Use");
					sleep(random(1300 , 1700));
					i.interactWithName("Cowhide", "Use");
					sleep(random(1300 , 1700));
					altar.interact("Activate");
					client.getInterface(241).getChild(3).interact("Click here to continue");
				}
			}
		}
		if(cow != null){
			if(cow.isVisible()){
				if(!cow.isUnderAttack()){
					if(p.isUnderAttack()){
				cow.interact("Attack");
				sleep(random(1300 , 1700));
			}
		}
			}
		}
		if(horn != null){
			if(horn.isVisible()){
				horn.interact("Take");
				sleep(random(1300 , 1700));
			}
		}
		if(altar != null){
			if(altar.isVisible()){
				if(!i.contains("Cowhide")){
					magicTab.castSpell(Spell.ARDOUGNE_TELEPORT);
					opendoor--;
					climbdown--;
					sleep(random(1300 , 1700));
					walkExact(new Position(2652,3290,0));
					walkExact(new Position(2663,3304,0));
					sleep(random(4000 , 6000));
					if(bank != null){
						if(bank.isVisible()){
							bank.interact("Bank");
							sleep(random(1100 , 1700));
						}
					}
				}
			}
		}
		
		if(i.contains("Cowhide") && b.isOpen()){
			
			if(amount >= 2){
				b.deposit(237 , 100);
			}
			sleep(random(1100 , 1700));
			b.withdraw10(1739);
			sleep(random(1100 , 1700));
			b.withdraw1(237);	
		}
return 50;
}




 public void onPlayerMessage(String username, String message) throws InterruptedException {


          }

    public void onMessage(String message) {

    }



   public void onPaint(Graphics graphics) {

   }
 




    public void onStart() {

       

    }
  




  

  public void onExit() {

   }

  public boolean WalkAlongPath(int[][] path, boolean AscendThroughPath, int distanceFromEnd) {
      if (distanceToPoint(AscendThroughPath ? path[path.length - 1][0] : path[0][0],
              AscendThroughPath ? path[path.length - 1][1] : path[0][1]) <= distanceFromEnd)
          return true;
      else {
          WalkAlongPath(path, AscendThroughPath);
          return false;
      }
  }
 
  public void WalkAlongPath(int[][] path, boolean AscendThroughPath) {
      int destination = 0;
      for (int i = 0; i < path.length; i++)
          if (distanceToPoint(path[i][0], path[i][1]) < distanceToPoint(path[destination][0], path[destination][1]))
              destination = i;
      if (client.getMyPlayer().isMoving() && distanceToPoint(path[destination][0], path[destination][1]) > (isRunning() ? 3 : 2))
          return;
      if (AscendThroughPath && destination != path.length - 1 || !AscendThroughPath && destination != 0)
          destination += (AscendThroughPath ? 1 : -1);
      try {
          log("Walking to node:" + destination);
          walk(new Position(path[destination][0], path[destination][1], 0));
          Thread.sleep(700 + MethodProvider.random(600));
      } catch (InterruptedException e) {
          e.printStackTrace();
      }
  }
 
  private int distanceToPoint(int pointX, int pointY) {
      return (int) Math.sqrt(Math.pow(client.getMyPlayer().getX() - pointX, 2)
              + Math.pow(client.getMyPlayer().getY() - pointY, 2));
  }
   


}
Link to comment
Share on other sites

First thing off the bat, you're using legacy objects with the new imports, "closestObjectForName" is now "objects.closest()"

 

Heres the api: http://osbot.org/api familiarize yourself with it, you also need to Override the onLoop().

 

Looks like you've taken an OSBot 1 script, changed the imports from legacy, it doesn't work like that unfortunately.

Link to comment
Share on other sites

First thing off the bat, you're using legacy objects with the new imports, "closestObjectForName" is now "objects.closest()"

 

Heres the api: http://osbot.org/api familiarize yourself with it, you also need to Override the onLoop().

 

Looks like you've taken an OSBot 1 script, changed the imports from legacy, it doesn't work like that unfortunately.

 Thanks man, you definitly helped me

Link to comment
Share on other sites

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

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