Jump to content

Explv

Scripter II
  • Posts

    2314
  • Joined

  • Last visited

  • Days Won

    6
  • Feedback

    100%

Everything posted by Explv

  1. Well that is where your error is then.. Not the GUI. Pls learn how 2 debug pls pls
  2. Probably something else in your code. You should really learn what a NullPointerException is though...
  3. Perhaps you should explain the issue you are having. "webWalk, black line Do not know why" doesn't make much sense. Also, please use the code formatter when submitting code. It is the button that looks like < >
  4. If you want to add sleeps then you can do something like: private void dropAll(final String name) throws InterruptedException { for(final Item item : getInventory().getItems()){ if(item.getName().equals(name) && item.interact("drop")){ sleep(random(200, 300)); } } } But I am pretty sure that getInventory().dropAll(itemName) already does sleep a random amount from 25ms to 75ms in between drops.
  5. 1. You should use .equals() when comparing Strings. == Compares references not the values. 2. You should just use: getInventory().dropAll(itemName); 3. The animating check should not be in that method / doesn't really have any use for determining when you should drop items lol
  6. Well your code doesn't make much sense... Why would you call dropAll, a function which DROPS ALL on every single Log in your inventory? It should just be: if (sI.getInventory().isFull()) { sI.getInventory().dropAll("Logs"); }
  7. Why don't you just do: if(npc.getPosition().distance(myPosition()) <= 3) // if npc is less than or equal to 3 tiles away
  8. Hmm, it's not a bad idea, I will think about implementing it. If I do, I will still keep the current tasks, but add this as a new 'custom task' type.
  9. What other stopping conditions / goals would you want?
  10. Easiest way imo is just to do a long sleep, and check if you still have gold bars / have leveled up: if(getKeyboard().typeString("27")){ new ConditionalSleep(100_000){ @Override public boolean condition() throws InterruptedException { return !getInventory().contains("Gold bar") || getDialouges().isPendingContinuation(); } }.sleep(); }
  11. Step 1) Go to settings -> options -> debug -> tick Widgets Step 2) Hover your mouse over the part of the screen you want to be able to interact with using widgets In this case, the mouse is hovering over the skills tab. You can see three rectangles. Green, red and white. For each of these rectangles, the corresponding widget ids can be seen on the left. The top most id is the parent id, below that is the child id. For some widgets there may be three ids, the third is just a child of the second id. In this case we want to get the widget for the green rectangle, so in code this would be: RS2Widget skillTab = getWidgets().get(548, 53); When accessing widgets, if a widget is not on screen it will be null, so always make sure to null check your widgets. You can now interact with this widget for example: private void openSkillTab(){ RS2Widget skillTab = getWidgets().get(548, 53); if(skillTab != null) skillTab.interact(); } If you are ever trying to interact with a widget that has text in it, just find the widget using the text, this is a more reliable solution, for example: RS2Widget troutWidget = getWidgets().getWidgetContainingText("Raw trout");
  12. Note: the text must be exact (case as well). It is "Cook All" not "Cook all" It is also better practice to find widgets using text when you can: RS2Widget troutWidget = getWidgets().getWidgetContainingText("Raw trout"); if(troutWidget != null) troutWidget.interact("Cook All");
  13. If you are simply walking to a location you can just do: getWalking().webWalk(position); Also, the creation of INodeRouteFinder is expensive, and should only be done once in a script, not every time you walk!! Create the route finder at the start of your script and store it. In the future when posting code to the Scripting Help section, please use the code tags, so that your code is properly formatted and coloured:
  14. Alternatively you could just extend the ConditionalSleep class: import org.osbot.rs07.utility.ConditionalSleep; import java.util.function.BooleanSupplier; public final class FConditionalSleep extends ConditionalSleep { private final BooleanSupplier condition; public FConditionalSleep(final BooleanSupplier condition, int timeout) { super(timeout); this.condition = condition; } @Override public boolean condition() throws InterruptedException { return condition.getAsBoolean(); } } new FConditionalSleep(() -> myPlayer().isAnimating(), 5000).sleep();
  15. Explv

    Explv's Walker

    Thanks :P Good to hear ;)
  16. If it really doesn't work then you could always try: getMouse().continualClick(...) // click and hold with release condition getMouse().move(...) // move to destination
  17. To stop people manipulating the mouse speed
  18. Make sure you are using the very latest version of Eclipse, the older ones do not support Java 8.
  19. Pug's tutorial is cancer http://osbot.org/forum/topic/87697-explvs-dank-paint-tutorial/
  20. No, I don't think so Why would you need to do that anyway?
  21. private boolean playerIsInClanChat(String username){ username = username.replace('\u00A0', ' '); for(RS2Widget widget : S.getWidgets().getWidgets(589, 5)){ if(widget.getMessage().contains(username)) return true; } return false; }
×
×
  • Create New...