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 Not Working


    IcCookies

    Recommended Posts

    Hello,

     

    This is my first script, and somehow I can't get it to work.

     

    So basically this script fishes in Draynor and is supposed to bank, but when my inventory is full, it just walk over to the bank and does nothing. Any help would be appreciated!

    Source code:

     

    package bots;
     
    import org.dreambot.api.methods.Calculations;
    import org.dreambot.api.methods.map.Area;
    import org.dreambot.api.script.AbstractScript;
    import org.dreambot.api.script.Category;
    import org.dreambot.api.script.ScriptManifest;
    import org.dreambot.api.wrappers.interactive.NPC;
     
    import java.awt.*;
     
    @ScriptManifest(category = Category.FISHING, name = "IcCookies' DraynorFisher", author = "IcCookies", version = 1.0)
    public class DraynorFisher extends AbstractScript {
     
    @Override
    public void onStart() {
    log("Welcome to IcCookies' private script!");
    }
     
    Area fishArea = new Area(3085, 3233, 3089, 3224, 0);
    Area bankArea = new Area(3092, 3245, 3095, 3240, 0);
     
    @Override
    public int onLoop() {
    if (!getInventory().isFull()) {
    if (fishArea.contains(getLocalPlayer())) {
    NPC Fishing_spot = getNpcs().closest(
    npc -> npc != null && npc.hasAction("Net"));
    if (Fishing_spot != null && Fishing_spot.interact("Net")) {
    sleep(Calculations.random(15000, 30000));
    }
    } else {
    if (getWalking().walk(fishArea.getRandomTile())) {
    sleep(Calculations.random(3000, 5500));
    }
    }
     
    if (getInventory().isFull()) {
    if (bankArea.contains(getLocalPlayer())) {
    NPC Banker = getNpcs().closest(
    npc -> npc != null && npc.hasAction("Bank"));
    if (Banker != null && Banker.interact("Bank")) {
    if (sleepUntil(() -> getBank().isOpen(), 5000)) {
    if (getBank().depositAllExcept(
    item -> item != null
    && item.getName().contains("net"))) {
    if (sleepUntil(() -> !getInventory().isFull(),
    5000)) {
    if (getBank().close()) {
    sleepUntil(() -> !getBank().isOpen(),
    5000);
    }
    }
    }
    }
    }
    } else {
    if (getWalking().walk(bankArea.getRandomTile())) {
    sleep(Calculations.random(3000, 5500));
    }
    }
    }
    }
    return 600;
    }
     
    @Override
    public void onExit() {
    log("Thank you for using this script.");
    }
     
    @Override
    public void onPaint(Graphics graphics) {
     
    }
     
    }
     
    Link to comment
    Share on other sites

     

    next time you post wrap your code in the <> brackets at the top of the text editor like 

    this
    

    have you tried using 

    getBank().open()
    

    Hmm. So instead of  Banker.interact("Bank") i would use that? That's very intesting.

    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.