Jump to content

Lol_marcus

Members
  • Posts

    186
  • Joined

  • Last visited

  • Feedback

    0%

Profile Information

  • Gender
    Male

Recent Profile Visitors

987 profile views

Lol_marcus's Achievements

Steel Poster

Steel Poster (4/10)

41

Reputation

  1. 99 RCing, 73 agility, 70+ mining and crafting. All other stats negligable. What would this sell for?
  2. If it's not too much trouble, could I take a look at your lambda for filtering the text displayed inside the chatbox dialogue, and/or lambda for getting the npc to handle dialogue? The conditional sleep I have implemented.
  3. Found the error. It's sorted now.
  4. Hi guys, I've tried doing this without states and enums, and then thought that maybe it would be easier doing it with them. I'm trying to make an incremental alcher, basically what it does is it buys an X amount of a certain item, alches it, and then buys an X amount of another item. The reason is that I don't want to (nor can I afford on multiple accounts) to buy the limit of a lot of alches at one time, like rune items, etc. So the script should: if 0 alches for item 1 buy item 1 alch item 1 if X alches for item 1 is done buy item 2 alch item 2 if X alches for item 1 & 2 done buy item 3 alch item 3 Any guidance would be fantastic. Here's what I have, but I can't for the life of me get it to work: package core; import org.osbot.rs07.api.GrandExchange; import org.osbot.rs07.api.Magic; import org.osbot.rs07.api.model.NPC; import org.osbot.rs07.api.model.Player; import org.osbot.rs07.api.model.RS2Object; import org.osbot.rs07.api.ui.MagicSpell; import org.osbot.rs07.api.ui.Spells; import org.osbot.rs07.input.mouse.RectangleDestination; import org.osbot.rs07.script.Script; import org.osbot.rs07.script.ScriptManifest; import org.osbot.rs07.utility.Condition; import org.osbot.rs07.utility.ConditionalSleep; import java.awt.*; @ScriptManifest(name = "Incremental Alcher", version = 1, author = "Marcus", logo = "", info = "Buys items in increments to high alch.") public class Main extends Script { private long startTime = System.currentTimeMillis(); int rune2h; int runepl8; int runelegs; @Override public void onStart() throws InterruptedException { rune2h = 0; runepl8 = 0; runelegs = 0; } private enum State { BUY_R2H, ALCH_R2H, BUY_RPL8, ALCH_RPL8, EXIT } private State getState() { if (rune2h == 0 && !getInventory().contains("Rune 2h Sword")) return State.BUY_R2H; if (rune2h == 0 && getInventory().contains("Rune 2h Sword")) return State.ALCH_R2H; if (rune2h == 2 && runepl8 == 0 && !getInventory().contains("Rune platebody")) return State.BUY_RPL8; if (rune2h == 2 && runepl8 == 0 && getInventory().contains("Rune platebody")) return State.ALCH_RPL8; return State.EXIT; } @Override public int onLoop() throws InterruptedException { switch (getState()) { case BUY_R2H: buyRune2h(); break; case ALCH_R2H: alchR2h(); break; case BUY_RPL8: buyRunepl8(); break; case ALCH_RPL8: alchRpl8(); break; case EXIT: stop(false); break; } return 700; } public void buyRune2h() throws InterruptedException { NPC clerk = getNpcs().closest("Grand Exchange clerk"); if (clerk != null && clerk.isVisible()) { clerk.interact("Exchange"); Sleep.sleepUntil(() -> grandExchange.isOpen(), 5000); grandExchange.buyItem(1319, "Rune 2h", 38000, 2); Sleep.sleepUntil( () -> (grandExchange.getStatus(GrandExchange.Box.BOX_1) == GrandExchange.Status.FINISHED_BUY), 5000); grandExchange.collect(false); Sleep.sleepUntil(() -> (grandExchange.getStatus(GrandExchange.Box.BOX_1) == GrandExchange.Status.EMPTY), 5000); } } public void alchR2h() throws InterruptedException { while (getInventory().contains("Rune 2h Sword")) { if (!getPlayers().myPlayer().isAnimating()) { magic.castSpell(Spells.NormalSpells.HIGH_LEVEL_ALCHEMY); Sleep.sleepUntil(() -> magic.isSpellSelected(), 5000); getInventory().interact("cast", "Rune 2h Sword"); rune2h =+ 1; } } } public void buyRunepl8() throws InterruptedException { NPC clerk = getNpcs().closest("Grand Exchange clerk"); if (clerk != null && clerk.isVisible()) { clerk.interact("Exchange"); Sleep.sleepUntil(() -> grandExchange.isOpen(), 5000); grandExchange.buyItem(1127, "Rune plate", 38500, 2); Sleep.sleepUntil( () -> (grandExchange.getStatus(GrandExchange.Box.BOX_1) == GrandExchange.Status.FINISHED_BUY), 5000); grandExchange.collect(false); Sleep.sleepUntil(() -> (grandExchange.getStatus(GrandExchange.Box.BOX_1) == GrandExchange.Status.EMPTY), 5000); } } public void alchRpl8() throws InterruptedException { if (getInventory().contains("Rune platebody")) { if (!getPlayers().myPlayer().isAnimating()) { magic.castSpell(Spells.NormalSpells.HIGH_LEVEL_ALCHEMY); Sleep.sleepUntil(() -> magic.isSpellSelected(), 5000); getInventory().interact("cast", "Rune platebody"); runepl8 =+ 1; } } } @Override public void onPaint(Graphics2D g) { g.setColor(new Color(0, 0, 0, 155)); g.fillRect(5, 258, 200, 80); g.setColor(new Color(255, 255, 255)); g.drawRect(5, 258, 200, 80); super.onPaint(g); g.drawString("Essence Runner", 65, 275); g.drawString("Run time: " + String.valueOf(formatTime(System.currentTimeMillis() - startTime)), 15, 295); g.drawString("Rune 2h Alches: " + rune2h, 15, 305); g.drawString("Rune Platebody Alches: " + runepl8, 15, 320); } private 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); } }
  5. Did both and it seems to have stabilized. Thanks for that.
  6. As soon as it collects the chaos rune, it starts lagging and giving null point exception errors. I have NO idea why. Can anyone shed some light please? @Override public int onLoop() throws InterruptedException { GroundItem cRune = getGroundItems().closest("Chaos rune"); if (cRune.isVisible() && cRune != null) { cRune.interact("Take"); Sleep.sleepUntil(() -> !cRune.isVisible(), 1000); } else { getWorlds().hopToF2PWorld(); sleep(random(500, 1500)); } return 700; }
  7. That's awesome. Thanks for the snippet.
  8. Is it crashing at a specific time, or does it just randomly crash?
  9. Here you go. [SPOILER] package core; import java.awt.Graphics2D; import org.osbot.rs07.api.map.Area; 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.script.Script; import org.osbot.rs07.script.ScriptManifest; import org.osbot.rs07.utility.ConditionalSleep; @ScriptManifest(name = "Jug Filler", version = 1.1, author = "Marcus", logo = "", info = "Fills jugs in falador") public class Main extends Script { private final Area waterPump = new Area(2949, 3382, 2950, 3383); private long startTime = System.currentTimeMillis(); @Override public void onStart() throws InterruptedException { } @Override public int onLoop() throws InterruptedException { if (hasJugs()) { walkPump(); if (hasPump()) { fillJugs(); } } else { if (!hasJugs()) ; { bank(); } } return 700; } public boolean hasJugs() { return (getInventory().contains("Jug") && (getInventory().isFull())); } public boolean hasPump() { RS2Object pump = getObjects().closest("Waterpump"); return (pump != null && pump.isVisible()); } private void bank() throws InterruptedException { if (!Banks.FALADOR_WEST.contains(myPosition())) { getWalking().webWalk(Banks.FALADOR_WEST); } else if (Banks.FALADOR_WEST != null && (!getBank().isOpen())) { getBank().open(); } else if (!getInventory().isEmptyExcept("Jug")) { getBank().depositAllExcept("Jug"); } else if (getBank().contains("Jug")) { getBank().withdrawAll("Jug"); sleep(random(50, 150)); getBank().close(); sleep(random(50, 150)); new ConditionalSleep(2000, 600) { @Override public boolean condition() { return ((!getBank().isOpen()) && (inventory.getAmount("Jug") == 28)); } }.sleep(); } else { stop(false); } } public void fillJugs() throws InterruptedException { RS2Object waterPump = getObjects().closest("Waterpump"); if ((!myPlayer().isAnimating()) && waterPump != null) { if (!getInventory().isItemSelected()) { getInventory().getItem("Jug").interact("Use"); sleep(random(100, 250)); waterPump.interact("Use"); sleep(random(100, 200)); getMouse().moveOutsideScreen(); sleep(random(1000, 1500)); } new ConditionalSleep(20000, 600) { @Override public boolean condition() { return ((!myPlayer().isAnimating()) && (waterPump != null)); } }.sleep(); } } private void walkPump() throws InterruptedException { if (getInventory().isFull() && getInventory().contains("Jug")) { getWalking().walk(waterPump); sleep(random(50, 105)); new ConditionalSleep(20000, 600) { @Override public boolean condition() { return (waterPump.contains(myPosition())); } }.sleep(); } else { stop(false); } } @Override public void onPaint(Graphics2D g) { super.onPaint(g); g.drawString("Jug Filler", 65, 255); g.drawString("Run time: " + String.valueOf(formatTime(System.currentTimeMillis() - startTime)), 15, 275); } private 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); } } [/SPOILER]
  10. Instructions unclear - bot is killing zulrah with addy halberd.
  11. Does worlds.hoptop2pworld not work in mirror mode? I ran it in injection and it was fine, but on mirror it just opens the tab and then stops.
  12. Ahh right, I see what I was doing wrong. Thanks guys.
  13. An account of mine had a quashed ban from 2 years ago, and got perm banned for running a money making script. It was members too.
×
×
  • Create New...