Jump to content
Frequently Asked Questions
  • Are you not able to open the client? Try following our getting started guide
  • Still not working? Try downloading and running JarFix
  • Help! My bot doesn't do anything! Enable fresh start in client settings and restart the client
  • How to purchase with PayPal/OSRS/Crypto gold? You can purchase vouchers from other users
  • Try asking for help in the chatbox
  • interacting problems


    here4spoons
     Share

    Recommended Posts

    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.

    Link to comment
    Share on other sites

    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.

    Edited by rokaHakor
    Link to comment
    Share on other sites

    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)   
    Link to comment
    Share on other sites

    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);
            }
    
    Link to comment
    Share on other sites

     

    isnt Fishing spots NPC?

     

            NPC fishingSpot = getNpcs().closest(npc -> npc.exists() && npc.getName().equals("Fishing spot"));
    

    i am derping really hard atm thank you

    Edited by here4spoons
    Link to comment
    Share on other sites

     Share

    ×
    ×
    • Create New...

    Important Information

    We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.