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
  • Try asking for help in the chatbox
  • Scriping Wrapper - Easy set-up to start Scripting


    DtohhM8
     Share

    Recommended Posts

    DREAMBOT EASY | SCRIPTING FRAMEWORK

    SCRIPTING MADE EASY

    Current Status: Has Inheritance Issues - Will Release updated fix soon. (NOT WORKING)

    =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

    Please excuse the layout - the spoilers will not seem to work.

    Open the first one to read the contents.

    =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

    What is it:

     

     

     

    DBE is a wrapper for any Script using Dreambot. It allows for precise maintainability in code and OOP approaches.

    Its flexibility allows you to create ideas and reuse ideas by implementing them as libraries. For example, you could write a banking library and use it in any script.

    Libraries gain direct up-to-date data from the API by using the getProvider() method, giving you the ability to cross thread.

     

    Why use it:

     

     

     

    The wrapper is designed to build an easy to use environment for your Scripts. With an OOP approach so you can build functionality in Libraries to re-use at a later date, the Wrapper is perfect for beginners who are learning to code and for experts who want to re-use content across the board making development simple.

     

    How to download it and set it up:

     

     

     

    You can download it via GitHub. Simply clone and download it or follow the README for VCS.

     

    Tutorial on how to create a simple walking library:

     

     

     

    Start by creating a new Class and calling it Walker inside of the `dreambot.libs` package.

    package dreambot.libs;
    
    import org.dreambot.api.methods.map.Area;
    import org.dreambot.api.methods.map.Tile;
    import org.dreambot.api.wrappers.interactive.NPC;
    
    public class Walker extends Library {
        private int lenOfTime = 6000 * 60; // 1 Hour to walk to the Location
    
        public void walkTo(Tile t) {
            // This only walks to the next point in the WebWalker
            // So we'll have to loop this in the Script until playerIsAtTile() or playerIsInArea()
            // Depending on how exact you want it to be
            getProvider().getWalking().walk(t);
            getProvider().sleepUntil(() -> !getProvider().getLocalPlayer().isMoving(), lenOfTime);
        }
    
        public boolean playerIsAtTile(Tile t) {
            return getProvider().getLocalPlayer().getTile().equals(t);
        }
    
        public boolean playerIsInArea(Area a, Tile t) {
            return a.contains(getProvider().getLocalPlayer().getTile()) && getProvider().getLocalPlayer().getTile().distance(t) <= 20;
        }
    }

    Navigate to your `dreambot.main` package and open the Main Class. Search for and append your new Library:

    public ArrayList<Class<? extends Library>> libs = new ArrayList<>(Arrays.asList(
    	Walker.class,
    ));

    Navigate, in the same package, to your Script class. Here we will add the logic for our Script to walk to a location.

    public class Script extends Provider {
    
    	Walker walkerLib; // Create a local variable for our Library
    
        public Script(Main provider) {
            super(provider);
        }
    
        @Override
        public void onStart() {
            // Instance and store the library
    		walkerLib = getProvider().getLibInstance(Walker.class);
    		// getProvider() allows us to get the Main class
    		// getLibInstance() allows us to get any lib inside our libs array
        }
    
        @Override
        public int onLoop() {
        	// Add your own x,y,z values
    		if(! walkerLib.playerIsAtTile(new Tile(x, y, z)) {
    			// The walkTo method will walk to a WebWalker tile each loop
    			// We wrap it in an If statement because it will talk multiple loops to walk to the location
    			walkerLib.walkTo(new Tile(x, y, z));
    		}
    
            // Return a short delay
            return Calculations.random(100, 300);
        }
    
        @Override
        public void onExit() {
    
        }
    }

     

     

    If you experience any bugs, or want to offer any improvements or update ideas: please leave a comment below.

    Happy Scripting.

     

     

     

     

    Edited by DtohhM8
    Added layout issue heading
    Link to comment
    Share on other sites

    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
     Share

    ×
    ×
    • 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.