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
  • Fishing Script


    gkuracz

    Recommended Posts

    Posted

    I'm trying to make a fishing script but I can't manage to make it find the object in the area this is what i've done:
     

    fishToCatch = getGameObjects().closest(gameObject -> gameObject != null
                && gameObject.getName().equals("Fishing spot")
                && gameObject.distance() < 20
                && fishArea.contains(gameObject));
    	
    	switch (getState()) 
    	{
    	 	case FISH:
    	 		
    	 	if (fishArea.contains(getLocalPlayer())) 
    	 	{
    	 			// IT GETS HERE
                    if (fishToCatch != null && fishArea.contains(fishToCatch)) 
                    {
    // FAILS TO GET HERE, I SUPPOSE I'M NOT GETTING THE RIGHT GAMEOBJECT
                        if (fishToCatch.isOnScreen()) 
                        {
                            fish();
                        } else {
                            move(); // move the camera a bit
                        }
                    }
    	 	}else {
                    if (getWalking().walk(fishAreaStart.getRandomTile())) 
                    {
                        log("walking to fish area");
                        sleepUntil(() -> (getClient().getDestination().distance() < Calculations.random(6, 9))|| getLocalPlayer().isStandingStill(),
                        Calculations.random(4100, 5110));
                    }
                }
           }
    
    private void fish()
       {
    	   if (fishToCatch != null && fishToCatch.interact("Net")) 
    		{
    			
    			log("Fishing.");
    			
    			sleep(Calculations.random(599, 1001)); // 600 1200
    			sleepUntil(() -> !getLocalPlayer().isMoving(),Calculations.random(2501, 4499)); // 3500 // 5000
    			sleep(Calculations.random(150, 311));
    			
    			if (getLocalPlayer().isAnimating()) 
    			{
    				antiBan();
    				sleepUntil(() -> !getLocalPlayer().isAnimating(),
    				Calculations.random(7000, 12000));
    			}
    		}
      
       }
    
    Posted

     

    I'm trying to make a fishing script but I can't manage to make it find the object in the area this is what i've done:

     

    fishToCatch = getNpcs().closest(gameObject -> gameObject != null
                && gameObject.getName().equals("Fishing spot")
                && gameObject.distance() < 20
                && fishArea.contains(gameObject));
    	
    		
    	 
    

    Use getNpcs() instead

    Posted

    Use getNpcs() instead

    Tho you should call it npc not gameobject to make your head understand it better :P

    Posted

    Mind blown, thanks! I'll keep you guys posted. :) It worked like a charm! Awesome.

    Posted

    Mind blown, thanks! I'll keep you guys posted. :) It worked like a charm! Awesome.

    kinda rude to think that fish are objects, I bet nemo is sad now  :(

    Archived

    This topic is now archived and is closed to further replies.

    ×
    ×
    • 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.