May 7, 20187 yr 2 hours ago, Apaec said: aren't all scripts state based? Technically yes, if they ude the task/node framework. Some frameworks are Event based with break conditions and other crap.
May 9, 20187 yr boolean shouldExecute() { return getObjects.getAll().get("ABC") != null } void execute() { return getObjects.getAll().get("ABC").interact(); }
May 9, 20187 yr 24 minutes ago, Alek said: boolean shouldExecute() { return getObjects.getAll().get("ABC") != null } void execute() { return getObjects.getAll().get("ABC").interact(); } Syntax error on line 2, missing ;
May 9, 20187 yr Just now, Vilius said: Syntax error on line 2, missing ; it makes the task node system faster, less characters to compute.
May 9, 20187 yr Just now, Alek said: it makes the task node system faster, less characters to compute. No need to compile when you are missing parameters on line 6 cause eitherway you wouldnt do an action
May 9, 20187 yr 14 minutes ago, Vilius said: Syntax error on line 2, missing ; Not even commenting on the fact that he's using a List like a Map
May 9, 20187 yr public enum Task { OPEN_BANK("Open bankies") { @Override public boolean validate(Bot bot) { return !bot.bank.isOpen(); } @Override public int execute(Bot bot) throws InterruptedException { if (bot.bank.open()) { bot.logger.debug("*YAY*"); } return 250; } } ; private final String name; private Task(String name) { this.name = name; } public abstract boolean validate(Bot bot); public abstract int execute(Bot bot) throws InterruptedException; @Override public String toString() { return name; } }
May 9, 20187 yr 1 hour ago, liverare said: public enum Task { OPEN_BANK("Open bankies") { @Override public boolean validate(Bot bot) { return !bot.bank.isOpen(); } @Override public int execute(Bot bot) throws InterruptedException { if (bot.bank.open()) { bot.logger.debug("*YAY*"); } return 250; } } ; private final String name; private Task(String name) { this.name = name; } public abstract boolean validate(Bot bot); public abstract int execute(Bot bot) throws InterruptedException; @Override public String toString() { return name; } } Bank open() checks if your bank is already open, so you're still calling the same code twice. Not like it matters much though ?
Create an account or sign in to comment