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
  • Basic Lumbridge Anchovies Fisher w/ Banking


    Recommended Posts

    Hey, started to learn how to script. Here is a basic Lumbridge anchovies fisher I wrote.

    Let me know if you have any tips! I saw some scripts do some human like movements like clicking on skills tab or change camera angle. Wondering how important this is and how to do it.
     

    import org.dreambot.api.Client;
    import org.dreambot.api.methods.MethodProvider;
    import org.dreambot.api.methods.container.impl.Inventory;
    import org.dreambot.api.methods.container.impl.bank.Bank;
    import org.dreambot.api.methods.container.impl.bank.BankLocation;
    import org.dreambot.api.methods.container.impl.bank.BankType;
    import org.dreambot.api.methods.interactive.NPCs;
    import org.dreambot.api.methods.interactive.Players;
    import org.dreambot.api.methods.map.Area;
    import org.dreambot.api.methods.walking.impl.Walking;
    import org.dreambot.api.script.AbstractScript;
    import org.dreambot.api.script.Category;
    import org.dreambot.api.script.ScriptManifest;
    import org.dreambot.api.wrappers.interactive.Entity;
    import org.dreambot.api.wrappers.interactive.NPC;
    import org.dreambot.api.wrappers.interactive.Player;
    
    @ScriptManifest(
        name = "Script Name",
        description = "My script description!",
        author = "Developer Name",
        version = 1.1,
        category = Category.UTILITY,
        image = "")
    public class TestScript extends AbstractScript {
    
      private final Area fishArea = new Area(3243, 3150, 3245, 3153);
      private final Area lumbridgeBank = BankLocation.LUMBRIDGE.getArea(2);
    
      @Override
      public int onLoop() {
        MethodProvider.log("On loop is called...");
        if (!Inventory.isFull()) {
          doFish();
        } else {
          goBank();
        }
        return (int) (Math.random() * 500) + 500;
      }
    
      private void goBank() {
        Player currPlayer = Players.localPlayer();
        if (currPlayer.isAnimating()) {
          MethodProvider.log("Player is moving.");
          return;
        }
    
        if (!lumbridgeBank.contains(currPlayer)) {
          MethodProvider.log("Go to bank.");
          Walking.walk(lumbridgeBank.getRandomTile());
          return;
        }
    
        Entity banker = Bank.getClosestBank(BankType.NPC);
        if (banker != null) {
          MethodProvider.log("depositing.");
          Bank.openClosest();
          Bank.depositAll(item -> item.getName().equals("Raw shrimps"));
          return;
        }
      }
    
      private void doFish() {
        Player currPlayer = Players.localPlayer();
        if (currPlayer.isAnimating()) {
          MethodProvider.log("Player is moving.");
          return;
        }
    
        NPC fishingSpot = NPCs.closest("Fishing spot");
        if (fishingSpot != null) {
          MethodProvider.log("Cast Net.");
          fishingSpot.interact("Net");
          return;
        }
    
        if (!fishArea.contains(currPlayer)) {
          MethodProvider.log("Walk to area.");
          Walking.walk(fishArea.getRandomTile());
          return;
        }
      }
    }

     

    Link to post
    Share on other sites

    Create an account or sign in to comment

    You need to be a member in order to leave a comment

    Create an account

    Sign up for a new account in our community. It's easy!

    Register a new account

    Sign in

    Already have an account? Sign in here.

    Sign In Now
    ×
    ×
    • Create New...