Jump to content

Explv

Scripter II
  • Posts

    2314
  • Joined

  • Last visited

  • Days Won

    6
  • Feedback

    100%

Everything posted by Explv

  1. if(getGrandExchange().getStatus(GrandExchange.Box.BOX_1) == GrandExchange.Status.FINISHED_BUY) Or if you import these: import org.osbot.rs07.api.GrandExchange.Status; import org.osbot.rs07.api.GrandExchange.Box; You can just do: if(getGrandExchange().getStatus(Box.BOX_1) == Status.FINISHED_BUY)
  2. Explv

    onPaint()

    You override the methods in Script when you want to use them, this means both the return type and parameters must be identical: @ScriptManifest(author = "", name = "", info = "", version = 0, logo = "") public class Main extends Script{ @Override public void onStart(){ } @Override public int onLoop() throws InterruptedException{ return 0; } @Override public void onPaint(Graphics2D g){ } @Override public void onExit(){ } }
  3. I found your Filter to be written a little oddly as well Why would you do: Filter<NPC> monsterFilter = new Filter<NPC>() { @Override public boolean match(NPC n) { if (n.getId() != monsterID) return false; if(!n.getName().equals(monsterName)) return false; if(n.isUnderAttack()) return false; return true; } }; when you could just do: Filter<NPC> monsterFilter = new Filter<NPC>() { @Override public boolean match(NPC n) { return n.getName().equals("Cow") && !n.isUnderAttack(); } }; But yeah, lambdas make everything more simple anyway ^_^
  4. Or you could just do: NPC monster = getNpcs().closest(npc -> npc.getName().equals("Cow") && !npc.isUnderAttack()); Just suppress it, the warning is for an operation that is potentially unsafe, but in this case we know it is fine. @SuppressWarnings("unchecked") NPC monster = getNpcs().closest(npc -> npc.getName().equals("Cow") && !npc.isUnderAttack()); Also with regards to your arrow method, it can be simplified to: public boolean arrowsPresent() { return getGroundItems().closest(arrowType) != null; } And it should work fine, it is probably an issue somewhere else in your code.
  5. Move: gui.setVisible(true); To the end of your GUI method.
  6. Yes. When the user stops the script the JFrame is disposed of if it exists. The JFrame is also hidden when the user starts the script: startButton.addActionListener(e -> { // This code is called when the user clicks the button started = true; // Set the boolean variable started to true gui.setVisible(false); // Hide the GUI }); See the line gui.setVisible(false); // Hide the GUI
  7. Intellij IDEA Darcula Theme
  8. myPosition() Just does: myPlayer().getPosition() Decompiled myPosition() declaration:
  9. NPC cow = getNpcs().closest("Cow"); if(cow.getPosition().distance(myPosition()) <= 1) // do something
  10. Well interactions are pretty random by themselves. Also going back to path walking, if you call walk() like this: Position[] path = { new Position(0, 1, 0), new Position(0, 2, 0), new Position(0, 3, 0) }; getLocalWalker().walkPath(path); It will walk to each position in the array, but randomise each position to a distance of 1 tile. So most things are already randomised for you.
  11. Try this: http://osbot.org/forum/topic/87717-fixing-osbot-not-starting/
  12. Explv

    Need DP & SIGGY

    You're welcome.
  13. Area area = new Area(0, 0, 1, 1); getLocalWalker().walk(area.getRandomPosition());
  14. noob?? Learn to Java 8 m8 It is safe to ignore this warning. It is an unchecked generics array creation warning produced by getObjects().filter(). You can just supress it. @SuppressWarnings("unchecked") List<RS2Object> banks = getObjects().filter(obj -> obj.getName().equals("Bank booth")); If you don't want a warning you can always do: List<RS2Object> banks = getObjects().getAll().stream().filter(obj -> obj.getName().equals("Bank booth")).collect(Collectors.toList()); But the first way is perfectly fine and shorter. No it is not anything to worry about.
  15. Explv

    Auto login

    If the user has saved their username and password in the OSBot settings, it will automatically log in for them. There is no need to create a login script.
  16. It just means: -Get all objects and filter them so that the list only contains objects with the name "Bank booth" -If the list is null, or there are no elements in the list, return null Otherwise return a random value from the list.
  17. This is a bit shorter: public RS2Object getRandomBank() { List<RS2Object> banks = getObjects().filter(obj -> obj.getName().equals("Bank booth")); return (banks == null || banks.size() == 0) ? null : banks.get(random(banks.size()-1)); }
  18. No problem For more information on the different operators in Java you can take a look at this Java tutorial: https://docs.oracle.com/javase/tutorial/java/nutsandbolts/operators.html
  19. Yes, it is a logical OR || so the second condition in the OR is not checked if the first evaluates to true. If you were to use a bitwise OR | then both sides of the condition would be checked and a null pointer exception thrown.
  20. Because when the widget is not on screen, when you do getWidegets().get() it will return null. So always make sure you null check
×
×
  • Create New...