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

    Recommended Posts

    Posted (edited)

    https://github.com/deepslayer/TreeScriptExample/

     

    TreeScriptExample

    This repository demonstrates a hierarchical tree structure for scripting in DreamBot, an Old School RuneScape botting framework. The project showcases a Tree Branch Leaf framework that organizes bot tasks into a tree structure for better modularity and scalability.

    Project Structure

    The project is divided into packages that represent different levels of the tree hierarchy: high-level branches, low-level branches, and leaves.

    Packages and Classes

    highBranch

    CombatBranch.java: This class represents a high-level branch in the tree structure. It contains logic for combat-related tasks and aggregates lower-level branches like MeleeCowBranch and RangeCowBranch.

    SkillingBranch.java: This class represents a high-level branch for skilling tasks and aggregates branches like MiningBranch and WoodcuttingBranch.

    leaves

    AttackCowMeleeLeaf.java: This leaf class handles the logic for attacking cows using melee combat.

    AttackCowRangeLeaf.java: This leaf class handles the logic for attacking cows using ranged combat.

    BankInventoryLeaf.java: This leaf class handles the logic for banking inventory items.

    ChopTreeLeaf.java: This leaf class handles the logic for chopping trees.

    EatFoodLeaf.java: This leaf class handles the logic for eating food when the player's health is low.

    MineOreLeaf.java: This leaf class handles the logic for mining ores.

    lowBranch

    MeleeCowBranch.java: This branch class checks if the player has a sword equipped and contains leaves that handle eating food and attacking cows with melee.

    MiningBranch.java: This branch class checks if the player is equipped for mining and contains leaves that handle mining ores and related tasks.

    RangeCowBranch.java: This branch class checks if the player has a bow equipped and contains leaves that handle eating food and attacking cows with ranged weapons.

    WoodcuttingBranch.java: This branch class checks if the player is equipped for woodcutting and contains leaves that handle chopping trees and related tasks.

    myscript

    MyTreeScript.java: The main script class that initializes the tree structure and starts the script. It contains the root node and adds the top-level branches to it.

    Framework Overview

    The DreamBot Tree Branch Leaf framework is a hierarchical system where tasks are organized into a tree structure with a root node, branches, and leaves. Here's how the framework works:

    TreeScript: The main class that initializes the tree structure and starts the script. It contains the root node.

    Root: The top-level node that contains branches.

    Branches: Intermediate nodes that contain other branches or leaves.

    Leaves: The executable actions or tasks.

    Execution Flow

    The TreeScript class initializes the root node and adds top-level branches.

    Each branch's isValid() method determines if it should be executed.

    If a branch is valid, it iterates through its leaves to find a valid leaf.

    The first valid leaf's onLoop() method is executed.

     

    PLEASE NOTE THIS EXAMPLE IS OVER SIMPLIFIED FOR LEARNING PURPOSES

    Edited by Deep Slayer
    Update

    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 account

    Sign in

    Already have an account? Sign in here.

    Sign In Now
    ×
    ×
    • 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.