Jump to content
Frequently Asked Questions
  • Are you not able to open the client? Try following our getting started guide
  • Still not working? Try downloading and running JarFix
  • Help! My bot doesn't do anything! Enable fresh start in client settings and restart the client
  • How to purchase with PayPal/OSRS/Crypto gold? You can purchase vouchers from other users
  • Leaderboard

    Popular Content

    Showing content with the highest reputation on 03/31/22 in all areas

    1. Behavior Trees For Dummies I'm not a pro at anything and take everything I say with a grain of salt. I have no idea what i'm doing and my opinions here are mostly preference. Make your own decisions, disagree with me, tell me why, and lets make better bots. Also, can't take credit for the idea of behavior trees in bots. I read @jgs95's post about them a week ago. Introduction The most popular type of scripts I have found during my time scripting is the `Node` based system. Node based systems split up their code into sections called Nodes (duh). Each Node is comprised of a condition that checks whether or not the node should run, and a action to perform if the condition passes. If you don't yet know about Node based systems I highly suggest checking out This post. You should know about other methodologies of bot scripting so you can weigh the pros and cons of both for yourself. Code That A Computer Can Read Is Useless. At a very high level Behavior Trees are used to handle triggering actions based on conditions. Sound a lot like the Node system mentioned earlier? Both methodologies are just ways to handle triggering actions based on conditions. That's what most if not all bots do. So why choose Behavior Trees? There are two things that need to be able to understand your code. The computer, and humans (yourself included). Writing code that the computer understands is easy. Take a look at the following JavaScript code. var _0x49e6=['1JEFwRC','5222dXsJWJ','92FVLqzU','1365284gtsOMo','1614886gtbOhP','3648908RUJhLp','Hello\x20World!','74944THxNfO','412769AyhqCE','log','1402906gnphcE'];(function(_0xf7574b,_0x59a0fa){var _0x3a1092=_0x3bf3;while(!![]){try{var _0x2ce5f6=parseInt(_0x3a1092(0x182))+parseInt(_0x3a1092(0x185))*parseInt(_0x3a1092(0x184))+parseInt(_0x3a1092(0x17f))+parseInt(_0x3a1092(0x186))+-parseInt(_0x3a1092(0x183))*parseInt(_0x3a1092(0x180))+parseInt(_0x3a1092(0x187))+-parseInt(_0x3a1092(0x17d));if(_0x2ce5f6===_0x59a0fa)break;else _0xf7574b['push'](_0xf7574b['shift']());}catch(_0x46c630){_0xf7574b['push'](_0xf7574b['shift']());}}}(_0x49e6,0xd60df));function hi(){var _0x221f00=_0x3bf3;console[_0x221f00(0x181)](_0x221f00(0x17e));}function _0x3bf3(_0x3c1132,_0x58570b){_0x3c1132=_0x3c1132-0x17d;var _0x49e678=_0x49e6[_0x3c1132];return _0x49e678;}hi(); This runs. The computer is absolutely fine with this. But what about the poor sap that has to maintain this code? Or what if you need to go back and change something. I guarantee if you even step away to shit after writing this you will comeback and have no fucking idea what this does and probably blame someone else for writing it insisting they are an idiot and should be killed immediately (personal experience). This is why coding for humans is more important that coding for the computers. Take a look at the following code that does the exact same thing as the above example. function helloWorld() { console.log("Hello World!"); } Tell me that doesn't make one thousand times more sense than the other example. Clean, readable code is the backbone of a good program. How fast, or efficient it is should be the second thing you think about. You can always go back and optimize. It's much harder to go back and make it understandable. If the topic of clean code has given you a boner/wet vagina I highly suggest reading Clean Code by Robert C. Martin. Now that we understand that we should prioritize writing code that humans can understand we can start looking at why we should choose Behavior Trees over everything else. Why Choose Behavior Trees Over Everything Else? Lets take a look at a node based wood chopper main script class. This is based off of This really great tutorial on the Node system by @GoldenGates. Great read, go read it if you aren't that solid with the node system yet. public class WoodChopper extends AbstractScript { private final Node[] array = new Node[] { new WalkToTrees(this), new ChopWood(this), new WalkToBank(this), new OpenBank(this), new DepositLogs(this) }; @Override public int onLoop() { for (final Node node : array) if (node.activate()) { node.execute(); } return Calculations.random(250, 500); } } The main con I have for the Node based system is how it reads, reuse, and how you handle more complex conditions. Correctly naming your Node instances is a great start. but we are left wondering what conditions do these nodes run on. If we wanted to get a bit more flexible we could abstract out our conditions and actions using two new classes. a `Action` class and a `Condition` class. Then our main script class would look like this. public class WoodChopper extends AbstractScript { private final Node[] array = new Node[] { new Node(new ShouldMoveToTrees(), new WalkToTrees()), new Node(new ShouldChopWood(), new ChopWood()), new Node(new ShouldWalkToBank(), new WalkToBank()), new Node(new ShouldOpenBank(), new OpenBank()), new Node(new ShouldDepositLogs(), new DepositLogs()) }; @Override public int onLoop() { for (final Node node : array) if (node.activate()) { node.execute(); } return Calculations.random(250, 500); } } This is pretty good. The logic flow is pretty obvious and its clear what conditions trigger what actions, in what order. For a basic script id be happy with this assuming your conditions and actions names aren't complete trash. Lets pretend that we want to chop trees behind Lumbridge castle and there is that obnoxious asshole mugger back there that attacks us all the time. We need to add some combat nodes to our Node array. Lets take a look at what that might look like now. public class WoodChopper extends AbstractScript { private final Node[] array = new Node[] { new Node(new IsUnderAttackWithEnoughHealth(), new FightBack()), new Node(new IsUnderAttackWithoutEnoughHealthAndHasFood(), new Eat()), new Node(new IsUnderAttackWithoutEnoughHealthAndDoesNotHaveFood(), new RunAway()), new Node(new ShouldMoveToTrees(), new WalkToTrees()), new Node(new ShouldChopWood(), new ChopWood()), new Node(new ShouldWalkToBank(), new WalkToBank()), new Node(new ShouldOpenBank(), new OpenBank()), new Node(new ShouldDepositLogs(), new DepositLogs()) }; @Override public int onLoop() { for (final Node node : array) if (node.activate()) { node.execute(); } return Calculations.random(250, 500); } } We can see now that our conditions start to contain a lot of the same wording and logic. All of our combat nodes check to see if the player is under attack. Then we make a decision about the current health of our player. Then we make a decision on if we have food or not. It's as if each of these decisions are sub decisions. Sounds a whole lot like a tree to me. Now you could only have a `IsUnderAttack` condition and then have your other conditions inside the `FightBack` action but then we are hiding logic that someone might miss while also making it harder to dynamically add more behaviors, and also adding conditions to an action which goes against the name of "action". Actions should only be exactly what they are, actions. So what are we going to do about this? JESUS CHRIST GET TO BEHAVIOR TREES ALREADY YOU FUCK. Fine here we go. First off, Watch the following Videos if you have never heard of behavior trees or have no idea how they work. Data structures: Introduction to Trees - mycodeschool Introduction To Behavior Trees - Holistic3d What is a Behavior Tree and How do they work? (BT intro part 1) - Peter Ogren How to create Behavior Trees using Backward Chaining (BT intro part 2) - Peter Ogren Here is how we would create the same script with a behavior tree. After looking at this i'll go over why I think it is more readable/cleaner/flexible. public class WoodChopper extends AbstractScript { Node bankTree = new TreeBuilder() .sequence() .oncePerSequenceCompletion() .condition(new PlayerShouldBank()) .finish() .oncePerSequenceCompletion() .action(new MoveToBank()) .finish() .action(new DepositLogs()) .finish() .buildTree(); Node chopTree = new TreeBuilder() .sequence() .oncePerSequenceCompletion() .action(new MoveToTrees()) .finish() .action(new ChopTree()) .condition(new PlayerShouldBank()) .finish() .buildTree(); Node tree = new TreeBuilder() .selector() .appendTree(bankTree) .appendTree(chopTree) .buildTree(); @Override public int onLoop() { tree.tick(); return Calculations.random(250, 500); } } Separation of Concerns Behavior trees let us split up our logic into small, clean, chunks of code that only have to do with what they are doing. We have a tree dedicated to handling banking, a tree dedicated to handling chopping wood, and a tree dedicated to putting other trees together. Readability The biggest advantage I think behavior trees have over the node system is that the code reads basically in plain English. If we look at the "chopTree" above and read line by line we fully understand what it is doing without having to go anywhere, look into any of the classes etc. To really drive my point home on this ill show you some pseudocode for the "chopTree" and you can compare it to the actual code above. To chop a tree we must do the following in sequence if we have not already moved to the tree location move to the location of the trees chop down a tree if we have more inventory room repeat this sequence Adaptability Finally, our ability to add to our bots behavior is incredibly easy. Lets add our combat behavior to our behavior tree like we did to the node based system. We just create our combat tree, and add it to our root tree. We don't care about anything else in the code base. Since we want to prioritize combat we make sure to put this tree earlier in our root sequence. Node combatTree = new TreeBuilder() .selector() .sequence() .condition(new HasMoreThanHalfHealth()) .action(new Retaliate()) .selector() .sequence() .condition(new HasFood()) .action(new EatFood()) .action(new RunAway()) .buildTree() Node root = new TreeBuilder() .selector() .appendTree(combatTree) .appendTree(bankTree) .appendTree(chopTree) .buildTree(); Small Conditions and Actions Another lovely side effect of using a behavior tree over a node system is our conditions will only be checking a maximum of one thing. Remember earlier when we had the god awful "IsUnderAttackWithoutEnoughHealthAndDoesNotHaveFood" condition? Lots of code duplication, and not very reusable as it has been so tightly written to go along with the certain action it was originally meant to. Now look at our new conditions. "HasMoreThanHalfHealth", "HasFood", these conditions could be reused in other places, and also are way less prone to bugs as they are simpler. Code Sharing Another pro of re-usability/adaptability is how easy it makes it to share between multiple projects. Lets say you write an incredible combat tree that handles eating, switching styles, praying, running away, etc. All you gotta do is pull that hoe into your new bot and append it to your root tree. (you can do this with nodes too just want to plant brain seeds). Conclusion Library/Framework If any of these reasons for using behavior trees made sense to you and you agree with them you might be asking if there is a pre-made framework for behavior trees you can use, and there is, I wrote one. But your not getting it. Implementing it yourself will really drive home all the ideas and pitfalls of this structure. The videos I posted above should be a good enough starting point for figuring out how to write your own implementation. Try to resist just googling for implementations because they are out there. It will make you a better developer if you pain through this and just do it. You'll learn a lot. When to still use Node Systems Like I said earlier I think there is no perfect tool for every job. You just need to know the tools at your disposal and implement what you think is most appropriate. If your bot just walks from Lumbridge to Edgeville don't implement a whole ass behavior tree. The overhead would just be ridiculous. If your building a PVP bot that also banks, switches PVP load outs etc, a behavior tree is probably a better fit. Basically, behavior trees are great for handling bots that handle a lot of behaviors. If your bot doesn't meet this criteria it's probably fine just remember my rant about readable, clean code. Alright, Bye
      1 point
    2. Hi All, I am wanting to share my implementation of Utility classes for DreamBot which are not available through the DreamBot API. The first one I am going to share is the MinigameTeleporter class. This class is useful for allowing the local player to use the minigame teleports in the grouping tab. Below is the source code and how to use in your project. ALL AVAILABLE CLASSES CAN BE FOUND AT: https://github.com/HMM7777/DreamBotUtility SOURCE CODE HOW TO USE IN YOUR PROJECT The MinigameTeleporter is easy to use. The MinigameTeleporter class contains the method teleportMinigame(String minigameName). The teleportMinigame method takes a String parameter. This String literal is the name of the minigame you wish to teleport to. Note: the String literal has to be spelt appropriately in accordance with the widget text value in the minigame tab. Below is an example of teleporting to Clan Wars using the minigame teleports via the grouping tab. MinigameTeleporter.teleportMinigame("Clan Wars"); ADDITIONAL NOTES The sleep times used can be changed to your convenience. The sleep times I used were made quickly for my test environment. The MinigameTeleporter does not check if your minigame teleport is available (cooldown 20 minutes). You can wrap the teleportMinigame with a boolean checker to see if the teleport is on cooldown or not. I did play with Varbit 8354 which is the counter for the minigame teleport. Most minigames are made available in the grouping tab and are selectable within the interface however some of these minigames do not have a teleport. Be weary of this. This class will most likely be used for F2P accounts or niche use cases. Please let me know how it goes. Any constructive criticism will be appreciated. Regards, Hmm. MinigameTeleporter.java
      1 point
    3. I've used many bots in many different games over the years. That being said I can confirm what most people post automatically as a review. I joined discord to get the most knowledge about the bot as possible. And like the reviews said I was contacted by the seller shortly after. Funny part is I joined without any personal info since i try try to remain private at all times. I was still contacted with a personal greeting. After talking about skiller elite the conversation has been non stop. Ive been asked constantly If I've had any questions and went above to give gave me advice they thought I could use. Unbelievably on discord they asked my personal opinion on future scripts all within day 2. At that point i was begging to write a review 10/10.
      1 point
    ×
    ×
    • Create New...

    Important Information

    We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.