Everything posted by Explv
-
Script only banks
See my updated post, there are more errors
-
Script only banks
Fishing spot is an NPC. Also use the built in bank method: if(!getBank().isOpen()){ getBank().open(); new ConditionalSleep(5000) { @Override public boolean condition() throws InterruptedException { return getBank().isOpen(); } }.sleep(); } else if (!inventory.contains("Small fishing net")){ getBank().withdraw("Small fishing net", 1); } else { getBank().depositAllExcept("Small fishing net"); } Also in your getState() method, State.BANK will not return if you have a full inventory. You only bank when your inventory is empty. if (inventory.isEmpty() && !inventory.contains("Small fishing net")){ return State.BANK; } It should be: if (inventory.isFull() || !inventory.contains("Small fishing net")){ return State.BANK; } As a result of this, your WAIT state is redundant: private enum State { FISH, BANK } private State getState() { if (inventory.isFull() || !inventory.contains("Small fishing net")){ return State.BANK; } return State.FISH; } @Override public int onLoop() throws InterruptedException { switch (getState()) { case FISH: NPC spot = getNpcs().closest("Fishing spot"); if (spot != null) { spot.interact("Net"); new ConditionalSleep(5000) { @Override public boolean condition() throws InterruptedException { return myPlayer().isAnimating(); } }.sleep(); } break; case BANK: if(!getBank().isOpen()){ getBank().open(); new ConditionalSleep(5000) { @Override public boolean condition() throws InterruptedException { return getBank().isOpen(); } }.sleep(); } else if (!inventory.contains("Small fishing net")){ getBank().withdraw("Small fishing net", 1); } else { getBank().depositAllExcept("Small fishing net"); } break; } return random(200, 300); } To prevent spam clicking you may then want to wrap your onLoop code with a condition, where the script does nothing if the player is animating or moving: private enum State { FISH, BANK } private State getState() { if (inventory.isFull() || !inventory.contains("Small fishing net")){ return State.BANK; } return State.FISH; } @Override public int onLoop() throws InterruptedException { if(!myPlayer().isAnimating() && !myPlayer().isMoving()){ switch (getState()) { case FISH: NPC spot = getNpcs().closest("Fishing spot"); if (spot != null) { spot.interact("Net"); new ConditionalSleep(5000) { @Override public boolean condition() throws InterruptedException { return myPlayer().isAnimating(); } }.sleep(); } break; case BANK: if(!getBank().isOpen()){ getBank().open(); new ConditionalSleep(5000) { @Override public boolean condition() throws InterruptedException { return getBank().isOpen(); } }.sleep(); } else if (!inventory.contains("Small fishing net")){ getBank().withdraw("Small fishing net", 1); } else { getBank().depositAllExcept("Small fishing net"); } break; } } return random(200, 300); } You will also need to handle the case where the bank does not contain a fishing net. You may also want to include paths to and from the bank and fishing spot: Area fishingArea = new Area(0, 0, 0, 0); // Define this Area bankArea = new Area(0, 0, 0, 0); // Define this Position[] pathToBank = new Position[]{ }; // Define this Position[] pathToSpot = new Position[]{ }; // Define this private enum State { FISH, BANK, WALK_TO_BANK, WALK_TO_SPOT } private State getState() { if (inventory.isFull() || !inventory.contains("Small fishing net")){ if(bankArea.contains(myPosition())) return State.BANK; return State.WALK_TO_BANK; } if(!fishingArea.contains(myPosition())) return State.WALK_TO_SPOT; return State.FISH; } @Override public int onLoop() throws InterruptedException { if(!myPlayer().isAnimating() && !myPlayer().isMoving()){ switch (getState()) { case FISH: NPC spot = getNpcs().closest("Fishing spot"); if (spot != null) { spot.interact("Net"); new ConditionalSleep(5000) { @Override public boolean condition() throws InterruptedException { return myPlayer().isAnimating(); } }.sleep(); } break; case BANK: if(!getBank().isOpen()){ getBank().open(); new ConditionalSleep(5000) { @Override public boolean condition() throws InterruptedException { return getBank().isOpen(); } }.sleep(); } else if (!inventory.contains("Small fishing net")){ if(getBank().contains("Small fishing net")) getBank().withdraw("Small fishing net", 1); else stop(true); } else { getBank().depositAllExcept("Small fishing net"); } break; case WALK_TO_BANK: getLocalWalker().walkPath(pathToBank); break; case WALK_TO_SPOT: getLocalWalker().walkPath(pathToSpot); break; } } return random(200, 300); }
-
How To Smelt Bars
If you want to smelt a specific quantity you can do something like: // Select smelt X option for Bronze getWidgets().getWidgetContainingText("Bronze").interact("Smelt X Bronze"); // Sleep until the widget "Enter amount:" is visible (or for 5 seconds) new ConditionalSleep(5000) { @Override public boolean condition() throws InterruptedException { RS2Widget amountWidget = getWidgets().get(162, 32); return amountWidget != null && amountWidget.isVisible(); } }.sleep(); // Check that the widget is visible, if it is type the number 23 and enter RS2Widget amountWidget = getWidgets().get(162, 33); if(amountWidget != null && amountWidget.isVisible()) getKeyboard().typeString("23");
-
How To Smelt Bars
Yes something like: RS2Widget bronzeWidget = getWidgets().getWidgetContainingText("Bronze"); if(bronzeWidget != null && bronzeWidget.isVisible()) bronzeWidget.interact("Smelt 10 Bronze");
-
How To Smelt Bars
You will want to use widgets.
-
Mining rocks with ore [No IDs]
Its unnoticeable :P And it is less convenient for the user to manually select the rocks they want to mine. Either way... both viable solutions
-
Mining rocks with ore [No IDs]
Ok I get you now. The user selects the rock and you store it. Still... 18ms.... meh
-
Mining rocks with ore [No IDs]
Have you not considered the case of an AIO miner where the location is not fixed? It takes far longer to record the positions of every rock in the game than it does to record 1 colour per rock. Checking "every rock in your neighborhood" takes such a short amount of time that optimising it is pointless. If you are finding a rock based on its position, you are still checking "every rock in your neighborhood" to find the object at that position. The solution I posted is a global solution, it doesn't require recording rock positions, and it doesn't require recording IDs. Just sayin'
-
Mining rocks with ore [No IDs]
I don't really understand what you are saying... But if you think there is a better method that is as concise as this one, I would be interested to see it.
-
Mining rocks with ore [No IDs]
This takes long? Care to elaborate?
-
Mining rocks with ore [No IDs]
import org.osbot.rs07.api.model.Entity; public enum Rock { CLAY(new short[]{6705}), COPPER(new short[]{4645, 4510}), TIN(new short[]{53}), IRON(new short[]{2576}), SILVER(new short[]{74}), COAL(new short[]{10508}), GOLD(new short[]{8885}), MITHRIL(new short[]{-22239}), ADAMANTITE(new short[]{21662}), RUNITE(new short[]{-31437}); private short[] colours; Rock(final short[] colours) { this.colours = colours; } public boolean hasOre(final Entity rockEntity) { if (rockEntity.getDefinition() == null) { return false; } short[] colours = rockEntity.getDefinition().getModifiedModelColors(); if (colours == null) { return false; } for (short rockColour : this.colours) { for (short entityColour : colours) { if (rockColour == entityColour) { return true; } } } return false; } } Usage: RS2Object tinRock = getObjects().closest(obj -> Rock.TIN.hasOre(obj));
-
Why doesn't it click on continue?
That would be a whole lot simpler with configs. Using dialogs to determine progress seems like it could be very unreliable. Also does the log "Does this even work?" show up? You could always use the widget values e.g. getWidgets().get(int parent, int child);
-
Why doesn't it click on continue?
Try RS2Widget w = getWidgets().getWidgetContainingText("Click to continue"); if (w != null && w.isVisible()) { log("a"); w.interact(); } Just put it at the start of your onLoop. You don't really need to check if you have just retrieved a bar of bronze, you should just always check if continue needs clicking, and click it if it does. By the way a simpler way of determining if you have retrieved a bar of bronze would be to do: if(getInventory().contains("Bronze bar"))
-
Trinity Giants Suicide Test [GOAL: 100 hours] [ACHIEVED: 81Hours]
Runescape is updated at least once a week, and therefore OSBot is updated at least once a week. So not possibru
-
:Noah:
- Mod weath has bots running in osrs
Whoa GJ buddy, you're really smurt. Here have a cookie Moron :xdoge:- Explv's Tutorial Island [Free] [Random Characters]
Please update to 4.1- Don't understand why this doesn't work..
Why not use: myPlayer().isAnimating() ?- Win7 or Win10
Someone's a bit paranoid. Any company with any piece of software can easily be spying on you. At least it is made public that Microsoft is actively doing it for research purposes, and to fight piracy. I doubt Microsoft gives 2 fucks about "liverare" some kid using OSBot and masturbating a lot. :xdoge: If you're that scared about surveillance, turn your computer off, wrap yourself in some tin foil and hide behind your sofa.- Win7 or Win10
10. Better usability, and most likely performance.- Why doesn't it click on continue?
I don't think getDialogues().isPendingContinuation() Works too well on Tutorial Island iirc. Use widgets- World hopping
- World hopping
API method: getWorlds().hop(world); And if you're talking about hopping when another player is nearby, you could do something like: List<Player> players = getPlayers().filter(player -> player != myPlayer()); if(players != null && players.size() > 0) getWorlds().hop(random(1, 94));- World hopping
You do know you don't need to log out to world hop right?- Death animation click
Change if (target != null && target.exists() && target.interact("Attack")) To if (target != null && target.exists() && target.getHealth() > 0){ target.interact("Attack") You are interacting with the NPC in your if statement... which makes no sense - Mod weath has bots running in osrs