Tier3 8 Share Posted July 29, 2022 First off, is TaskScript still the preferred framework? If not, what would be? [Currently I'm using Abstract Script with a state/node framework, but my decision making is making my scripts feel cluttered and messy] Second, while it seems great for simple repetitive tasks in the same order, how would I go about choosing a random activity to do? Make a Decision node with the highest priority where the Accept is based on, say, a Timer. This would force me to use a variable to determine which activity I'm going to do, wouldn't it? And all nodes would need to have that variable check in their Accept? [See attached image for a visual on what I'm talking about] Spoiler And lastly, have I structured this correctly? [Basic Woodcutting Script - mostly copied from an old Hashtag Tut, updated for DB3 + added a few extras] Main.java Spoiler package chopper; import org.dreambot.api.script.Category; import org.dreambot.api.script.ScriptManifest; import org.dreambot.api.script.impl.TaskScript; @ScriptManifest(version = 0.1, author = "Tier3", category = Category.WOODCUTTING, name = "ChopChop") public class Main extends TaskScript { @Override public void onStart() { addNodes(new nodes.ChopNode(), new nodes.ChopOak(), new nodes.ChopWillow(), new nodes.DropNode(), new nodes.LvlNode()); } } DropNode.java Spoiler package nodes; import org.dreambot.api.methods.Calculations; import org.dreambot.api.methods.container.impl.Inventory; import org.dreambot.api.script.TaskNode; public class DropNode extends TaskNode { @Override public int priority() { return 2; } @Override public boolean accept() { return Inventory.isFull(); } @Override public int execute() { Inventory.dropAll(l -> l != null && l.getName().contains("ogs")); return Calculations.random(1600, 3200); } } ChopNode.java Spoiler package nodes; import org.dreambot.api.methods.Calculations; import org.dreambot.api.methods.interactive.GameObjects; import org.dreambot.api.methods.interactive.Players; import org.dreambot.api.methods.skills.Skill; import org.dreambot.api.methods.skills.Skills; import org.dreambot.api.script.TaskNode; import org.dreambot.api.wrappers.interactive.GameObject; public class ChopNode extends TaskNode { @Override public int priority() { return 1; } @Override public boolean accept() { return Skills.getRealLevel(Skill.WOODCUTTING) < 15; } @Override public int execute() { if (!isChopping()) { GameObject tree = GameObjects.closest(t -> t != null && t.getName().equals("Tree") && t.hasAction("Chop down")); if (tree != null) { if (tree.interact("Chop down")) { sleepUntil(() -> Players.localPlayer().isMoving(), Calculations.random(1500,2600)); sleepUntil(() -> isChopping() || tree == null, Calculations.random(3500,5600)); } } else { //Walk to Trees } } return Calculations.random(1900,3600); } private boolean isChopping() { return Players.localPlayer().isAnimating(); } } ChopOak (WC between 15 and 30) and ChopWillow (WC > 30) are the same as ChopNode, except chops the corresponding tree type based on WC lvl. (As for the "isChopping()" method, because I'm using it 3 times, could I instead have isChopping() in a Helper class? Obviously 3 one line methods is no big deal to just copy/paste, but lets say I had 15 or fifty lines of code? Helper class would be preferred?) LvlNode just checks for Dialogues.canContinue and continues (Priority 3) Obviously this script is probably 100% ban rate as is, what I'm most interested in knowing is: Is it structured correctly Am I correct on my "Decision Node" assumption Would a "Variable" class be worth it? Or just shove any variables into Main along with setters and getters? Would "isChopping" be better in a Helper class, or is there some benefit to keeping it in each 'Chop' node? If upscaling this to the suggested attached flow chart (Obviously renaming everything) is there an issue with adding nodes from several different packages in the "addNodes" in "Main.java" (chopNodes package, mineNodes package, fishNodes package for example) Or would there be a better solution to all of this? Link to comment Share on other sites More sharing options...
camelCase 271 Share Posted July 30, 2022 7 hours ago, Tier3 said: First off, is TaskScript still the preferred framework? If not, what would be? TBL is better for larger scripts https://github.com/LostVirt/Dreambot-Tree-Branch-Framework/ 7 hours ago, Tier3 said: ChopOak (WC between 15 and 30) and ChopWillow (WC > 30) are the same as ChopNode, except chops the corresponding tree type based on WC lvl. i prefer having 1 leaf / node to handle wood cutting and the location & tree type and decided in that leaf based off level or whatever 8 hours ago, Tier3 said: Second, while it seems great for simple repetitive tasks in the same order, how would I go about choosing a random activity to do? Make a Decision node with the highest priority where the Accept is based on, say, a Timer. This would force me to use a variable to determine which activity I'm going to do, wouldn't it? And all nodes would need to have that variable check in their Accept? yeah 8 hours ago, Tier3 said: Would "isChopping" be better in a Helper class, or is there some benefit to keeping it in each 'Chop' node id say you should just get rid of isChopping and straight check if animating 8 hours ago, Tier3 said: If upscaling this to the suggested attached flow chart (Obviously renaming everything) is there an issue with adding nodes from several different packages in the "addNodes" in "Main.java" (chopNodes package, mineNodes package, fishNodes package for example) Or would there be a better solution to all of this? theres no problem doing that (except that packages are named in all lowercase not camelCase ) id recommend using TBL if you are going to do multiple skills in one script, i never really got around to adding anything to this but heres a skeleton of how i was doing something similar https://github.com/Amoz3/FOSS-AIO-Dreambot3 Tier3 1 Link to comment Share on other sites More sharing options...
Tier3 8 Author Share Posted July 30, 2022 Thank you for this, I remember stumbling on a post about tree behavior and then another one about 420 OP 1337 or something silly, basically exactly what you linked me to but it was from 2018 or something so I wasn't sure about it's relevance. This is a much better skeleton to work with anyway haha thanks. I think this will make multi skilling easier, I like that paint too! I'll have a go at it using this framework camelCase 1 Link to comment Share on other sites More sharing options...
Elliott1 62 Share Posted August 3, 2022 On 7/30/2022 at 6:53 AM, Tier3 said: Thank you for this, I remember stumbling on a post about tree behavior and then another one about 420 OP 1337 or something silly, basically exactly what you linked me to but it was from 2018 or something so I wasn't sure about it's relevance. This is a much better skeleton to work with anyway haha thanks. I think this will make multi skilling easier, I like that paint too! I'll have a go at it using this framework I have a big multi skill, multi quest script. And I use this framework too: https://github.com/LostVirt/Dreambot-Tree-Branch-Framework/ can definitely vouch for it on larger scripts Link to comment Share on other sites More sharing options...
Tier3 8 Author Share Posted August 3, 2022 12 hours ago, Elliott1 said: I have a big multi skill, multi quest script. And I use this framework too: https://github.com/LostVirt/Dreambot-Tree-Branch-Framework/ can definitely vouch for it on larger scripts Yes I'm enjoying it so far, much cleaner than my basic node structure previously Link to comment Share on other sites More sharing options...
mexxxy 5 Share Posted January 21, 2023 Is this framework still up to date with current API? Trying to use it and I noticed that both these import arent available anymore org.dreambot.framework.Branch; org.dreambot.framework.Tree; seem to have been replaced with org.dreambot.api.script.frameworks.treebranch.TreeScript; but the Main.java actually extends AbstractScript ??? Link to comment Share on other sites More sharing options...
holic 233 Share Posted January 22, 2023 On 1/21/2023 at 9:58 AM, mexxxy said: Is this framework still up to date with current API? Trying to use it and I noticed that both these import arent available anymore org.dreambot.framework.Branch; org.dreambot.framework.Tree; seem to have been replaced with org.dreambot.api.script.frameworks.treebranch.TreeScript; but the Main.java actually extends AbstractScript ??? Extend TreeScript Luxe 1 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now