mateogon Posted January 7, 2020 Share Posted January 7, 2020 (edited) Made this Rogue's den script a couple weeks ago when I was starting to make scripts, and haven't changed since because I got the outfit, so it's not as good as it could be. It completes the minigame but there are some things that I haven't implemented. The requirements for the minigame are 50 agility and 50 thieving. Instructions: start the bot in rogue's den bank area. The bot will try to drink stamina potions before going into the game, if you have in the bank. It's not 100% afk. It sometimes fails and you need to restart the script. I coded the whole game so it's not checking if it failed an obstacle. I think diving the code into sections/states and having checks in between might do it. If someone has a better idea I would like to know. Source: import org.osbot.rs07.api.Skills; import org.osbot.rs07.api.Widgets; import org.osbot.rs07.api.map.Area; import org.osbot.rs07.api.map.Position; import org.osbot.rs07.api.model.*; import org.osbot.rs07.api.ui.RS2Widget; import org.osbot.rs07.api.ui.Skill; import org.osbot.rs07.input.mouse.MainScreenTileDestination; import org.osbot.rs07.script.Script; import org.osbot.rs07.script.ScriptManifest; import org.osbot.rs07.utility.ConditionalSleep; import java.awt.*; import java.util.Arrays; import java.util.LinkedList; import java.util.List; @ScriptManifest(author = "Mateogon", info = "", logo = "", version = 1.0, name = "mRoguesDen") public class mRoguesDen extends Script { LinkedList<MousePathPoint> mousePath = new LinkedList<MousePathPoint>(); int y;//paint y position private long startTime; int laps; int lapsph; boolean started; List<Skill> skillList = Arrays.asList(Skill.AGILITY, Skill.THIEVING); Skill skill; int debug; Position pos; RS2Object obj; Area bank = new Area(3040, 4974, 3045, 4969).setPlane(1); //rogues den bank @Override public void onStart() { started = false; startTime = System.currentTimeMillis(); getExperienceTracker().start(Skill.THIEVING); getExperienceTracker().start(Skill.AGILITY); laps = 0; debug = 4; } @Override public int onLoop() throws InterruptedException { checkRunning(10, 12); Area beforeFirstGate = new Area(3056, 4991, 3056, 4986).setPlane(1); getWalking().walk(beforeFirstGate); new ConditionalSleep(8000) { public boolean condition() throws InterruptedException { return beforeFirstGate.contains(myPlayer()); } }.sleep(); objInteract(getObjects().closest(obj -> obj.getId() == 7256), "Open", false); started = true; exactWalk(new Position(3053, 4995, 1)); objInteract(getObjects().closest("Contortion Bars"), "Enter", false); sleep(random(1000, 1200)); exactWalk(new Position(3042, 4997, 1));//pendulum exactWalk(new Position(3037, 4999, 1));//trap floor exactWalk(new Position(3033, 4999, 1)); exactWalk(new Position(3032, 4999, 1)); exactWalk(new Position(3028, 4999, 1)); objInteract(getObjects().closest(obj -> obj.getId() == 7255), "Open", false); exactWalk(new Position(3018, 5002, 1));//diagonal traps exactWalk(new Position(3014, 5003, 1)); exactWalk(new Position(3012, 5001, 1)); exactWalk(new Position(3009, 5003, 1)); exactWalk(new Position(3008, 5003, 1)); exactWalk(new Position(3004, 5003, 1)); normalWalk(new Position(2994, 5004, 1)); objInteract(getObjects().closest(obj -> obj.getId() == 7240), "Climb", true); normalWalk(new Position(2978, 5005, 1)); normalWalk(new Position(2971, 5018, 1)); exactWalk(new Position(2970, 5018, 1)); exactWalk(new Position(2969, 5018, 1)); normalWalk(new Position(2962, 5024, 1)); exactWalk(new Position(2962, 5028, 1)); sleep(random(1000, 1200)); objInteract(getObjects().closest(obj -> obj.getId() == 7239 && obj.getPosition().equals(new Position(2958, 5031, 1))), "Climb", true); normalWalk(new Position(2963, 5046, 1)); exactWalk(new Position(2963, 5050, 1)); objInteract(getObjects().closest(obj -> obj.getId() == 7227 && obj.getPosition().equals(new Position(2963, 5051, 1))), "Search", false); //exactWalk(new Position(2963, 5055, 1)); normalWalk(new Position(2957, 5065, 1)); objInteract(getObjects().closest(obj -> obj.getId() == 7219), "Enter", false); exactWalk(new Position(2957, 5076, 1)); normalWalk(new Position(2956, 5087, 1)); //normalWalk(new Position(2955, 5092, 1)); objInteract(getObjects().closest(obj -> obj.getId() == 7219), "Enter", false); normalWalk(new Position(2955, 5107, 1)); normalWalk(new Position(2961, 5107, 1)); exactWalk(new Position(2963, 5103, 1)); exactWalk(new Position(2963, 5101, 1)); exactWalk(new Position(2964, 5101, 1)); exactWalk(new Position(2966, 5101, 1)); exactWalk(new Position(2967, 5100, 1)); exactWalk(new Position(2972, 5099, 1)); objInteract(getObjects().closest(obj -> obj.getId() == 7219), "Enter", false); objInteract(getObjects().closest(obj -> obj.getId() == 7255), "Open", false); normalWalk(new Position(2972, 5087, 1)); if (myPlayer().getPosition() != new Position(2972, 5087, 1)) { exactWalk(new Position(2972, 5087, 1)); } ; exactWalk(new Position(2975, 5087, 1)); exactWalk(new Position(2980, 5087, 1)); sleep(random(1100, 2100)); objInteract(getObjects().closest(obj -> obj.getId() == 7240 && getMap().canReach(obj)), "Climb", true); //obj.getPosition().equals(new Position(2983, 5087, 1)) sleep(random(2567, 3898)); exactWalk(new Position(2992, 5088, 1)); objInteract(getObjects().closest(obj -> obj.getId() == 7249 && obj.getPosition().equals(new Position(2993, 5087, 1))), "Search", false); sleep(random(1100, 2100)); exactWalk(new Position(2997, 5088, 1)); exactWalk(new Position(3000, 5087, 1)); exactWalk(new Position(3001, 5087, 1)); exactWalk(new Position(3005, 5087, 1)); normalWalk(new Position(3017, 5081, 1)); takeItem(getGroundItems().closest(item -> item.getId() == 5568)); tileWidget(getObjects().closest(obj -> obj.getId() == 7234));//TODO not working yet normalWalk(new Position(3030, 5079, 1)); int a = 800; int b = 1200; objInteract(getObjects().closest(obj -> obj.getId() == 7255 && obj.getPosition().equals(new Position(3030, 5079, 1))), "Open", false); sleep(random(a, b)); objInteract(getObjects().closest(obj -> obj.getId() == 7255 && obj.getPosition().equals(new Position(3032, 5078, 1))), "Open", false); sleep(random(a, b)); objInteract(getObjects().closest(obj -> obj.getId() == 7255 && obj.getPosition().equals(new Position(3036, 5076, 1))), "Open", false); sleep(random(a, b)); objInteract(getObjects().closest(obj -> obj.getId() == 7255 && obj.getPosition().equals(new Position(3039, 5079, 1))), "Open", false); sleep(random(a, b)); objInteract(getObjects().closest(obj -> obj.getId() == 7255 && obj.getPosition().equals(new Position(3042, 5076, 1))), "Open", false); sleep(random(a, b)); exactWalk(new Position(3044, 5071, 1)); sleep(random(1500, 2000)); objInteract(getObjects().closest(obj -> obj.getId() == 7255 && obj.getPosition().equals(new Position(3044, 5069, 1))), "Open", false); sleep(random(a, b)); objInteract(getObjects().closest(obj -> obj.getId() == 7255 && obj.getPosition().equals(new Position(3041, 5068, 1))), "Open", false); sleep(random(a, b)); objInteract(getObjects().closest(obj -> obj.getId() == 7255 && obj.getPosition().equals(new Position(3040, 5070, 1))), "Open", false); sleep(random(a, b)); objInteract(getObjects().closest(obj -> obj.getId() == 7255 && obj.getPosition().equals(new Position(3038, 5069, 1))), "Open", false); sleep(random(a, b)); normalWalk(new Position(3039, 5049, 1)); normalWalk(new Position(3031, 5033, 1)); exactWalk(new Position(3028, 5033, 1)); exactWalk(new Position(3024, 5033, 1)); normalWalk(new Position(3016, 5033, 1)); objInteract(getObjects().closest(obj -> obj.getId() == 7255 && obj.getPosition().equals(new Position(3015, 5033, 1))), "Open", false); exactWalk(new Position(3010, 5033, 1)); objInteract(getObjects().closest(obj -> obj.getId() == 7255 && obj.getPosition().equals(new Position(3010, 5033, 1))), "Open", false); exactWalk(new Position(3008, 5033, 1)); exactWalk(new Position(3004, 5033, 1)); exactWalk(new Position(3000, 5033, 1)); normalWalk(new Position(2994, 5044, 1)); exactWalk(new Position(2992, 5045, 1)); exactWalk(new Position(2992, 5049, 1)); exactWalk(new Position(2992, 5053, 1)); normalWalk(new Position(2992, 5064, 1)); exactWalk(new Position(2992, 5067, 1)); exactWalk(new Position(2992, 5071, 1)); exactWalk(new Position(2992, 5075, 1)); normalWalk(new Position(3006, 5066, 1)); //exactWalk(new Position(3009, 5063, 1)); takeItem(getGroundItems().closest("Flash powder")); //takeItem(getGroundItems().closest(item -> item. && item.getPosition() == (new Position(3009,5063,1)))); new ConditionalSleep(4000) { public boolean condition() throws InterruptedException { return (getInventory().contains(5559)); } }.sleep(); long count = getInventory().getAmount(5559); NPC guard = getNpcs().closest(npc -> npc.getId() == (3191)); while (guard == null) { guard = getNpcs().closest(npc -> npc.getId() == (3191)); log("guard is null,waiting"); sleep(random(300, 600)); }checkRunning(10,12); getInventory().getItem(5559).interact("Use"); while (myPlayer().getPosition().distance(guard.getPosition()) > 8) { sleep(random(500, 800)); } guard.interact("Use"); new ConditionalSleep(4000) { public boolean condition() throws InterruptedException { return (getInventory().getAmount(5559) < count); } }.sleep(); normalWalk(new Position(3025, 5060, 1)); exactWalk(new Position(3028, 5054, 1)); if (myPlayer().getPosition() != new Position(3028, 5051, 1)){ exactWalk(new Position(3028, 5051, 1)); } exactWalk(new Position(3028, 5048, 1)); normalWalk(new Position(3019, 5047, 1)); objInteract(getObjects().closest(obj -> obj.getId() == 7237), "Crack", false); new ConditionalSleep(4000) { public boolean condition() throws InterruptedException { return (dialogues.isPendingContinuation()); } }.sleep(); dialogues.clickContinue(); new ConditionalSleep(4000) { public boolean condition() throws InterruptedException { return (dialogues.isPendingContinuation()); } }.sleep(); dialogues.clickContinue(); laps += 1; getWalking().walk(bank.getRandomPosition()); new ConditionalSleep(4000) { public boolean condition() throws InterruptedException { return (bank.contains(myPlayer())); } }.sleep(); NPC banker = getNpcs().closest("Emerald Benedict"); banker.interact("Bank"); new ConditionalSleep(4000) { public boolean condition() throws InterruptedException { return (getBank().isOpen()); } }.sleep(); if (getInventory().getEmptySlots() < 28) { getBank().depositAll(); } String staminaname; if (getSettings().getRunEnergy() <= 95){ Item stamina = getBank().getItem(item -> item.getName().contains("Stamina") && item.getName().contains("1")); if (stamina == null){ for (int i = 2; i < 5; i ++){ int n = i; stamina = getBank().getItem(item -> item.getName().contains("Stamina") && item.getName().contains(Integer.toString(n))); if (stamina != null){break;} } } if (stamina != null){ getBank().withdraw(stamina.getName(),1);} getBank().close(); staminaname = stamina.getName(); new ConditionalSleep(4000) { public boolean condition() throws InterruptedException { return (!getBank().isOpen()); } }.sleep(); int energy = getSettings().getRunEnergy(); getInventory().getItem(item-> item.getName().equals(staminaname)).interact("Drink"); } if (getInventory().getEmptySlots() < 28){ banker.interact("Bank"); new ConditionalSleep(4000) { public boolean condition() throws InterruptedException { return (getBank().isOpen()); } }.sleep(); getBank().depositAll(); } getBank().close(); new ConditionalSleep(4000) { public boolean condition() throws InterruptedException { return (!getBank().isOpen()); } }.sleep(); started = false; checkRunning(10,12); //exactWalk(new Position(3053,4995,1)); return (random(181, 285)); } private Void tileWidget(RS2Object tiledoor) throws InterruptedException{ tiledoor.interact( "Open"); RS2Widget widget = getWidgets().get(293, 3); while(widget == null){ widget = getWidgets().get(293, 3); sleep(random(1200,1800));} if (widget != null) { log("widget detected"); widget.interact("Ok");} else{log("widget not detected");} sleep(random(2500,3000)); return null; } private Void moveCamera() throws InterruptedException{ if (getCamera().getPitchAngle() <= 53){ log("moving camera"); sleep(random(300,800)); getCamera().movePitch(random(55,67)); sleep(random(300,800)); } return null; } private Void takeItem(GroundItem item) throws InterruptedException{ moveCamera(); item.interact("Take"); new ConditionalSleep(4000) { public boolean condition() throws InterruptedException { return (getInventory().contains(item.getId())); } }.sleep(); sleep(random(1500,1800)); return null; } private Void objInteract(RS2Object obj,String action,boolean extrasleep) throws InterruptedException{ moveCamera(); if (obj != null) { obj.interact(action); } if (extrasleep){sleep(random(1810,2100));} new ConditionalSleep(obj.getId() == 7240 ? 12000:8000) { public boolean condition() throws InterruptedException { return (!myPlayer().isMoving() && !myPlayer().isAnimating()); } }.sleep(); sleep(random(1810,2100)); return null; } private Void exactWalk(Position pos) throws InterruptedException{ moveCamera(); pos.interact(this.bot, new String[]{"Walk here"}); new ConditionalSleep(5000) { public boolean condition() throws InterruptedException { return (myPlayer().getPosition().equals(pos) && !myPlayer().isMoving()); } }.sleep(); sleep(random(1400,1800)); //1800 2100 return null; } private Void normalWalk(Position pos) throws InterruptedException{ moveCamera(); getWalking().walk(pos); new ConditionalSleep(5000) { public boolean condition() throws InterruptedException { return (myPlayer().getPosition().distance(pos)<=2 && !myPlayer().isMoving()); } }.sleep(); sleep(random(1400,1800)); //1800 2100 return null; } private void checkRunning(int a,int b){ if ((getSettings().getRunEnergy() >= random(a,b)) && !getSettings().isRunning()) {getSettings().setRunning(true); } } public final String formatTime(final long ms){ long s = ms / 1000, m = s / 60, h = m / 60; s %= 60; m %= 60; h %= 24; return String.format("%02d:%02d:%02d", h, m, s); } public final String formatValue(final long l) { return (l > 1_000_000) ? String.format("%.2fm", ((double) l / 1_000_000)) : (l > 1000) ? String.format("%.1fk", ((double) l / 1000)) : l + ""; } public void onPaint(Graphics2D g) { Font font = new Font("Open Sans", Font.BOLD, 15); g.setFont(font); g.setColor(Color.black); // Changing the size of the current font to size 18 g.drawString("mRoguesDen", 15, 323); //for (Skill skill : skills) { for (int i = 0; i < skillList.size(); i ++){ skill = skillList.get(i); y =420+((i-1)*20); String tlvl = formatValue(getSkills().getStatic(skill)); String tglvl = formatValue(getExperienceTracker().getGainedLevels(skill)); String texp = formatValue(getExperienceTracker().getGainedXP(skill)); String texph = formatValue(getExperienceTracker().getGainedXPPerHour(skill)); String ttlvl = formatTime(getExperienceTracker().getTimeToLevel(skill)); g.drawString((skill.toString().toUpperCase()+":"+tlvl+"("+tglvl+")" +" EXP/H:" +texph+ " EXP GAINED: "+texp + " TTL: "+ttlvl), 15, y); } g.drawString((formatTime(System.currentTimeMillis() - startTime)), 15, 355); lapsph= (int)(laps / ((System.currentTimeMillis() - this.startTime) / 3600000.0D)); g.drawString("Laps p/h: " + lapsph+"("+laps+")", 15, 370); while (!mousePath.isEmpty() && mousePath.peek().isUp()) mousePath.remove(); Point clientCursor = mouse.getPosition(); MousePathPoint mpp = new MousePathPoint(clientCursor.x, clientCursor.y, 500); if (mousePath.isEmpty() || !mousePath.getLast().equals(mpp)) mousePath.add(mpp); MousePathPoint lastPoint = null; for (MousePathPoint a : mousePath) { if (lastPoint != null) { g.setColor(Color.RED); g.drawLine(a.x, a.y, lastPoint.x, lastPoint.y); } lastPoint = a; } } public class MousePathPoint extends Point { private long finishTime; private double lastingTime; public MousePathPoint(int x, int y, int lastingTime) { super(x, y); this.lastingTime = lastingTime; finishTime = System.currentTimeMillis() + lastingTime; } public boolean isUp() { return System.currentTimeMillis() > finishTime; } } } mRoguesDen.jar Edited January 8, 2020 by mateogon Quote Link to comment Share on other sites More sharing options...
Kramnik Posted January 7, 2020 Share Posted January 7, 2020 Nice one amigo. Thanks Quote Link to comment Share on other sites More sharing options...
Jacksonpm23 Posted January 15, 2020 Share Posted January 15, 2020 trying it out now Quote Link to comment Share on other sites More sharing options...
Medusa Posted January 16, 2020 Share Posted January 16, 2020 Bro. Why are you stealing my script names. mScriptName is trademarked by me bro... Quote Link to comment Share on other sites More sharing options...
Naked Posted January 21, 2020 Share Posted January 21, 2020 On 1/16/2020 at 1:01 AM, Medusa said: Bro. Why are you stealing my script names. mScriptName is trademarked by me bro... Quote Link to comment Share on other sites More sharing options...
Kramnik Posted January 22, 2020 Share Posted January 22, 2020 On 1/16/2020 at 9:01 AM, Medusa said: Bro. Why are you stealing my script names. mScriptName is trademarked by me bro... He only got two posts, maybe someone is being a troll Quote Link to comment Share on other sites More sharing options...
Medusa Posted January 22, 2020 Share Posted January 22, 2020 7 hours ago, Kramnik said: He only got two posts, maybe someone is being a troll Still angry as fuck (Jokes btw). Renaming any script I push to sdn in the future. Quote Link to comment Share on other sites More sharing options...
glowin slayr Posted April 1, 2020 Share Posted April 1, 2020 seems to keep getting stuck crossing the plank Quote Link to comment Share on other sites More sharing options...
Gardzz Posted April 4, 2020 Share Posted April 4, 2020 Says file is corrupt. Quote Link to comment Share on other sites More sharing options...
Farken Dan Posted May 17, 2020 Share Posted May 17, 2020 Anyone used this recently? Quote Link to comment Share on other sites More sharing options...
abboas Posted June 26, 2020 Share Posted June 26, 2020 sick Quote Link to comment Share on other sites More sharing options...
Kayde Posted September 16, 2021 Share Posted September 16, 2021 Anyone know if it’s still good? Quote Link to comment Share on other sites More sharing options...
Danielle Posted June 17, 2023 Share Posted June 17, 2023 Very helpful to me. Thanks for sharing. Quote Link to comment Share on other sites More sharing options...