here4spoons 1 Posted October 26, 2016 public class LobCatcher extends AbstractScript { Area bank = new Area(2586, 3422, 2587, 3418, 0); Area spotOne = new Area(2604, 3425, 2598, 3420, 0); Timer t = new Timer(); private String status = "n/a"; @Override public void onStart(){} @Override public int onLoop() { if(getInventory().isFull()){ bank(); } else { if(spotOne.contains(getLocalPlayer())){ fish(); } else { walkTo(spotOne); } } return Calculations.random(500, 1000); } private void walkTo(Area a){ if(getWalking().walk(a.getRandomTile())){ sleep(Calculations.random(1500, 2000)); } } private void fish(){ GameObject fishingSpot = getGameObjects().closest( gameObject -> gameObject != null && gameObject.getName().contains("Fishing spot")); fishingSpot.interact("Cage"); } private void bank(){ if(bank.contains(getLocalPlayer())){ NPC banker = getNpcs().closest(npc -> npc != null && npc.hasAction("Bank")); if(banker != null){ banker.interact("Bank"); if(sleepUntil(() -> getBank().isOpen(), 2500)){ getBank().depositAllExcept(item -> item != null && item.getName().contains("Lobster pot")); if(sleepUntil(() -> !getInventory().isFull(), 2500)){ getBank().close(); sleepUntil(() -> !getBank().isOpen(), 2500); } } } } else { walkTo(bank); } } @Override public void onExit(){} } i am not really sure why it's not interacting with the fishing spot. if anyone could show me a better way or what I'm doing wrong that would be cool also the spot is in the fishing guild.
rokaHakor 171 Posted October 26, 2016 GameObject fishingSpot = getGameObjects().closest( gameObject -> gameObject != null && gameObject.getName().contains("Fishing spot")); Should be GameObject fishingSpot = getGameObjects().closest( gameObject -> gameObject != null && gameObject.getName().equals("Fishing spot")); You also need a sleep after the fishingSpot.interact("Cage"); or else its gonna try and spam it. Try using logs to see where it gets stuck.
here4spoons 1 Author Posted October 26, 2016 that doesn't work either will gameObject.getID() == 1510 i just found an error that only occurs while trying to fish. [ERROR]23:45:35: Exception has occurred while running! Please report error to developer if problem persists: java.lang.NullPointerException at fisher.LobCatcher.fish(LobCatcher.java:66) at fisher.LobCatcher.onLoop(LobCatcher.java:37) at org.dreambot.api.script.AbstractScript.run(AbstractScript.java:244) at java.lang.Thread.run(Unknown Source)
LogicSoup 92 Posted October 26, 2016 isnt Fishing spots NPC? that doesn't work either will gameObject.getID() == 1510 i just found an error that only occurs while trying to fish. [ERROR]23:45:35: Exception has occurred while running! Please report error to developer if problem persists: java.lang.NullPointerException at fisher.LobCatcher.fish(LobCatcher.java:66) at fisher.LobCatcher.onLoop(LobCatcher.java:37) at org.dreambot.api.script.AbstractScript.run(AbstractScript.java:244) at java.lang.Thread.run(Unknown Source) NPC fishingSpot = getNpcs().closest(npc -> npc.exists() && npc.getName().equals("Fishing spot")); if (fishingSpot != null) { fishingSpot.interact("Cage"); sleepUntil(() -> getLocalPlayer().isAnimating(), 2000); }
here4spoons 1 Author Posted October 26, 2016 isnt Fishing spots NPC? NPC fishingSpot = getNpcs().closest(npc -> npc.exists() && npc.getName().equals("Fishing spot")); i am derping really hard atm thank you
Recommended Posts
Archived
This topic is now archived and is closed to further replies.