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
  • How do I find a fishingspot?


    Binarybunny

    Recommended Posts

    So I am trying to fish but it doesnt seem to want to work, never done a fishing script before so not sure how to find a fishing spot if its a entity or a gameobject.

     

    This is what I have so far and it finds a spot but it wont start fishing, thats because Im not telling it to but it doesnt even get to the

    log("IT WORKS RUN TO IT BOY!");
    

    part. It just keeps looping through

    log("Found a new one!");
    

    What am I doing wrong here and what is the proper way of doing this?

    log("Looking for the closest fishing spot");
            //this will find the closest game object that isn't null (it's fishable) and whose name equals Fishing spot. Call this using nodes or in a method in your loop so that it is updated in real time.
            GameObject spot = getGameObjects().closest(i -> i != null && i.getID() == 1530);
            log("Found a fishing spot!");
            //log(String.valueOf(spot.getTile())); //prints the not-null fishing spot's tile to the debug console.
    
            if (!spot.isOnScreen()) {
                log("The spot is not in screen!");
                GameObject newSpot = getGameObjects().closest(i -> i != null && i.getID() == 1530);
                log("Found a new one!");
                if (newSpot.isOnScreen()){
                    log("IT WORKS RUN TO IT BOY!");
                }
            } else {
                //put your fishing method here.
                log("IT WORKS RUN TO IT BOY!");
            }
    
    Link to comment
    Share on other sites

    IIrc fishing spots are entities (npcs) and not objects my friend.

     

    E:/ I'd also recommend filtering based on action(s), not id, as id's change upon update.

     

    E.g.

     

     

    getNpcs().closest(n -> n != null && n.getActions().contains("Net") && n.getActions().contains("Bait");
    Link to comment
    Share on other sites

    Keeps saying that its not on the screen


     

    IIrc fishing spots are entities (npcs) and not objects my friend.

     

    E:/ I'd also recommend filtering based on action(s), not id, as id's change upon update.

     

    E.g.

    getNpcs().closest(n -> n != null && n.getActions().contains("Net") && n.getActions().contains("Bait");

    Not sure thats the way to use getACtions because it takes a string array

    Link to comment
    Share on other sites

    Keeps saying that its not on the screen

    Not sure thats the way to use getACtions because it takes a string array

    You just need to make it become a String. 

    Can do this by using the Arrays.toString(array) method

     

    Then that would look like this.

    NPC npc = getNpcs().closest(n -> n != null && Arrays.toString(n.getActions()).contains("Net") && Arrays.toString(n.getActions()).contains("Bait"));

    Link to comment
    Share on other sites

    You just need to make it become a String. 

    Can do this by using the Arrays.toString(array) method

     

    Then that would look like this.

    NPC npc = getNpcs().closest(n -> n != null && Arrays.toString(n.getActions()).contains("Net") && Arrays.toString(n.getActions()).contains("Bait"));

     

    n.hasAction(string)

    Link to comment
    Share on other sites

    n.hasAction(string)

    I was answering his question about it being an array. Either method will I guess. ¯\_(ツ)_/¯

    Link to comment
    Share on other sites

     

    So I am trying to fish but it doesnt seem to want to work, never done a fishing script before so not sure how to find a fishing spot if its a entity or a gameobject.

     

    This is what I have so far and it finds a spot but it wont start fishing, thats because Im not telling it to but it doesnt even get to the

    log("IT WORKS RUN TO IT BOY!");
    

    part. It just keeps looping through

    log("Found a new one!");
    

    What am I doing wrong here and what is the proper way of doing this?

    log("Looking for the closest fishing spot");
            //this will find the closest game object that isn't null (it's fishable) and whose name equals Fishing spot. Call this using nodes or in a method in your loop so that it is updated in real time.
            GameObject spot = getGameObjects().closest(i -> i != null && i.getID() == 1530);
            log("Found a fishing spot!");
            //log(String.valueOf(spot.getTile())); //prints the not-null fishing spot's tile to the debug console.
    
            if (!spot.isOnScreen()) {
                log("The spot is not in screen!");
                GameObject newSpot = getGameObjects().closest(i -> i != null && i.getID() == 1530);
                log("Found a new one!");
                if (newSpot.isOnScreen()){
                    log("IT WORKS RUN TO IT BOY!");
                }
            } else {
                //put your fishing method here.
                log("IT WORKS RUN TO IT BOY!");
            }
    

    I believe it's a good practice to search for GameObjects/NPCs/etc. using names not IDs. sometimes the gameobject IDs change which could cause the script to stop working

    Link to comment
    Share on other sites

    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.