SimpleBot Version 3.0.0 is finally out! Please enjoy your easy access to proxies and more!

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Vitality] Angler fisher BASE SCRIPT [Source]
#1
As the title says, its functional but does not check fishing lvl, worms left etc, it also has no paint or other fancy stuff.

Feel free to use and edit this is any way you want, or just experiment with.

I tried to put in as much comments as i could and TRY (Keyword is try :p) to explain kinda what the code does.

Code:
import java.awt.Graphics;

import net.runelite.api.coords.WorldPoint;
import simple.hooks.scripts.Category;
import simple.hooks.scripts.ScriptManifest;
import simple.hooks.simplebot.ChatMessage;
import simple.hooks.wrappers.SimpleNpc;
import simple.hooks.wrappers.SimpleObject;
import simple.robot.script.Script;
import simple.robot.utils.WorldArea;

@ScriptManifest(author = "Sewer Boi", category = Category.FISHING, description = "Fishes Anglers. Start in bank or near fishing spot", discord = "", name = "Angler Fisher", servers = { "Vitality" }, version = "0.1")

public class AnglerFisher extends Script{

private WorldArea BANK_AREA = new WorldArea(new WorldPoint(1793, 3796, 0), new WorldPoint(1812, 3783, 0)); //Banking area, used to check if we are near the bank
private WorldArea FISHING_AREA = new WorldArea(new WorldPoint(1828, 3780, 0), new WorldPoint(1848, 3764, 0)); //Fishing area, used to check if we are near the fishing spots

private SimpleObject BANK_BOOTH; //Used to store the bank boot we want to use (Will be filled @ line 63)
private SimpleNpc FISHING_SPOT; //Used to store the fishing spot we want to fish (Will be filled @ line 85)

private String EXIT_STATUS; //String used to break out of the while loop in my walkPath function

private WorldPoint[] BANK_TO_FISHING_PATH = { //Route from the bank to the Fishing area, can be used reversed
    new WorldPoint(1803, 3788, 0), //all the worldpoints are coordinates of the Runescape world, sites like "https://explv.github.io/" can be used to easily create areas and routes.
    new WorldPoint(1803, 3788, 0),
    new WorldPoint(1803, 3784, 0),
    new WorldPoint(1807, 3782, 0),
    new WorldPoint(1811, 3782, 0),
    new WorldPoint(1815, 3781, 0),
    new WorldPoint(1819, 3779, 0),
    new WorldPoint(1823, 3777, 0),
    new WorldPoint(1827, 3777, 0),
    new WorldPoint(1831, 3775, 0)
};

@Override
public void paint(Graphics arg0) {
// TODO Auto-generated method stub

}

@Override
public void onChatMessage(ChatMessage arg0) {
// TODO Auto-generated method stub

}

@Override
public void onExecute() {
// TODO Auto-generated method stub

}

@Override
public void onProcess() {

// WHEN THE PLAYER IS INSIDE THE BANKING AREA (area defined on line 16)
if(ctx.pathing.inArea(BANK_AREA)) {
if(ctx.inventory.populate().population() > 2) { //If the player has MORE than 2 items in this inventory (Populate creates a query of all the items, Population counts the items)

if(!ctx.bank.bankOpen()) { //Check if the bank NOT open ("!" reverses the expected result)
BANK_BOOTH = ctx.objects.populate().filter("Bank booth").nearest().next(); //Store the nearest "Bank booth" in the BANK_BOOTH object (Line 19)

if(BANK_BOOTH != null && BANK_BOOTH.validateInteractable()) { //If the BANK_BOOTH was succesfully filled AND the script can interract with it then continue
if(BANK_BOOTH.click("Bank")) { //Right click the bank booth and use the "Bank" option, left click can be simulated by using .click(0) The if statement makes sure that we have succesfully clicked before continueing to the wait conditon
ctx.onCondition(() -> ctx.bank.bankOpen(), 5000); //Continue if when the bank is open or when 5 seconds have passed. whatever comes first.
}
}
}

if(ctx.bank.bankOpen()) { //If the bank is open then continue(its either open @ line 72 or closed @ line 62)
ctx.bank.depositAllExcept("Fishing rod", "Sandworms"); //Deposit everything in your inventory except the Fishing rod & Sandworms
}
}

if(ctx.inventory.populate().population() == 2) { //Does your inventory contain only 2 items? then continue (Kinda the same as line 60, but now we are soft of checking if we have banked the caught fish etc)
walkPath(FISHING_AREA, BANK_TO_FISHING_PATH, false); //This uses my walkPath function that starts @ line 102 (It expect a area to walk to, the route to the area, and if it should take the path reversed or not
} //(false = Bank -> fishing area, true = fishing area -> bank)
}

// WHEN THE PLAYER IS INSIDE THE FISHING AREA (area defined on line 17)
if(ctx.pathing.inArea(FISHING_AREA)) {
if(!ctx.players.getLocal().isAnimating() && !ctx.inventory.inventoryFull()) {// If the player is not animating (Fishing in our case) AND our inventory is not yet full then continue
FISHING_SPOT = ctx.npcs.populate().filter(FISHING_AREA).filter("Rod Fishing spot").nearest().next(); //Store the nearest "Rod Fishing spot" that is within our Fishing area in the FISHING_SPOT object (Line 20)

if(FISHING_SPOT != null && FISHING_SPOT.validateInteractable()) {//If the FISHING_SPOT was succesfully filled AND the script can interract with it then continue
FISHING_SPOT.click("Bait");//Right click the fishing spot and use the "Bait" option (Same logic as line 66)
ctx.onCondition(() -> ctx.players.getLocal().isAnimating(), 3000); //Continue when the player is animating (Fishing) or when 3 seconds have passed. whatever comes first.
}
}

if(ctx.inventory.inventoryFull()) { //Whenever our inventory is full continue (Remember this only applies in we are in the fishing area LINE 83)
walkPath(BANK_AREA, BANK_TO_FISHING_PATH, true); //Againt this uses tmy walkPath function that starts @ line 102, this time however it reverses the path (true boolean that has been passed)
}
}
}

@Override
public void onTerminate() {
EXIT_STATUS = "Terminated"; //Whenever you stop the script it will fill the EXIT_STATUS string, this is used to break out of the walkPath loop, otherwise it will continue to walk when you have stopped the script.
}

private void walkPath(WorldArea toArea, WorldPoint[] walkPath, boolean reverse) { //walkPath function expects a area to walk to, the route to walk and if it should walk reversed or not (Read line 79)
while(!ctx.pathing.inArea(toArea)) { //Whenever the player has not arrived at this destination the script will continue this loop, it stops when it has arrived
if(EXIT_STATUS == "Terminated") { //This is where we make it possible to break out of the loop when you stop the script
ctx.stopScript();
}
ctx.pathing.walkPath(walkPath, reverse); //This is the SimpleBot walkPath function, this is where the pass our walk route and reverse boolean to
ctx.sleep(1000); //Sleep for 1 seconds (1000 miliseconds) after every click, so the script wont spam the minimap
}
}

}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)