Jump to content

RXScripts

Members
  • Posts

    4
  • Joined

  • Last visited

  • Feedback

    0%

Profile Information

  • Gender
    Male

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

RXScripts's Achievements

Newbie

Newbie (1/10)

0

Reputation

  1. Is there any way to check that the player is indeed moving towards a certain area? That is, I click the mouse to move to a tile, how can I check that the player is actually moving towards that tile now?
  2. Perfect thank you, I do remember OOP to a certain extent, its just that I need a refresher and the best way I learn is through trial and error like this.
  3. I am getting into scripting using tasks and I have a question about inheritance and how to go about doing this. I have my main class: public class Test extends Script { ArrayList<Task> tasks = new ArrayList<Task>(); @Override public void onStart() throws InterruptedException { // Add tasks tasks.add(new DropTask(this)); tasks.add(new CutTask(this)); } @Override public final int onLoop() throws InterruptedException { tasks.forEach(tasks -> tasks.run()); return random(100,300); } } And I have my task class: public abstract class Task extends Test { protected MethodProvider api; public Task(MethodProvider api) { this.api = api; } public abstract boolean canProcess(); public abstract void process(); public void run() { if (canProcess()) process(); } } And I have my cutting task: public class CutTask extends Task { public CutTask(MethodProvider api) { super(api); } @Override public boolean canProcess() { return !api.getInventory().isFull(); } @Override public void process() { api.log("Chop tree task initiated!"); Entity tree = api.getObjects().closest(1276,1278); if (tree != null && tree.interact("Chop down")) { // Just testing } } } Now the above code is super basic while I get my feet wet again in scripting (I haven't scripted in over 6 years so I'm trying to jump start my memory). Basically what I want to do is set a variable, most likely should be in the main class (Test), for the tree Entity. And I want to be able to access and edit this Entity variable from within the tasks themselves. My reasoning for this is that I want to be able to check in the task canProcess() that a tree has been selected, and if it has, that it still exists. This will allow my script to more quickly respond to when a tree is cut down, rather than relying on the cutting animation which often lags behind the actual tree being cut down.
×
×
  • Create New...