Jump to content
View in the app

A better way to browse. Learn more.

OSBot :: 2007 OSRS Botting

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Explv

Scripter II
  • Joined

  • Last visited

Everything posted by Explv

  1. See my updated post, there are more errors
  2. 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); }
  3. 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");
  4. Yes something like: RS2Widget bronzeWidget = getWidgets().getWidgetContainingText("Bronze"); if(bronzeWidget != null && bronzeWidget.isVisible()) bronzeWidget.interact("Smelt 10 Bronze");
  5. You will want to use widgets.
  6. 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
  7. Ok I get you now. The user selects the rock and you store it. Still... 18ms.... meh
  8. 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'
  9. 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.
  10. This takes long? Care to elaborate?
  11. 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));
  12. 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);
  13. 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"))
  14. Runescape is updated at least once a week, and therefore OSBot is updated at least once a week. So not possibru
  15. Whoa GJ buddy, you're really smurt. Here have a cookie Moron :xdoge:
  16. Please update to 4.1
  17. Why not use: myPlayer().isAnimating() ?
  18. Explv replied to Gecko0's topic in Resolved
    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.
  19. Explv replied to Gecko0's topic in Resolved
    10. Better usability, and most likely performance.
  20. I don't think getDialogues().isPendingContinuation() Works too well on Tutorial Island iirc. Use widgets
  21. Explv replied to ForcaNL's topic in Scripting Help
    rip will edit
  22. Explv replied to ForcaNL's topic in Scripting Help
    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));
  23. Explv replied to ForcaNL's topic in Scripting Help
    You do know you don't need to log out to world hop right?
  24. 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

Account

Navigation

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.