Jump to content

Explv

Scripter II
  • Posts

    2314
  • Joined

  • Last visited

  • Days Won

    6
  • Feedback

    100%

Everything posted by Explv

  1. That doesn't change the actual time .interact() takes to complete. OP wants to know if there is a way to make the interact() method faster, which there is not. OP would have to write his own interact() method.
  2. Another alternative is to use: https://storage.googleapis.com/osbuddy-exchange/summary.json Or the version hosted on rsbuddy's site https://rsbuddy.com/exchange/summary.json (may have the same issue of going down, not sure) You can download the file to the user's data directory, and then read it using a json library. RSB_Fox gave this link on reddit a few months ago:
  3. There's also the osrs wiki prices, although I'm really not sure where they get them from. http://oldschoolrunescape.wikia.com/wiki/Exchange:Raw_lobster
  4. Like H0rn posted, you can use the official rs API. I would probably recommend writing some code to use the rsbuddy API, and when a price fetch fails, fallback to the official osrs API. I would also recommend using a JSON library like JSON simple, it's just easier to maintain. I think I have some code in one of my scripts to do the above, will post later when I can
  5. "will be available when SDN is next updated" The SDN only gets updated every day or two. I will post again when the changes have been released.
  6. Could you please provide a screenshot?
  7. Please understand that I make no money off this script, and I have many other IRL obligations. It may take a little time for me to get around to fixing things, but I usually do. Being rude really isn't appreciated, nor is it necessary. Hope you enjoy the script
  8. Pushed fix, will be available when SDN is next updated.
  9. Use IntelliJ IDEA, it's way better than Eclipse imo.
  10. You could override the break manager, start a break when the boss exists, and finish the break after 10 minutes. Example break manager: import org.osbot.rs07.api.Client; import org.osbot.rs07.script.RandomEvent; import org.osbot.rs07.script.RandomSolver; import org.osbot.rs07.script.ScriptManifest; @ScriptManifest(author = "Explv", name = "Break Manager", info = "", version = 0.1, logo = "") public class CustomBreakManager extends RandomSolver { private long breakDuration = -1; private long breakStartTime = -1; private boolean shouldLogout; public CustomBreakManager() { super(RandomEvent.BREAK_MANAGER); } public void startBreaking(final long breakDuration, final boolean shouldLogout) { this.breakDuration = breakDuration; this.breakStartTime = System.currentTimeMillis(); this.shouldLogout = shouldLogout; } public long getBreakStartTime() { return breakStartTime; } @Override public boolean shouldActivate() { return breakDuration > 0 && !finishedBreaking(); } public boolean finishedBreaking() { return System.currentTimeMillis() - breakStartTime >= breakDuration; } @Override public int onLoop() throws InterruptedException { if (shouldLogout && getClient().getLoginState() == Client.LoginState.LOGGED_IN) { if (getWidgets().closeOpenInterface() && getLogoutTab().logOut()) { return 1000; } } if (getMouse().isOnScreen()) { getMouse().moveOutsideScreen(); } return 3000; } } Overriding (should be only done once, in onStart): CustomBreakManager customBreakManager = new CustomBreakManager(); customBreakManager.exchangeContext(getBot()); getBot().getRandomExecutor().overrideOSBotRandom(customBreakManager); Starting a break: if (getNpcs().closest("Boss name") != null) { customBreakManager.startBreaking(TimeUnit.MINUTES.toMillis(10), true); }
  11. Good luck in your new job @Alek 10/10 member of staff / developer, you will be missed
  12. @CrackplanetsCrac Firstly you _can_ use external libraries on the SDN, you will just need to include the source of those libraries in your repository. As for local scripts, have you tried extracting the dependency to your output .jar? Example: Here you can see the library you want to add in the Available Elements section on the right hand side Right click the library and select extract into output root Now the extracted library will be output to your .jar And it should work when running your script
  13. GroundItem item = getGroundItems().closest(n -> (n != null && n.exists() && lootItems.contains(n.getName()))); Means, find the closest ground item that isn't null, and exists, and has a name that is in my list of loot names. What happens if no item is found that matches those parameters? It will return null. So "item" will be null. So you need to check item != null before interacting
  14. Maybe you want to check that item != null before interacting with it? NullPointerException is quite clear, the object is null, and you're trying to do something with it. Also declare the List of loot items as a class variable, rather than re-creating the list every time killDruid is called.
  15. You can get a ban using any script, regardless of number of users
  16. Cool idea Will client side be open source (well, not obfuscated)? Would probably make sense
  17. 1. Open up "Run" by pressing windows key + r (or by searching in the start menu) 2. Type %appdata%\Microsoft\Windows\Start Menu\Programs It will open file explorer in the Start Menu Programs dir 3. In this directory, right click and select New -> Shortcut. Then point the shortcut to your OSBot.jar 4. The OSBot.jar will now show up in the applications list in the start menu (under the O category of course) 5. Scroll to the OSBot.jar in the start menu, right click and select Pin to Start
  18. 1. Maybe just stop walking when the bank booth is nearby and then call getBank().open(); It will walk there & probably move the camera at the same time: if (getObjects().closest("Bank booth or whatever its called") == null) { WebWalkEvent webWalkEvent = new WebWalkEvent(Banks.VARROCK_WEST); webWalkEvent.setBreakCondition(new Condition() { @Override public boolean evaluate() { return getObjects().closest("Bank booth or whatever its called") != null; } }); execute(webWalkEvent); } else { getBank().open(); } 2. Create a file in the data directory getDirectoryData() with the Player's name myPlayer().getName(), and then write to it. 100s of tutorials online on how to write files with Java.
  19. Explv

    Explv's Walker

    Script is working fine
  20. import org.osbot.rs07.api.ui.RS2Widget; import org.osbot.rs07.api.util.CachedWidget; import org.osbot.rs07.script.MethodProvider; import org.osbot.rs07.utility.ConditionalSleep; public class BankQuantity extends MethodProvider { private static final int CONFIG_ID = 1666; private static final int BANK_WIDGET_ROOT_ID = 12; private CachedWidget quantityLabelWidget; /* 1666: 0 -> ONE 1666: 4 -> FIVE 1666: 8 -> TEN 1666: 12 -> X 1666: 16 -> ALL */ public Quantity getQuantity() { return Quantity.values()[getConfigs().get(CONFIG_ID) / 4]; } public boolean setQuantity(final Quantity quantity) { if (quantity == getQuantity()) { return true; } if (!getWidgets().isVisible(BANK_WIDGET_ROOT_ID)) { return false; } if (quantityLabelWidget == null || !quantityLabelWidget.initialized()) { quantityLabelWidget = new CachedWidget(this, w -> w != null && w.getMessage().equals("Quantity:"), BANK_WIDGET_ROOT_ID); quantityLabelWidget.cache(); } if (quantityLabelWidget.initialized()) { int rootID = quantityLabelWidget.getRootId(); int secondLevelID = quantityLabelWidget.getSecondLevelId(); if (quantity == Quantity.ONE) { secondLevelID += 1; } else { secondLevelID += (quantity.ordinal() + 1) * 2; } RS2Widget quantityWidget = getWidgets().get(rootID, secondLevelID); if (quantityWidget != null && quantityWidget.interact()) { new ConditionalSleep(1800, 600) { @Override public boolean condition() throws InterruptedException { return getQuantity() == quantity; } }.sleep(); return true; } } return false; } enum Quantity { ONE, FIVE, TEN, X, ALL } } Usage: import org.osbot.rs07.script.Script; import org.osbot.rs07.script.ScriptManifest; @ScriptManifest(author = "Explv", name = "Example", version = 0.1, logo = "", info = "") public class Example extends Script { private BankQuantity bankQuantity = new BankQuantity(); @Override public void onStart() { bankQuantity.exchangeContext(getBot()); } @Override public int onLoop() throws InterruptedException { if (!getBank().isOpen()) { getBank().open(); } else if (bankQuantity.getQuantity() != BankQuantity.Quantity.ALL) { bankQuantity.setQuantity(BankQuantity.Quantity.ALL); } else { getBank().withdrawAll("Yew logs"); } return 600; } } @Alek add to API?
  21. Yeah you right, thanks for the correction, I should have written new String() instead. Will updaterino
  22. Allow data collection is an OSBot CLI flag that does what it indicates. It allows OSBot to collect statistics from your session. And if I recall correctly, you can just select all of the configurations (e.g using Ctrl-A) and then press Start
×
×
  • Create New...