Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 08/23/2022 in all areas

  1. Hey man, I'm newly trying to learn Java and taking up writing little scripts like this to help me learn. I assume you meant Mind Runes in Lumbridge Castle? As I don't know where the Body Runes spawn is (if you I'm wrong let me know and I can change this). Anyway wrote a very basic script that will loot the Mind Rune at the bottom of the stairs then hop to another world to loot another. It will only hop to F2P worlds that don't have restrictions (E.g. 750 total etc) or PVP. There are probably better ways to do this but it's working as expected. Here is the code; import com.epicbot.api.shared.APIContext; import com.epicbot.api.shared.GameType; import com.epicbot.api.shared.entity.GroundItem; import com.epicbot.api.shared.script.LoopScript; import com.epicbot.api.shared.script.ScriptManifest; import com.epicbot.api.shared.util.paint.frame.PaintFrame; import java.awt.*; import java.util.Random; @ScriptManifest(name = "Lumbridge Rune Looter", gameType = GameType.OS) public class LumbridgeRuneLooter extends LoopScript { @Override public boolean onStart(String... strings) { return true; } private int[] worlds = {301, 308, 316, 326, 335, 371, 379, 380, 382, 383, 384, 394, 397, 398, 399, 417, 418, 425, 426, 430, 431, 433, 434, 435, 436, 437, 451, 452, 453, 454, 455, 456, 469, 470, 471, 472, 473, 475, 476, 483, 497, 498, 499, 500, 501, 536, 537, 542, 543, 544, 545, 546, 547, 552, 553, 554, 555, 556, 557, 562, 563, 564, 565, 566, 567, 571, 573, 574, 575, 576}; private int rollDice(int maxRoll){ Random diceRoll = new Random(); int roll = diceRoll.nextInt(maxRoll); return roll; } private void hopWorld(){ int newWorld = worlds[rollDice(69)]; if(newWorld != getAPIContext().world().getCurrent()){ System.out.println("Hopping to world: " + newWorld); getAPIContext().world().hop(newWorld); } else { return; } } @Override protected int loop() { GroundItem mindRune = getAPIContext().groundItems().query().id(558).results().nearest(); if(mindRune == null){ hopWorld(); } else { System.out.println("Looting.."); mindRune.interact("Take"); } return 600; } @Override protected void onPaint(Graphics2D g, APIContext ctx) { PaintFrame frame = new PaintFrame("Lumbridge Rune Looter"); frame.addLine("idk how to make", "GUI"); frame.draw(g, 0, 170, ctx); } }
    1 point
  2. now with added banking ability & ore per hr tracking! import com.epicbot.api.shared.APIContext; import com.epicbot.api.shared.GameType; import com.epicbot.api.shared.entity.details.Locatable; import com.epicbot.api.shared.model.Area; import com.epicbot.api.shared.model.Tile; import com.epicbot.api.shared.script.LoopScript; import com.epicbot.api.shared.script.ScriptManifest; import com.epicbot.api.shared.util.paint.frame.PaintFrame; import com.epicbot.api.shared.util.time.Time; import com.epicbot.api.shared.util.time.Timer; import com.epicbot.api.shared.webwalking.model.RSBank; import com.epicbot.api.shared.webwalking.model.WalkState; import com.epicbot.api.shared.webwalking.model.WebPath; import java.awt.Graphics2D; @ScriptManifest(name = "VarrockEastMine", gameType = GameType.OS) public class VarrockEastMine extends LoopScript { // constants private final int[] f2pworlds = {380,382,383,394,397,398,399,417,418,430,433,434,435,436,437,451,452,453,454,455,456,470, 471,472,473,475,476,483,498,499,500,501,536,537,542,543,544,545,546,547,552,553,554,555,556,557,562,563,564,565, 566,567,571,573,574,575,576 }; private final int DELAY_BETWEEN_ORE_CLICKS = 900; //private final Tile TILE_MINE_AREA = new Tile(3287,3364); // varrock east mine private final Area AREA_MINE = new Area(new Tile(3280,3360),new Tile(3290,3370)); private final int[] COPPER_ROCKS = {11161,10943}; private final int[] IRON_ROCKS = {11364,11365}; private final Timer runTimer = new Timer(0); // global variables private String status = "Starting"; private int[] currentRocks = {}; boolean settedOres = false; String currentOre = "Copper"; private int invtSpace = 28; private int prevInvtSpace = 28; private int minedOres = 0; @Override public boolean onStart(String... strings) { if (!getAPIContext().client().isLoggedIn()){ Time.sleep(15000); } Time.sleep(5000); return true;// ; } @Override protected int loop() { setOres(); setInvtSpace(); if ( isInvtFull()){ System.out.println("bag is full"); goBanknDesposit(); } else if (isNearMine()){ System.out.println("start mining"); doMine(); } else { System.out.println("head to mine"); goNearMine(); } return 1337; // delay for 1.337 seconds } // tasks private void doMine(){ status = "Mining "+currentOre; while (!isInvtFull() && isRunning() && !isPaused() && !isStopping()){ if ( !getAPIContext().localPlayer().isAnimating() && !getAPIContext().localPlayer().isMoving() ) { getAPIContext().objects().query().id(currentRocks).results().nearest().interact("Mine"); Time.sleep(1800); } Time.sleep(DELAY_BETWEEN_ORE_CLICKS); } }; private void dropOres(){ status = "Dropping ores"; getAPIContext().inventory().dropAll(436,440); // copper and iron ores } private void goBanknDesposit(){ status = "Going to bank"; if ( !getAPIContext().localPlayer().isAnimating() && !getAPIContext().localPlayer().isMoving() ) { getAPIContext().webWalking().walkToBank(RSBank.VARROCK_EAST); } // deposit ores n gems status = "Despositing"; if ( !getAPIContext().localPlayer().isAnimating() && !getAPIContext().localPlayer().isMoving() ) { if (getAPIContext().bank().isReachable()) { getAPIContext().bank().open(); Time.sleep(2000); getAPIContext().bank().depositAllExcept("Bronze Pickaxe", "Iron Pickaxe", "Steel Pickaxe", "Black Pickaxe", "Mithril Pickaxe", "Adamant Pickaxe", "Rune Pickaxe"); Time.sleep(2000); } } // close bank if (getAPIContext().bank().isOpen()){ getAPIContext().bank().close(); } setInvtSpace(); }; private void goNearMine(){ System.out.println("starting go near mine"); status = "Going to mine"; if ( getAPIContext().localPlayer().isAnimating() || getAPIContext().localPlayer().isMoving() ) { System.out.println("exiting goNearMine with failure, sleep for 14secs"); Time.sleep(14000); return; } WebPath path = getAPIContext().webWalking().getPath(AREA_MINE.getCentralTile()); System.out.println("path status "+path.getPathStatus().toString()); WalkState ws = getAPIContext().webWalking().walkPath(path); System.out.println("walk state "+ws.toString()); if(ws == WalkState.SUCCESS){ System.out.println("exiting goNearMine with success"); }else { System.out.println("exiting goNearMine with failure, sleep for 15secs"); Time.sleep(15000); } //Time.sleep(5000, () -> AREA_MINE.contains(getAPIContext().localPlayer().getLocation())); }; private void setOres(){ if (settedOres) return; if (getAPIContext().skills().mining().getCurrentLevel()>14){ currentRocks = IRON_ROCKS; settedOres = true; currentOre ="Iron"; }else{ currentRocks = COPPER_ROCKS; } } private void setInvtSpace(){ prevInvtSpace = getAPIContext().inventory().getEmptySlotCount(); invtSpace = prevInvtSpace; } // checks private boolean isNearMine(){ Locatable playerLocation = getAPIContext().localPlayer().get().getLocation(); boolean nearmine = AREA_MINE.contains( playerLocation ); System.out.println("near mine boolean"+nearmine); return nearmine; }; private boolean isInvtFull(){ invtSpace = 28-getAPIContext().inventory().getCount(); if (invtSpace!=prevInvtSpace){ minedOres++; prevInvtSpace=invtSpace; } return invtSpace ==0; }; //todo worldHopIfCrowded //todo dismissRandomEvent @Override protected void onPaint(Graphics2D g, APIContext ctx) { PaintFrame frame = new PaintFrame("VarrockE mine"); frame.addLine("Time",runTimer.toElapsedString()); frame.addLine("Mined ores",minedOres); frame.addLine("Ores/h",getHourlyRate(minedOres)); frame.addLine("Status", status); frame.addLine("Free space", invtSpace); frame.draw(g, 0, 170, ctx); } private int getHourlyRate(int i) { return (int) (i / (runTimer.getElapsed() / 3600000.0D)); } }
    1 point
  3. Supports: Oak Larders (Start with noted Oak planks) Mahogany Tables (Start with noted Mahogany planks) Butler unnoting. Note: Only tested with demon butler. Features: Stops the script when gold is less than the butler service fee. Stops the script when you are out of noted planks. The script uses key bind interactions when running. Instructions: You must already be inside your house in building mode. You must have a Rope bell-pull built and have a butler already inside your house. You must setup up the butler un-note process before starting. (i.e, the first thing that should come up when you talk to the butler is about picking the x24 un-note option.) Start near your preferred mode build area with your setup. Source: https://github.com/christophernarciso/epicbot_scripts/tree/main/kconstruction/src/com/k/construction Download: https://github.com/christophernarciso/epicbot_scripts/blob/main/kconstruction/jar/kconstruction.jar
    1 point
  4. Thanks for the guide! Worth noting that the correct JDK version is 1.8 as well. I got stuck without noticing I had the wrong version
    1 point
  5. Worked a little bit on it: import com.epicbot.api.shared.APIContext; import com.epicbot.api.shared.GameType; import com.epicbot.api.shared.entity.SceneObject; import com.epicbot.api.shared.model.Area; import com.epicbot.api.shared.model.Skill; import com.epicbot.api.shared.model.Tile; import com.epicbot.api.shared.util.paint.frame.PaintFrame; import com.epicbot.api.shared.script.LoopScript; import com.epicbot.api.shared.script.ScriptManifest; import com.epicbot.api.shared.util.time.Time; import com.epicbot.api.shared.util.time.Timer; import java.awt.*; @ScriptManifest(name = "Woodcutting.retard", gameType = GameType.OS) public class F2PWoodcuting extends LoopScript { private long startTime; private int experienceGained, startExperience = 0; private final Timer experienceTimer = new Timer(5_000); private final Area BANK_AREA = new Area(new Tile(3165, 3486, 0), new Tile(3170, 3492, 0)); private final Area OAK_AREA = new Area(new Tile(3188, 3465, 0), new Tile(3197,3458,0)); @Override public boolean onStart(String... strings) { startTime = System.currentTimeMillis(); return true; } @Override protected int loop() { if ( !getAPIContext().inventory().contains("Bronze axe", "Iron axe", "Steel axe", "Black axe", "Mithril axe", "Adamant axe", "Rune axe", "Gilded axe", "Dragon axe", "3rd age axe", "Infernal axe", "Crystal axe") && !getAPIContext().equipment().contains("Bronze axe", "Iron axe", "Steel axe", "Black axe", "Mithril axe", "Adamant axe", "Rune axe", "Gilded axe", "Dragon axe", "3rd age axe", "Infernal axe", "Crystal axe")) { getAxe(); } if (getAPIContext().walking().getRunEnergy() > 30 && !getAPIContext().walking().isRunEnabled()){ getAPIContext().walking().setRun(true); } else { if (getAPIContext().inventory().isFull()) { bank(); } else { handleCalculations(); chop(); } } return 0; } public void getAxe() { if (!BANK_AREA.contains(getAPIContext().localPlayer().getLocation())) { getAPIContext().walking().walkTo(BANK_AREA.getCentralTile()); System.out.println("Walking to bank"); Time.sleep(1000); } else if (BANK_AREA.contains(getAPIContext().localPlayer().getLocation())) { if (!getAPIContext().bank().isOpen()) { System.out.println("Trying to open bank"); getAPIContext().bank().open(); Time.sleep(4000, () -> getAPIContext().bank().isOpen()); } if (getAPIContext().bank().isOpen()) { System.out.println("Bank is open"); getAPIContext().bank().withdraw(1,"Bronze axe", "Iron axe", "Steel axe", "Black axe", "Mithril axe", "Adamant axe", "Rune axe", "Gilded axe", "Dragon axe", "3rd age axe", "Infernal axe", "Crystal axe"); Time.sleep(4000, () -> APIContext.get().inventory().contains("Bronze axe", "Iron axe", "Steel axe", "Black axe", "Mithril axe", "Adamant axe", "Rune axe", "Gilded axe", "Dragon axe", "3rd age axe", "Infernal axe", "Crystal axe")); System.out.println("Closing bank"); if (getAPIContext().bank().isOpen()){ getAPIContext().bank().close(); Time.sleep(1000); } if (getAPIContext().inventory().contains("Adamant axe")){ getAPIContext().inventory().interactItem("Wield" ,"Adamant axe"); Time.sleep(2000); } else if(getAPIContext().inventory().contains("Mithril axe")) { getAPIContext().inventory().interactItem("Wield" ,"Mithril axe"); Time.sleep(2000); } else{ getAPIContext().inventory().interactItem("Wield" ,"Bronze axe"); Time.sleep(2000); } } } } public void bank() { if (!BANK_AREA.contains(getAPIContext().localPlayer().getLocation())) { getAPIContext().walking().walkTo(BANK_AREA.getCentralTile()); System.out.println("Walking to bank"); Time.sleep(1000); } else if (BANK_AREA.contains(getAPIContext().localPlayer().getLocation())) { if (!getAPIContext().bank().isOpen()) { System.out.println("Trying to open bank"); getAPIContext().bank().open(); Time.sleep(4000, () -> getAPIContext().bank().isOpen()); } if (getAPIContext().bank().isOpen()) { System.out.println("Bank is open"); getAPIContext().bank().depositAllExcept("Bronze axe", "Iron axe", "Steel axe", "Black axe", "Mithril axe", "Adamant axe", "Rune axe", "Gilded axe", "Dragon axe", "3rd age axe", "Infernal axe", "Crystal axe"); System.out.println("Closing bank"); getAPIContext().bank().close(); } } } public void chop() { if (!OAK_AREA.contains(getAPIContext().localPlayer().getLocation())) { System.out.println("Walking to oak area"); getAPIContext().walking().walkTo(OAK_AREA.getCentralTile()); Time.sleep(3000); } else if (!this.isChopping()) { SceneObject tree = getAPIContext().objects().query().nameContains(new String[]{"Oak"}).results().nearest(); if (tree != null && tree.interact()) { System.out.println("Chopping"); Time.sleep(4000, () -> getAPIContext().localPlayer().isAnimating()); } } } public boolean isChopping() { return getAPIContext().localPlayer().isAnimating() || getAPIContext().localPlayer().isMoving(); } // Credit to Pseudo for this function. private void handleCalculations() { if (startExperience == 0) { startExperience = getAPIContext().skills().get(Skill.Skills.WOODCUTTING).getExperience(); } else { if (!experienceTimer.isRunning()) { experienceGained = getAPIContext().skills().get(Skill.Skills.WOODCUTTING).getExperience() - startExperience; experienceTimer.reset(); } } } private int getExperienceGainedString() { return experienceGained; } @Override protected void onPaint(Graphics2D g, APIContext ctx) { PaintFrame pf = new PaintFrame(); pf.setTitle("Script by Michaud.retard"); pf.addLine("Runtime: ", Time.getFormattedRuntime(startTime)); pf.addLine("Experience Gain: ",getExperienceGainedString()); pf.addLine("Lv.",getAPIContext().skills().woodcutting().getCurrentLevel()); pf.draw(g, 4, 110, ctx); } } F2PWoodcuting.class
    1 point
  6. Considering you don't have a Zulrah released I figured I'd help. public class RotationListener implements Runnable { public RotationListener(final AliasZulrah ctx) { this.ctx = ctx; }
    1 point
×
×
  • Create New...