kingsolo 15 Share Posted December 18, 2018 27 minutes ago, abdulr said: I assume you code with one main class using switch cases for different tasks? I have one script using nodes but it's small, I mostly use enum for States and a switch statement Link to comment Share on other sites More sharing options...
abdulr 0 Author Share Posted December 18, 2018 6 minutes ago, Nuclear Nezz said: change the AbstractScript script; to MethodContext ctx; You'll still have all of the api methods (I assume you're using TaskNode) every TaskNode extends MethodContext. Personally, I would suggest just making your own Node class, that way you have more control over what you have access to when you need it, then use an AbstractScript for your main script class, and handle the nodes on your own in the onLoop. i'm a little confused but this is what i'm trying to do, I have coded before in powerbot (not advertising) and this is my code *I removed all the code so its simple to read* This is my main class public class Main extends PollingScript<ClientContext> implements PaintListener{ @Override public void poll() { for (Task task : taskList) { if (task.activate()) { task.execute(); break; } } } } This is my task abstract class public abstract class Task extends ClientAccessor { public Task(ClientContext ctx) { super(ctx); } public abstract boolean activate(); public abstract void execute(); } This is my Random Events Class (anti-ban) class RandomEvents extends ClientAccessor { RandomEvents(ClientContext ctx) { super(ctx); } void moveCamera() { // move camera } } One of my tasks (node) was Chop public class extends private re new ; // Random Event Class public Chopsuper; @Override public boolean activate@Override public void executeprivate void randomEvents // moves camera if 1re; But how do i do that in dream bot, be nice if you could show code, would be better than explaining the steps, thanks Link to comment Share on other sites More sharing options...
abdulr 0 Author Share Posted December 18, 2018 Last bit come out wrong heres the fix version public class Chop extends Task { private RandomEvents re = new RandomEvents(ctx); // Random Event Class public Chop(ClientContext ctx) { super(ctx); } @Override public boolean activate() {} @Override public void execute() {} private void randomEvents() { // moves camera if (antiBanEvent == 1) { re.moveCamera(); } } } Link to comment Share on other sites More sharing options...
Nuclear Nezz 2051 Share Posted December 18, 2018 https://dreambot.org/forums/index.php?/topic/391-using-nodes-in-your-script-dreambot-scripting-tutorial Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.