Tommm39 Posted May 15, 2018 Share Posted May 15, 2018 (edited) Who is The SimpleFisherman? Some say he's part man, part fish. Some say he's an actual real-life fisherman. All we really know is the man loves to fish. What the script does: Fishes Shrimp/Anchovies at Draynor Village until level 20 fishing, then fishes trout/salmon forever Fetches appropriate equipment from the bank if needed Walks to the appropriate fishing area depending on level Fish is dropped to optimise XP/Hour Future update plans: Buy feathers from GE when you run out Start going to fishing trawler at level 15 to get full angler (will take some time to implement!) Please note: This has not been tested on a low combat account - the dark wizard/jail guard near draynor WILL attack you if you have a low combat level so please use with caution! This is the first script that I will upload the source code for, any and all feedback will be greatly appreciated I have only started scripting recently so there may be some errors here and there. Download link: http://www.mediafire.com/file/0s3rq3q67e4363q/SimpleFisherman.jar Source code: import org.osbot.rs07.api.Skills; import org.osbot.rs07.api.map.Area; import org.osbot.rs07.api.map.constants.Banks; import org.osbot.rs07.api.model.NPC; import org.osbot.rs07.api.ui.Skill; import org.osbot.rs07.api.util.ExperienceTracker; import org.osbot.rs07.script.Script; import org.osbot.rs07.script.ScriptManifest; import java.awt.*; import java.util.concurrent.TimeUnit; @ScriptManifest(author = "Tommm39", name = "SimpleFisherman", info = "", version = 1.0, logo = "") public class Main extends Script { private Skills s; private ExperienceTracker track; private String status = ""; private long timeBegan; private long timeRan; private final Area shrimpArea = new Area(3092, 3234, 3081, 3226); private final Area flyFishingArea = new Area(3102, 3422, 3109, 3434); private final Area lumbridgeBankArea = new Area(3208, 3218, 3209, 3219); public void onStart() { this.track = getExperienceTracker(); track.start(Skill.FISHING); this.s = getSkills(); this.timeBegan = System.currentTimeMillis(); } public void onExit() { } public int onLoop() throws InterruptedException { if (getInventory().isFull()) { drop(); } else if (!getInventory().contains("Small fishing net") && !getInventory().contains("Fly fishing rod")) { getFishingEquipment(); } else if ((s.getDynamic(Skill.FISHING) < 20) && (getInventory().contains("Small fishing net"))) { fishShrimp(); } else if ((s.getDynamic(Skill.FISHING) >= 20) && (getInventory().contains("Fly fishing rod"))) { flyFish(); } else if ((s.getDynamic(Skill.FISHING) < 20) && (!getInventory().contains("Small fishing net"))) { getFishingEquipment(); } else if ((s.getDynamic(Skill.FISHING) >= 20) && (!getInventory().contains("Fly fishing rod"))) { getFishingEquipment(); } return random(500, 550); } public void getFishingEquipment() throws InterruptedException { status = "Getting equipment"; Boolean lowLevelEquipment = false; if (s.getDynamic(Skill.FISHING) < 20) { lowLevelEquipment = true; } if (getWalking().webWalk(Banks.LUMBRIDGE_UPPER)) { Timing.waitCondition(() -> lumbridgeBankArea.contains(myPosition()), 5000); sleep(random(100, 500)); } if (getBank().open()) { if (getBank().depositAll()) { Timing.waitCondition(() -> getInventory().isEmpty(), 5000); } if (lowLevelEquipment == false) { if (getBank().withdraw("Fly fishing rod", 1)) ; Timing.waitCondition(() -> getInventory().contains("Fly fishing rod"), 5000); sleep(random(100, 500)); } else { if (getBank().withdraw("Small fishing net", 1)) ; Timing.waitCondition(() -> getInventory().contains("Fly fishing rod"), 5000); sleep(random(100, 500)); } } if (lowLevelEquipment == false) { if (getBank().withdrawAll("Feather")) { Timing.waitCondition(() -> getInventory().contains("Feather"), 5000); sleep(random(100, 500)); } } if (getBank().close()) { Timing.waitCondition(() -> !getBank().isOpen(), 5000); sleep(random(100, 500)); } } public void drop() throws InterruptedException { status = "Dropping inventory"; if (getInventory().dropAllExcept("Small fishing net", "Fly fishing rod", "Feather")) { Timing.waitCondition(() -> getInventory().onlyContains("Small fishing net", "Fly fishing rod", "Feather"), 5000); sleep(random(100, 500)); } } public void fishShrimp() throws InterruptedException { if (!shrimpArea.contains(myPosition())) { status = "Walking to shrimp area"; getWalking().webWalk(shrimpArea); Timing.waitCondition(() -> shrimpArea.contains(myPosition()), 5000); sleep(random(100, 500)); } else { NPC shrimpSpot = getNpcs().closest(1518); status = "Fishing shrimp"; if (myPlayer().getAnimation() == -1) { if (shrimpSpot != null) { if (shrimpSpot.interact()) { Timing.waitCondition(() -> shrimpSpot == null || getDialogues().isPendingContinuation(), 5000); sleep(random(100, 500)); } } } } } public void flyFish() throws InterruptedException { if (!flyFishingArea.contains(myPosition())) { status = "Walking to fly-fishing area"; getWalking().webWalk(flyFishingArea); Timing.waitCondition(() -> flyFishingArea.contains(myPosition()), 5000); sleep(random(100, 500)); } else { NPC flySpot = getNpcs().closest(1526); status = "Fishing trout/salmon"; if (myPlayer().getAnimation() == -1) { if (flySpot != null) { if (flySpot.interact("Lure")) { Timing.waitCondition(() -> flySpot == null || getDialogues().isPendingContinuation(), 5000); sleep(random(100, 500)); } } } } } public void onPaint(Graphics2D g) { Graphics2D gr = g; int fishingExperience = track.getGainedXPPerHour(Skill.FISHING); int levelsGained = track.getGainedLevels(Skill.FISHING); long timeToLevel = track.getTimeToLevel(Skill.FISHING); timeRan = System.currentTimeMillis() - this.timeBegan; g.setBackground(Color.WHITE); g.drawString("Thanks for using SimpleFisherman by Tommm39", 10, 230); g.drawString("Time Running: " + formatTime(timeRan), 10, 250); g.drawString("Fishing XP/HR: " + fishingExperience, 10, 270); g.drawString("Time to Level: " + formatTime(timeToLevel), 10, 290); g.drawString("Levels Gained: " + levelsGained, 10, 310); g.drawString("Status: " + status, 10, 330); } private String formatTime(long duration) { String formattedTime = ""; long days = TimeUnit.MILLISECONDS.toDays(duration); long hours = TimeUnit.MILLISECONDS.toHours(duration) - TimeUnit.DAYS.toHours(TimeUnit.MILLISECONDS.toDays(duration)); long minutes = TimeUnit.MILLISECONDS.toMinutes(duration) - TimeUnit.HOURS.toMinutes(TimeUnit.MILLISECONDS.toHours(duration)); long seconds = TimeUnit.MILLISECONDS.toSeconds(duration) - TimeUnit.MINUTES.toSeconds(TimeUnit.MILLISECONDS.toMinutes(duration)); if (days == 0) { formattedTime = (hours + ":" + minutes + ":" + seconds); } else { formattedTime = (days + ":" + hours + ":" + minutes + ":" + seconds); } return formattedTime; } } Edited May 15, 2018 by Tommm39 1 Quote Link to comment Share on other sites More sharing options...
Nintendo Switch Posted May 15, 2018 Share Posted May 15, 2018 gj dude! apply for s1 Quote Link to comment Share on other sites More sharing options...
FuryShark Posted May 15, 2018 Share Posted May 15, 2018 This has to be the best script ......................................................... in the world Quote Link to comment Share on other sites More sharing options...
geoffrey456 Posted May 15, 2018 Share Posted May 15, 2018 download link doesnt work Quote Link to comment Share on other sites More sharing options...
Tommm39 Posted May 15, 2018 Author Share Posted May 15, 2018 1 hour ago, geoffrey456 said: download link doesnt work My apologies, had to make a quick update and forgot to update the download link, should work now Quote Link to comment Share on other sites More sharing options...
geoffrey456 Posted May 16, 2018 Share Posted May 16, 2018 On 5/15/2018 at 7:08 PM, Tommm39 said: My apologies, had to make a quick update and forgot to update the download link, should work now ty Quote Link to comment Share on other sites More sharing options...
SOG RS Posted May 16, 2018 Share Posted May 16, 2018 (edited) really nice bot! Edited May 16, 2018 by SOG RS Quote Link to comment Share on other sites More sharing options...
Tommm39 Posted May 17, 2018 Author Share Posted May 17, 2018 11 hours ago, SOG RS said: really nice bot! Thank you Quote Link to comment Share on other sites More sharing options...
The Devil Posted May 17, 2018 Share Posted May 17, 2018 Nice bot. How long do you think until GE is implemented? Quote Link to comment Share on other sites More sharing options...
Tommm39 Posted May 17, 2018 Author Share Posted May 17, 2018 45 minutes ago, thedevilhacker said: Nice bot. How long do you think until GE is implemented? Thanks bro, probably a week or so? Won't take that long to actually code but I have exams atm so don't have loads of free time to figure it out Quote Link to comment Share on other sites More sharing options...
BotMark Posted May 23, 2018 Share Posted May 23, 2018 Heres a proggy, works fine Quote Link to comment Share on other sites More sharing options...
Tommm39 Posted May 24, 2018 Author Share Posted May 24, 2018 20 hours ago, BotMark said: Heres a proggy, works fine Nice proggy man keep up the good work! Quote Link to comment Share on other sites More sharing options...
JCY Posted May 30, 2018 Share Posted May 30, 2018 Hey man! I started it at draynor and nothing happens, worked fine at barbarian village, just not the 1-20, thanks! Quote Link to comment Share on other sites More sharing options...
01053 Posted May 30, 2018 Share Posted May 30, 2018 (edited) Nice job, although only thing I'd point out for in future. private String formatTime(long duration) { String formattedTime = ""; long days = TimeUnit.MILLISECONDS.toDays(duration); long hours = TimeUnit.MILLISECONDS.toHours(duration) - TimeUnit.DAYS.toHours(TimeUnit.MILLISECONDS.toDays(duration)); long minutes = TimeUnit.MILLISECONDS.toMinutes(duration) - TimeUnit.HOURS.toMinutes(TimeUnit.MILLISECONDS.toHours(duration)); long seconds = TimeUnit.MILLISECONDS.toSeconds(duration) - TimeUnit.MINUTES.toSeconds(TimeUnit.MILLISECONDS.toMinutes(duration)); if (days == 0) { formattedTime = (hours + ":" + minutes + ":" + seconds); } else { formattedTime = (days + ":" + hours + ":" + minutes + ":" + seconds); } return formattedTime; } Could be: private String formatTime(long duration) { String formattedTime = ""; long days = TimeUnit.MILLISECONDS.toDays(duration); long hours = TimeUnit.MILLISECONDS.toHours(duration) - TimeUnit.DAYS.toHours(TimeUnit.MILLISECONDS.toDays(duration)); long minutes = TimeUnit.MILLISECONDS.toMinutes(duration) - TimeUnit.HOURS.toMinutes(TimeUnit.MILLISECONDS.toHours(duration)); long seconds = TimeUnit.MILLISECONDS.toSeconds(duration) - TimeUnit.MINUTES.toSeconds(TimeUnit.MILLISECONDS.toMinutes(duration)); formattedTime = days > 0 ? (days + ":" + hours + ":" + minutes + ":" + seconds) : (hours + ":" + minutes + ":" + seconds); return formattedTime; } Using ternary operators, How it works basically is formattedTime = condition ? true : false; Well done on the script though looks alright! Edited May 30, 2018 by 01053 Quote Link to comment Share on other sites More sharing options...
Prolax Posted May 31, 2018 Share Posted May 31, 2018 Nice + clean code. Quote Link to comment Share on other sites More sharing options...