Jump to content

Epos OSBot

Members
  • Posts

    5
  • Joined

  • Last visited

  • Feedback

    0%

Profile Information

  • Gender
    Male

Epos OSBot's Achievements

Newbie

Newbie (1/10)

0

Reputation

  1. @ExtraBotz This was especially useful. Definitely cleared up some confusion.
  2. @Apaec Would it be possible to simply define and assign a variable for timeout the same way it's done for condition? So just define it and assign it in the constructor. You're able to use sleep() because the class extends ConditionalSleep, right? I'm still not quite sure what super(timeout) is for. Why not this.timeout = timeout; as done with condition?
  3. public class Sleep extends ConditionalSleep { private BooleanSupplier condition; public Sleep(BooleanSupplier condition, int timeout) { super(timeout); this.condition = condition; } @Override public boolean condition() throws InterruptedException { return condition.getAsBoolean(); } public static boolean sleepUntil(BooleanSupplier condition, int timeout) { return new Sleep(condition, timeout).sleep(); } } I got this class from a tutorial, but I'm trying to understand it and have a few questions: What does super(timeout) do? I know super calls the parent class but what exactly does it do in this context? What does the condition() method do in this class? It's an abstract method so it has to be implemented, but I don't see it being used for anything in this class, so why is return condition.getAsBoolean() necessary?
  4. Fixed by using a constructor in the BuyBoots class.
  5. public class Main extends Script { private ArrayList<Task> tasks = new ArrayList<Task>(); public static MethodProvider MP = new MethodProvider(); @Override public void onStart() throws InterruptedException { Collections.addAll(tasks, new Bank(), new Teleport(), new BuyBoots()); } @Override public int onLoop() throws InterruptedException { for (Task task : tasks) { if (task != null && task.validate()) { task.execute(); } } return random(250, 750); } } public class BuyBoots implements Task { @Override public boolean validate() { return !Main.MP.getInventory().contains("Coins"); } @Override public void execute() { Main.MP.log("Executing BuyBoots task."); } } This part is giving me an NPE: return Main.MP.getInventory().contains("Coins"); I tried defining a MethodProvider instance in the BuyBoots class, tried using a getter method in the Main class instead of a static variable etc. but when I start the script this line gives me an NPE and the script stops responding. Can anyone help?
×
×
  • Create New...