LeetyPoo Posted October 11, 2023 Share Posted October 11, 2023 Hello everyone. I am releasing all of the custom scripts that I've made. They are probably not super great but they worked for me just messing around. Might be able to find some useful stuff I suppose. I am a java game developer and just took these on for fun. I don't really play anymore though so I thought I'd release it all for everyone else to hopefully get some use out of. If you want a custom script feel free to message me. I don't mind helping out where I can. This is just a basic script for mining coal. import com.epicbot.api.shared.APIContext; import com.epicbot.api.shared.GameType; import com.epicbot.api.shared.entity.GameEntity; import com.epicbot.api.shared.entity.GroundItem; import com.epicbot.api.shared.entity.NPC; import com.epicbot.api.shared.entity.WidgetChild; import com.epicbot.api.shared.methods.IInventoryAPI; import com.epicbot.api.shared.model.Skill; 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.Random; import com.epicbot.api.shared.util.paint.frame.PaintFrame; import com.epicbot.api.shared.methods.*; import com.epicbot.api.shared.util.time.Time; import com.epicbot.api.shared.util.time.Timer; import java.awt.*; @ScriptManifest(name = "ELeetCoalMiner", gameType = GameType.OS) public class ELeetCoalMiner extends LoopScript { @Override public boolean onStart(String... strings) { return true; } private final Timer runTimer = new Timer(0); private int oresDropped = 0; private String status = "Starting"; private boolean scriptBanksOres = true; private int oreIndex = 0; private int profitGenerated = 0; private double experienceGained, startExperience = 0; private Skill.Skills trainedSkill = Skill.Skills.MINING; private double xpPerMine = 50.0; private int oresInBank = 0; private Tile mineArea = new Tile(3040,9740); private Tile bankArea = new Tile(3013,3355); private Tile intermediateArea = new Tile(3171,3408); private String[] oreType = {"Coal"}; private String[] rockType = {"Coal rocks"}; public IInventoryAPI inventory() { return getAPIContext().inventory(); } public IMouseAPI mouse() { return getAPIContext().mouse(); } public ILocalPlayerAPI player() { return getAPIContext().localPlayer(); } public IGroundItemsAPI groundItems() { return getAPIContext().groundItems(); } public IObjectsAPI objects() { return getAPIContext().objects(); } public IBankAPI bank() { return getAPIContext().bank(); } public IWidgetsAPI widgets() { return getAPIContext().widgets(); } public IWalkingAPI walking() { return getAPIContext().walking(); } public IWebWalkingAPI webWalking() { return getAPIContext().webWalking(); } public ICameraAPI camera() { return getAPIContext().camera(); } public ISkillsAPI skills() { return getAPIContext().skills(); } @Override protected int loop() { if(!player().isAnimating()) { handleCalculations(); /*handleRandomEvent();*/ if (inventory().isFull()) { if (!scriptBanksOres) { dropOres(); dropGems(); } else { /*if(player().getY() < 3406) { walkToIntermediate(); }*/ walkToBank(); /*setCameraForBanking();*/ bankOres(); rotateCamera(); } } /* while(groundContainsOres() && !inventory().isFull()) { pickupOres(); }*/ if(!inventory().contains(oreType)) { walkToMineArea(); } clickOre(); moveMouseRandomly(); rotateCamera(); Time.sleep(getSleepTime()); } return 3; } private void handleCalculations() { if (startExperience == 0) { startExperience = skills().get(trainedSkill).getExperience(); } else { experienceGained = skills().get(trainedSkill).getExperience() - startExperience; } } public static int getSleepTime() { int sleepMin = 1500; int sleepMax = 3000; return Random.nextInt(sleepMin, sleepMax); } public static int getShortSleepTime() { int sleepMin = 750; int sleepMax = 1683; return Random.nextInt(sleepMin, sleepMax); } public static int getAmountToTurnCamera() { return Random.nextInt(-100, 100); } public void dropOres() { status = "Dropping Ores"; for(int i = 0; i < oreType.length; i++) { int amount = inventory().getCount(oreType); oresDropped += amount; inventory().dropAll(oreType); } } public void pickupOres() { status = "Picking up ores"; rotateCamera(); for(int i = 0; i < oreType.length; i++) { GroundItem arrow = groundItems().query().named(oreType[i]).distance(2.0).reachable().results().nearest(); if(arrow != null) { arrow.interact("Take"); } } GroundItem uncut = groundItems().query().nameContains("Uncut").distance(2.0).reachable().results().nearest(); if(uncut != null) { uncut.interact("Take"); } } public void dropGems() { status = "Dropping Ores"; inventory().dropAll("Uncut sapphire"); inventory().dropAll("Uncut ruby"); inventory().dropAll("Uncut emerald"); inventory().dropAll("Uncut opal"); inventory().dropAll("Uncut jade"); inventory().dropAll("Uncut diamond"); } public void clickOre() { status = "Mining Ores"; if(player().isInCombat()) { return; } GameEntity coal = objects().query().named(rockType).distance(10.0).results().nearest(); if(coal != null) { coal.interact("Mine"); rotateCamera(); Time.sleep(getShortSleepTime()); } } public boolean groundContainsOres() { for(int i = 0; i < rockType.length; i++) { GroundItem ore = groundItems().query().named(oreType[i]).distance(2.0).results().nearest(); if(ore != null) { return true; } } return false; } public void walkToIntermediate() { status = "Walking to intermediary location"; webWalking().walkTo(getIntermediateTile()); if(!walking().isRunEnabled() && walking().getRunEnergy() > 50) { walking().setRun(true); } } public void walkToBank() { status = "Walking to bank"; webWalking().walkTo(getBankTile()); if(!walking().isRunEnabled() && walking().getRunEnergy() > 50) { walking().setRun(true); } Time.sleep(getShortSleepTime()); } public Tile getIntermediateTile() { int x = intermediateArea.getX(); int y = intermediateArea.getY(); int randomness = 2; int randomX = Random.nextInt(x - randomness, x + randomness); int randomY = Random.nextInt(y - randomness, y + randomness); return new Tile(randomX, randomY); } public Tile getBankTile() { int x = bankArea.getX(); int y = bankArea.getY(); int randomness = 0; int randomX = Random.nextInt(x - randomness, x + randomness); int randomY = Random.nextInt(y - randomness, y + randomness); return new Tile(x, y); } public Tile getMineTile() { int x = mineArea.getX(); int y = mineArea.getY(); int randomness = 0; int randomX = Random.nextInt(x - randomness, x + randomness); int randomY = Random.nextInt(y - randomness, y + randomness); return new Tile(x, y); } public void rotateCamera() { if(Random.nextInt(1, 5) != 1) { return; } Time.sleep(getShortSleepTime()); int currentYaw = camera().getYaw(); camera().setYaw(currentYaw + getAmountToTurnCamera()); } public void bankOres() { status = "Banking Ores"; int amount = 0; for(int i = 0; i < oreType.length; i++) { amount = inventory().getCount(oreType[i]); } GameEntity bank = objects().query().named("Bank booth").distance(5.0).results().nearest(); bank.interact("Bank"); while(!bank().isOpen()) { Time.sleep(); } clickBankAll(); oresDropped += amount; profitGenerated = oresDropped * 100; for(int i = 0; i < oreType.length; i++) { oresInBank = bank().getCount(oreType[i]); } } public void clickBankAll() { status = "Clicking Bank all"; bank().open(); Time.sleep(getShortSleepTime()); WidgetChild bankAllButton = widgets().get(12).getChild(42); mouse().click(bankAllButton); } public void walkToMineArea() { status = "Walking to Mine Area"; webWalking().walkTo(getMineTile()); if(!walking().isRunEnabled() && walking().getRunEnergy() > 50) { walking().setRun(true); } Time.sleep(getShortSleepTime()); } public void moveMouseRandomly() { if(Random.nextInt(1, 10) > 2) { mouse().moveRandomly(); } } private String rsFormat(Integer number) { String[] suffix = new String[]{"K", "M", "B", "T"}; int size = (number != 0) ? (int) Math.log10(number) : 0; if (size >= 3) { while (size % 3 != 0) { size = size - 1; } } return (size >= 3) ? +(Math.round((number / Math.pow(10, size)) * 10) / 10d) + suffix[(size / 3) - 1] : +number + ""; } private int getHourlyRate(int i) { return (int) (i / (runTimer.getElapsed() / 3600000.0D)); } @Override protected void onPaint(Graphics2D g, APIContext ctx) { PaintFrame frame = new PaintFrame("ELeetCoalMiner"); frame.addLine("[Time running]:", runTimer.toElapsedString()); frame.addLine("[Status]:", status); frame.addLine("[Ore Focus]:", oreType[oreIndex]); frame.addLine("", ""); frame.addLine("[Xp Gained]:", experienceGained); frame.addLine("[Xp Per Hour]:", rsFormat(getHourlyRate((int)experienceGained))); frame.addLine("",""); frame.addLine("[Ores Mined]:", (int)(experienceGained / xpPerMine)); frame.addLine("[Ores Per Hour]:", rsFormat(getHourlyRate((int)(experienceGained / xpPerMine)))); frame.addLine("",""); frame.addLine("[Ores In Bank]:", oresInBank); frame.addLine("[Profit Generated]:", profitGenerated); frame.addLine("[Total Ore Evaluation]:", (oresInBank * 175) + "gp"); frame.draw(g, 0, 155, ctx); } } Quote Link to comment Share on other sites More sharing options...
jerbl0re Posted November 27, 2023 Share Posted November 27, 2023 not sure if im doing something wrong. but all it does is "walking to mine area" and then "mining ores", and the bot just says "navigating to" and then "generated path" and then "no valid path found" Quote Link to comment Share on other sites More sharing options...
jerbl0re Posted November 27, 2023 Share Posted November 27, 2023 i think i found the problem. is the area where to mine a p2p? Quote Link to comment Share on other sites More sharing options...
3oro Posted September 16, 2024 Share Posted September 16, 2024 (edited) You can fix this manually by changing the script cords at the top or this section.. or even change to another type of ore to mine 😉 private Tile mineArea = new Tile(3040,9740); private Tile bankArea = new Tile(3013,3355); private Tile intermediateArea = new Tile(3171,3408); private String[] oreType = {"Coal"}; private String[] rockType = {"Coal rocks"}; change them to a F2P area of the mine or I assume it’s the falador mine? If not then figure where the F2P area to mine is and save the new updated tiles into a new script or updated and re run until it works! Edited September 16, 2024 by 3oro Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.