Jump to content

Explv

Scripter II
  • Posts

    2314
  • Joined

  • Last visited

  • Days Won

    6
  • Feedback

    100%

Everything posted by Explv

  1. Use your own world hopper or Frostbug's. Or stop hopping so much
  2. No, this feature was removed. If you need to move the mouse instantly then you can use: final void moveMouseInstantly(final MouseDestination mouseDestination) { Rectangle boundingBox = mouseDestination.getBoundingBox(); moveMouseInstantly(random((int) boundingBox.getMinX(), (int) boundingBox.getMaxX()), random((int) boundingBox.getMinY(), (int) boundingBox.getMaxY())); } final void moveMouseInstantly(final int x, final int y) { getBot().getMouseEventHandler().generateBotMouseEvent(MouseEvent.MOUSE_MOVED, System.currentTimeMillis(), 0, x, y, 0, false, MouseEvent.NOBUTTON, true); } And I'm sure if you spent some time making your own MouseEvent then you could have it at whatever speed you want. However, the setMouseSpeed feature was removed for a reason.
  3. Using the OSBot API: final boolean itemIsInArea(final Area area, final String itemName) { return getGroundItems().filter(new AreaFilter<>(area), new NameFilter<>(itemName)).size() > 0; } Using the Java 8 Stream API : final boolean itemIsInArea(final Area area, final String itemName) { return getGroundItems().getAll().stream().anyMatch(groundItem -> groundItem.getName().equals(itemName) && area.contains(groundItem)); } Using a for loop: final boolean itemIsInArea(final Area area, final String itemName) { for(final GroundItem groundItem : getGroundItems().getAll()) { if(groundItem.getName().equals(itemName) && area.contains(groundItem)) { return true; } } return false; } If you want to get the closest matching item in the area you can do: With the OSBot API: final Optional<GroundItem> closestItemInArea(final Area area, final String itemName) { return Optional.ofNullable(getGroundItems().closest(new AreaFilter<>(area), new NameFilter<>(itemName))); } With the Java 8 Stream API: final Optional<GroundItem> closestItemInArea(final Area area, final String itemName) { return getGroundItems().getAll() .stream() .filter(groundItem -> groundItem.getName().equals(itemName) && area.contains(groundItem)) .min((g1, g2) -> Integer.compare(myPosition().distance(g1.getPosition()), myPosition().distance(g2.getPosition()))); } Or if you want to get any matching item in the area (not necessarily the closest) you can do: With the OSBot API: final Optional<GroundItem> getItemInArea(final Area area, final String itemName) { return Optional.ofNullable(getGroundItems().singleFilter(getGroundItems().getAll(), new AreaFilter<>(area), new NameFilter<>(itemName))); } With the Java 8 Stream API: final Optional<GroundItem> getItemInArea(final Area area, final String itemName) { return getGroundItems().getAll() .stream() .filter(groundItem -> groundItem.getName().equals(itemName) && area.contains(groundItem)) .findAny(); }
  4. I don't think there is a way of enabling mouse input any more. You could always try and do some hacky stuff like this: getBot().getCanvas().addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { super.mouseClicked(e); getBot().getMouseEventHandler().generateBotMouseEvent( e.getID(), e.getWhen(), e.getModifiers(), e.getX(), e.getY(), e.getClickCount(), false, e.getButton(), true ); } });
  5. Why do you still need that feature?
  6. Yes. By the way, you say you want to learn how to program, if that is true then you should make some attempt to write the code yourself. This is the scripting help section not the scripting service section. Try and learn Java, look at the OSBot API, follow some tutorials, and then if you are still stuck request help here. Saying "I don't even know how to start this" is an indicator that you have not spent enough time trying to learn Java / scripting by yourself.
  7. I wrote that class a long time ago and it needs some improvement, sorry I do not have too much time to fix it up for you: In terms of using it, I recommend you follow some Java tutorials if you do not understand how classes work.
  8. Nope Relax breh. There used to be a little notification on the main forum page that stated whether the client was down or not. It is not there any more though, maybe because the devs cba to update it every time / a lot of people didn't seem to notice it. Usually the client will be back up a few hours after an update, it happens most Thursdays too.
  9. I'm just waiting for it to be uploaded to the SDN, then it will be open for testing
  10. You're welcome. If you don't find a reasonable solution such as Jar Launcher, you can always create a shell script to open OSBot for you: Step 1) Save this in a file called osbot.command: find ~/ -name "OSBot*.jar" -print0 | xargs -0 ls -t | head -n 1 | xargs -I{} java -jar {} Step 2) Make the file executable. To do this you will need to open up Terminal and type: chmod u+x /path/to/where/you/put/the/script/osbot.command Step 3) Double click the osbot.command file and it should open OSBot
  11. You will need to set the default application for .jar files as Java. If found this post on the internet, perhaps it will work for you (Sorry I do not use mac os) 1. Click once on the .jar file in the Finder. 2. From the menubar in the Finder select File -> Get Info". 3 Click on "Open with" and from the popup menu. 4. Select "Jar Launcher", which is built into OS X. 5. Whenever you double click on the .jar file the program will start.
  12. If you want to check if a player is less than a certain distance away, you can use: private boolean isOtherPlayerWithinDistance(final int distance) { for(final Player player : getPlayers().getAll()) { if(player != myPlayer() && player.getPosition().distance(myPosition()) < distance) { return true; } } return false; } Or you can use a filter: private boolean isOtherPlayerWithinDistance(final int distance) { return !getPlayers().filter(player -> player != myPlayer() && player.getPosition().distance(myPosition()) < distance).isEmpty(); } Otherwise you can just check the size of getPlayers().getAll() private boolean isOtherPlayerNearby() { return getPlayers().getAll().size() > 1; }
  13. That method works fine, he just might want to check that the player != myPlayer
  14. What you can do is run OSBot in debug mode from the command line, and redirect all output to a file. Open up CMD / terminal and type: java -jar "C:\Users\Username\Downloads\OSBot 2.4.59.jar" -debug >> test.txt With the correct file path to your OSBot.jar This will output all log statements to the file test.txt
  15. I haven't actually tested this out, but this may work for tracking clicks made by the bot: getBot().addMouseListener(new BotMouseListener() { @Override public boolean blockInput(Point point) { return false; } @Override public void mouseClicked(MouseEvent e) { } @Override public void mousePressed(MouseEvent e) { } @Override public void mouseReleased(MouseEvent e) { } @Override public void mouseEntered(MouseEvent e) { } @Override public void mouseExited(MouseEvent e) { } });
  16. If you just want to capture the users' mouse click you can use the MouseAdapter class (Add this to onStart()) getBot().addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { super.mouseClicked(e); // do whatever you want to do when the user clicks the mouse } });
  17. I think it is possible, just maybe not using FXML. Support may be added in the future by OSBot devs, but for now it is easier to just use Swing.
  18. Explv

    Explv's Walker

    Sure, i'll take a look at adding wilderness locations for you
×
×
  • Create New...