Paradox68 Posted January 7, 2016 Share Posted January 7, 2016 (edited) Yeah I was kinda upset there was nothing on the SDN for free people could use to fish for trout and salmon at edgeville/barb AND bank the fish....So I made a script really quick that does just that figured you guys might like it? I'm too lazy to upload it so if someone wants to do that go ahead. It just catches fish and banks them as opposed to power fishing. No configurable options, just does that one thing. You're welcome to those who wanted this. import java.awt.Color; import java.awt.Font; import java.awt.Graphics2D; import org.osbot.rs07.api.map.Area; import org.osbot.rs07.api.map.Position; import org.osbot.rs07.api.map.constants.Banks; import org.osbot.rs07.api.model.NPC; import org.osbot.rs07.api.model.RS2Object; import org.osbot.rs07.api.ui.Skill; import org.osbot.rs07.api.ui.Tab; import org.osbot.rs07.script.Script; import org.osbot.rs07.script.ScriptManifest; @ScriptManifest(author = "Paradox68", info = "Paradox simple Edgeville fishing script.", name = "Paradox Simple Edge Fisher", version = 1.0, logo = "") public class main extends Script { private long timeStart; private String state = "Initializing.."; private int invCount = 0; private int caught = 0; private int lastMA = 0; Area fishArea = new Area( new Position(3111,3437,0), new Position(3100,3422,0)); Area edgeBank = new Area( new Position(3098,3499,0), new Position(3091,3488,0)); @Override public void onStart() { getExperienceTracker().start(Skill.FISHING); timeStart = System.currentTimeMillis(); } @Override public void onPaint(Graphics2D g) { long timeElapsed = System.currentTimeMillis() - timeStart; long seconds = (timeElapsed / 1000) % 60; long minutes = (timeElapsed / (1000 * 60)) % 60; long hours = (timeElapsed / (1000 * 60 * 60)) % 24; g.setFont(new Font("Trebuchet MS", Font.PLAIN, 14)); g.setColor(Color.white); g.drawString("x", (int)getMouse().getPosition().getX() - 4, (int)getMouse().getPosition().getY() + 5); g.drawString(state, 8, 50); g.drawString("Time Running: " + (hours >= 10 ? "" + hours : "0" + hours) + ":" + (minutes >= 10 ? "" + minutes : "0" + minutes) + ":" + (seconds >= 10 ? "" + seconds : "0" + seconds), 8, 65); g.drawString("XP Gained: " + getExperienceTracker().getGainedXP(Skill.FISHING) + " (" + getExperienceTracker().getGainedLevels(Skill.FISHING) + ")", 8, 80); g.drawString("Fish caught: " + caught, 8, 95); } private void randomizeMouse() { lastMA++; if (lastMA > 4) { int i = random(5); switch (i) { case 0: case 1: getMouse().moveOutsideScreen(); break; case 2: getMouse().moveRandomly(); break; case 3: getMouse().moveSlightly(); lastMA = 3; break; case 4: getMouse().moveVerySlightly(); break; case 5: getTabs().open(randomTab()); if (getTabs().getOpen() == Tab.SKILLS) { getMouse().move(704, 283); } } lastMA = 0; } } private Tab randomTab() { int i = random(6); switch(i) { case 0: case 1: return Tab.INVENTORY; case 2: return Tab.EQUIPMENT; case 3: return Tab.ATTACK; case 4: return Tab.SKILLS; case 5: return Tab.FRIENDS; case 6: return Tab.QUEST; } return Tab.SKILLS; } @Override public int onLoop() throws InterruptedException { if (getInventory().isFull() && !edgeBank.contains(myPlayer()) && !getBank().isOpen()) { state = "Walking to bank"; getWalking().webWalk(new Position(Banks.EDGEVILLE.getRandomPosition())); } if (getInventory().isFull() && edgeBank.contains(myPlayer()) && !getBank().isOpen()) { RS2Object bank = getObjects().closest("Bank booth"); state = "Opening bank"; if (bank != null) { if (bank.interact("Bank")) { state = "Depositing items"; sleep(1000); } } } if (getInventory().isFull() && edgeBank.contains(myPlayer()) && getBank().isOpen()) { getBank().depositAllExcept("Fly fishing rod", "Feather"); while (getInventory().contains("Trout") || getInventory().contains("Salmon")) { sleep(100); } state = "Closing bank"; getBank().close(); } if (!getInventory().isFull() && !fishArea.contains(myPlayer()) && !getBank().isOpen() ) { state = "Walking to fishing spots."; getWalking().webWalk(new Position(3102 + random(3), 3433 + random(3), 0)); } if (!getInventory().isFull() && fishArea.contains(myPlayer())) { NPC spot = getNpcs().closest("Fishing spot"); state = "Finding spot."; if (spot != null && spot.hasAction("Lure")) { spot.interact("Lure"); sleep(2000); invCount = getInventory().getEmptySlots(); } while (myPlayer().isAnimating()) { state = "Catching fish."; randomizeMouse(); if (getInventory().getEmptySlots() != invCount && fishArea.contains(myPlayer())) { invCount = getInventory().getEmptySlots(); caught += 1; } sleep(1000); } } return random(500, 800); } } Not gonna wait two hours for a good proggy but here's one. Theoretically if it lasts through one full iteration, it can last through a billion....I did two iterations for posterity and cause i'm such a saint. Edited January 8, 2016 by Paradox68 Quote Link to comment Share on other sites More sharing options...
Ben Osborne Posted January 7, 2016 Share Posted January 7, 2016 Gz on release, nice to see people releasing scripts for some of the people who dont have the means to get the premium ones, i had that problem for a while as couldnt use paypal Quote Link to comment Share on other sites More sharing options...
MalikDz Posted January 7, 2016 Share Posted January 7, 2016 while (getInventory().contains("Trout") || getInventory().contains("Salmon")) { sleep(100); } u might get stuck here m8 4 Quote Link to comment Share on other sites More sharing options...
Paradox68 Posted January 8, 2016 Author Share Posted January 8, 2016 (edited) while (getInventory().contains("Trout") || getInventory().contains("Salmon")) { sleep(100); } u might get stuck here m8 Nah it won't get stuck because the onLoop calls depositAllExcept("Fly fishing rod", "Feather"); in the event before the while event is handled. So logically unless the computer somehow skips a line of code for the first time since the computer was invented, then the event should execute just fine. I ran the script for 8 hours yesterday no errors. If you feel more comfortable removing it, you're welcome to do so. I just used it so depositAllExcept("Fly fishing rod", "Feather"); wasn't being called every 500-800ms while the bank was open. I'm sure there are better ways but as you can see this is not a full-measure script release. Edited January 8, 2016 by Paradox68 Quote Link to comment Share on other sites More sharing options...
Paradox68 Posted January 8, 2016 Author Share Posted January 8, 2016 Since the script got a bit of love, here's an updated version of the original script with some mouse moving anti-ban methods, and switched to webwalking. import java.awt.Color; import java.awt.Font; import java.awt.Graphics2D; import org.osbot.rs07.api.map.Area; import org.osbot.rs07.api.map.Position; import org.osbot.rs07.api.map.constants.Banks; import org.osbot.rs07.api.model.NPC; import org.osbot.rs07.api.model.RS2Object; import org.osbot.rs07.api.ui.Skill; import org.osbot.rs07.api.ui.Tab; import org.osbot.rs07.script.Script; import org.osbot.rs07.script.ScriptManifest; @ScriptManifest(author = "Paradox68", info = "Paradox simple Edgeville fishing script.", name = "Paradox Simple Edge Fisher", version = 1.0, logo = "") public class main extends Script { private long timeStart; private String state = "Initializing.."; private int invCount = 0; private int caught = 0; private int lastMA = 0; Area fishArea = new Area( new Position(3111,3437,0), new Position(3100,3422,0)); Area edgeBank = new Area( new Position(3098,3499,0), new Position(3091,3488,0)); @Override public void onStart() { getExperienceTracker().start(Skill.FISHING); timeStart = System.currentTimeMillis(); } @Override public void onPaint(Graphics2D g) { long timeElapsed = System.currentTimeMillis() - timeStart; long seconds = (timeElapsed / 1000) % 60; long minutes = (timeElapsed / (1000 * 60)) % 60; long hours = (timeElapsed / (1000 * 60 * 60)) % 24; g.setFont(new Font("Trebuchet MS", Font.PLAIN, 14)); g.setColor(Color.white); g.drawString("x", (int)getMouse().getPosition().getX() - 4, (int)getMouse().getPosition().getY() + 5); g.drawString(state, 8, 50); g.drawString("Time Running: " + (hours >= 10 ? "" + hours : "0" + hours) + ":" + (minutes >= 10 ? "" + minutes : "0" + minutes) + ":" + (seconds >= 10 ? "" + seconds : "0" + seconds), 8, 65); g.drawString("XP Gained: " + getExperienceTracker().getGainedXP(Skill.FISHING) + " (" + getExperienceTracker().getGainedLevels(Skill.FISHING) + ")", 8, 80); g.drawString("Fish caught: " + caught, 8, 95); } private void randomizeMouse() { lastMA++; if (lastMA > 4) { int i = random(5); switch (i) { case 0: case 1: getMouse().moveOutsideScreen(); break; case 2: getMouse().moveRandomly(); break; case 3: getMouse().moveSlightly(); lastMA = 3; break; case 4: getMouse().moveVerySlightly(); break; case 5: getTabs().open(randomTab()); if (getTabs().getOpen() == Tab.SKILLS) { getMouse().move(704, 283); } } lastMA = 0; } } private Tab randomTab() { int i = random(6); switch(i) { case 0: case 1: return Tab.INVENTORY; case 2: return Tab.EQUIPMENT; case 3: return Tab.ATTACK; case 4: return Tab.SKILLS; case 5: return Tab.FRIENDS; case 6: return Tab.QUEST; } return Tab.SKILLS; } @Override public int onLoop() throws InterruptedException { if (getInventory().isFull() && !edgeBank.contains(myPlayer()) && !getBank().isOpen()) { state = "Walking to bank"; getWalking().webWalk(new Position(Banks.EDGEVILLE.getRandomPosition())); } if (getInventory().isFull() && edgeBank.contains(myPlayer()) && !getBank().isOpen()) { RS2Object bank = getObjects().closest("Bank booth"); state = "Opening bank"; if (bank != null) { if (bank.interact("Bank")) { state = "Depositing items"; sleep(1000); } } } if (getInventory().isFull() && edgeBank.contains(myPlayer()) && getBank().isOpen()) { getBank().depositAllExcept("Fly fishing rod", "Feather"); while (getInventory().contains("Trout") || getInventory().contains("Salmon")) { sleep(100); } state = "Closing bank"; getBank().close(); } if (!getInventory().isFull() && !fishArea.contains(myPlayer()) && !getBank().isOpen() ) { state = "Walking to fishing spots."; getWalking().webWalk(new Position(3102 + random(3), 3433 + random(3), 0)); } if (!getInventory().isFull() && fishArea.contains(myPlayer())) { NPC spot = getNpcs().closest("Fishing spot"); state = "Finding spot."; if (spot != null && spot.hasAction("Lure")) { spot.interact("Lure"); sleep(2000); invCount = getInventory().getEmptySlots(); } while (myPlayer().isAnimating()) { state = "Catching fish."; randomizeMouse(); if (getInventory().getEmptySlots() != invCount && fishArea.contains(myPlayer())) { invCount = getInventory().getEmptySlots(); caught += 1; } sleep(1000); } } return random(500, 800); } } Quote Link to comment Share on other sites More sharing options...
Easy Posted January 18, 2016 Share Posted January 18, 2016 while (myPlayer().isAnimating()) { Don't use while loops in your scripts. The only while loop you should be using is the onLoop method that you're forced to override after extending script. Since your script is already looping, you could easily use an if statement to check if you're animating. Quote Link to comment Share on other sites More sharing options...
Prolax Posted January 21, 2016 Share Posted January 21, 2016 while (myPlayer().isAnimating()) { Don't use while loops in your scripts. The only while loop you should be using is the onLoop method that you're forced to override after extending script. Since your script is already looping, you could easily use an if statement to check if you're animating. Good point, I'll keep this in mind too. Quote Link to comment Share on other sites More sharing options...
Good4RsVid Posted January 24, 2016 Share Posted January 24, 2016 (edited) 帮我 Edited January 26, 2016 by Good4RsVid Quote Link to comment Share on other sites More sharing options...
Good4RsVid Posted January 24, 2016 Share Posted January 24, 2016 (edited) I would like to use Edited January 26, 2016 by Good4RsVid Quote Link to comment Share on other sites More sharing options...
Good4RsVid Posted January 26, 2016 Share Posted January 26, 2016 There are two mistakes on webwalk, you can change the next, send a complete code can do Quote Link to comment Share on other sites More sharing options...