Jump to content

alex_unique_modifi

Members
  • Posts

    7
  • Joined

  • Last visited

  • Days Won

    1

Other groups

VIP Lifetime

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

alex_unique_modifi's Achievements

Bronze Member

Bronze Member (1/10)

  1. 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)); } }
  2. Start the script in varrock south east mine. it will mine the copper / iron ore automatically and drop the ores on the ground when inventory is full. does not drop gems/geodes. demo: glhf 🙂 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.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.webwalking.model.RSBank; 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 DELAY_BETWEEN_ORE_CLICKS = 900; private final Tile TILE_MINE_AREA = new Tile(3287,3364); // varrock east mine private final int[] COPPER_ROCKS = {11161,10943}; private final int[] IRON_ROCKS = {11364,11365}; // global variables private String status = "Starting"; private int[] currentRocks = {}; boolean settedOres = false; String currentOre = "Copper"; private int invtSpace = 28; @Override public boolean onStart(String... strings) { Time.sleep(20000); return true;//getAPIContext().client().isLoggedIn() ; } @Override protected int loop() { setOres(); if ( isInvtFull()) { dropOres(); }else{ doMine(); } 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); //System.out.println("Mining. Free invt="+(28-getAPIContext().inventory().getCount())); } Time.sleep(DELAY_BETWEEN_ORE_CLICKS); } //if (isInvtFull()) { // System.out.println("Full invt"); //} }; private void dropOres(){ status = "Dropping ores"; getAPIContext().inventory().dropAll(436,440); // copper and iron ores } private void setOres(){ if (settedOres) return; if (getAPIContext().skills().mining().getCurrentLevel()>14){ currentRocks = IRON_ROCKS; settedOres = true; currentOre ="Iron"; }else{ currentRocks = COPPER_ROCKS; } } // checks private boolean isInvtFull(){ invtSpace = 28-getAPIContext().inventory().getCount(); return invtSpace ==0; }; //todo worldHopIfCrowded //todo dismissRandomEvent @Override protected void onPaint(Graphics2D g, APIContext ctx) { PaintFrame frame = new PaintFrame("VarrockE mine"); frame.addLine("Status", status); frame.addLine("Free space", invtSpace); frame.draw(g, 0, 170, ctx); } }
  3. how did you create this zip file? i wan to learn how to export/ share scripts as well
  4. checks price of herbs in the GE. it works so far, more features to come! feel free to contribute by adding on more herbs/items credits to help from suko, cryptocode, yukki from discord import com.epicbot.api.shared.APIContext; import com.epicbot.api.shared.GameType; import com.epicbot.api.shared.methods.IGrandExchangeAPI; import com.epicbot.api.shared.model.ge.GrandExchangeItemDetail; import com.epicbot.api.shared.model.ge.GrandExchangeSlot; 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 java.awt.*; import java.util.LinkedHashMap; @ScriptManifest(name = "Test Script", gameType = GameType.OS) public class TestClass extends LoopScript { private final LinkedHashMap<String, Integer> items_to_check = new LinkedHashMap<String, Integer>() {{ put("Grimy guam leaf", 199); put("Guam leaf", 249); put("Grimy marrentill", 201); put("Marrentill", 251); put("Grimy tarromin", 203); put("Tarromin", 253); put("Grimy harralander", 205); put("Harralander", 255); }}; private LinkedHashMap<String, Integer> marketprices = new LinkedHashMap<String, Integer>(){}; @Override public boolean onStart(String... strings) { Time.sleep(3000); getMarketPricesFromOSRS(); return true; } @Override protected int loop() { System.out.println("======Market prices from OSRS======"); printOSRSPrices(); //for (String item: items_to_check.keySet()){ // priceCheck(item); //} return 1550; // delay for 1.55 seconds } @Override protected void onPaint(Graphics2D g, APIContext ctx) { PaintFrame frame = new PaintFrame("GE price checker (herbs)"); frame.addLine("Status", "Price checking in progress..."); frame.draw(g, 0, 170, ctx); } IGrandExchangeAPI ge(){ return getAPIContext().grandExchange(); } void getMarketPricesFromOSRS(){ for (String item: items_to_check.keySet()) { int id = items_to_check.get(item); GrandExchangeItemDetail itemDetail = ge().getItemDetails(id); int price = itemDetail.getCurrentPrice(); Time.sleep(200); marketprices.put(item,price); } } void printOSRSPrices(){ for (String item: marketprices.keySet()) { int price = marketprices.get(item); System.out.println(item+" "+price); } } private int priceCheck(String item){ // work in progress for actual buying and selling //todo withdraw coins from bank first if (!ge().isOpen()){ System.out.println("Opening GE"); ge().open(); } Time.sleep(1500); if (!ge().isOpen()){ System.out.println("Unable to open GE."); return -1; // cant open ge } GrandExchangeSlot emptySlot = null; for (GrandExchangeSlot slot : ge ().getSlots()){ if (!slot.inUse()){ emptySlot=slot; break; } } if (emptySlot==null){ System.out.println("No empty slots in GE."); return -2; // no empty slots in ge } emptySlot.placeBuyOffer(item,1,-1); Time.sleep(1500); return 1; } }
  5. lmao. desperate times calls for desperate measures
×
×
  • Create New...