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
  • [EDU] Basic Scripting all you need to start coding!


    Tommy5K

    Recommended Posts

    ONl9K1V.png

     

    So the reason I am posting this tutorial guide is because I still get a comments and PM's on the daily people asking how to do specific things so I thought i'd create the post clearing up the basics and other API's just so you new scriptwriters have something to refer back to, and it's also interesting thing to work on in my spare time. Also this hopefully cuts down the use of the support guide by meshing everything into one thread if you have any feed back also please leave it below it would benefit me on what to add on in the long run etc.

     

    g7BOVHq.png

    Firstly to start off this tutorial we've got to explain how to setup the work space for you to begin coding your scripts, this is often really easy if you have setup the script once before but if not this could be found as a tedious and difficult task, most people that I know who are on this thread use one of two things:

    - IntelliJ: Download Link

    - EclipseDownload Link

     

    These programs are classed as Java IDE's if you have never coded before in your life I suggest learning the basics and coming back to this thread you can learn Java on the internet these days just by the click of a button so I recommend doing so before installing ONE of these programs.

     

    What is an IDE and what does it do?

    The most blatant and easiest way to explain what an IDE is it's a program that helps you code your programs with multiple integrated actions such as Auto corrector, Error Finders, Text finder and other things to aid you while you begin to script / code.

     

    IDE also stands for Integrated Development Environment if you were ever wondering if I have gone in enough detail you can learn more about it on the wiki page here:

    IDE Wiki Link

     

    Installing IntelliJ:

     

    Installing IntelliJ IDE on your computer is simple, navigate to the website link I have left above:

     

    AeQYvNQ.png

     

    Click The Download that the red arrow is pointing to, to download the IntelliJ IDE

     

    If you are needing to change extension because of whatever reason you are not using windows or other operating systems that support the .exe extension you can choose it to your main supported file extension here!

     

    You can then open the file the and run the setup the same way you would with any other program found on the internet that you have installed.

     

    Install Eclipse IDE:

     

    The Eclipse IDE is a tiny bit more complicated but still rather easy to understand, Click on the link above and you will be navigated to this web page here:

     

    kSxkcHr.png

     

    You can download the launcher here and then just run it like every other setup!

     

    The other Packages supporting different Operating Systems can be found at the "Download Packages" link, The installers can be found here:

    Ut3eXx8.png

     

    You then open the setup and run the installer when you get to the page of packages install the Eclipse IDE for Enterprise Java Developers which can be found here:

     

    WrGplzQ.png

    ZkBTBhP.png

     

     

    Click the Install and Leave it to Install but also Agree to the TOS that usually shows half way through the installation!

     

    after that start up the Eclipse IDE and create a work space and either choose your file path or just leave it how it is and create it and leave it to load the IDE.

     

    TfAPrpt.png

    In here is all you need to know about setting up your scripts as it this is one of the most vital parts about your scripts as it implements the Dream bot API:

     

    nXAwTfb.png

     

    Right-Click on the Package Explorer hover over the new and click the "Java Project" you will be greeted with a GUI with a bunch of features but don't be worried by it.

    This is going to be the main area where you are going to make your script

    Choose a name for your folder of your script and click finish. 

     

    O4ej9jV.png

     

    Once we have done this we need to Reference the Dream bot Client.jar because that's what holds the API scripts and methods etc.

    we do this by right clicking on the newly made java project and go down to build path and hover over it and click on "Add External Archives" then find the client.jar on the Dream bot this is found in the C:/users/(ComputersName)/DreamBot/BotData/Client.jar

    And now we need to make a Class in the src package of our Java Project we do this by doing it the same way as we added the Java project Folder in the First place by right clicking on the Src and hover over new and click on Class and give it a name like "Main" or something and then click Finish.

    This will give you a new view on the middle of your screen with some text looking like this 

     

    public class YourScriptsName {
    
    }

     

    We want to change this to access the API Scripts we do this by extending it to a Dream bot Abstract script, Replace your code with this. 

     

    import org.dreambot.api.script.AbstractScript;
    
    public class Main extends AbstractScript {
      
    }

     

    If you are using IntelliJ I followed this Youtube video by a member on the Website if anyone knows who he is I'll give him a Shout out on the thread for the video!

     

    We can now get to Scripting!

     

    WK4IWsA.png

     

    Firstly We also want to add a Category Manifest at the top of our script just to explain the name of the person who made the script and what the script does and what version is it on and so on and so fourth, we can resolve this but add the top of your script above the main class file add this:

     

    @ScriptManifest(author = "Poly", name = "Potato Picker", version = 2, description = "This script helps you pick potatoes.", category = Category.MAGIC)

    This will be placed just above where we implemented the Dream bot API like this:

    import org.dreambot.api.script.AbstractScript;
    
    @ScriptManifest(author = "Change-this-to-your-name", name = "Change-to-name-of-your-script", version = 2, description = "Change-to-description-of-what-your-bot-does!", category = Category.MONEYMAKING)
    
    public class Main extends AbstractScript {
      
    }

    The script category can be changed at the end to any skill you want you can find these scripts by backspacing all the letters just past the period and then re-add the period it will show you all general categories your script can be about!

     

    we also need to add the imports:

    import org.dreambot.api.script.Category;
    import org.dreambot.api.script.ScriptManifest;

    At the top of your script where the Abstract Script import is.

     

    We also need to add some public voids into our script we add them but just typing in between the two parenthesis that is found on Main Extends Abstract Script like so:

     

    import org.dreambot.api.script.Category;
    import org.dreambot.api.script.ScriptManifest;
    import org.dreambot.api.script.AbstractScript;
    
    @ScriptManifest(author = "Change-this-to-your-name", name = "Change-to-name-of-your-script", version = 2, description = "Change-to-description-of-what-your-bot-does!", category = Category.MONEYMAKING)
    
    public class Main extends AbstractScript {
      
      	@Override
    	public void onStart() {
    
    	}
    	
      	@Override
    	public int onLoop() {
    	
    	return 600;
    	}
    
      	@Override
    	public void onExit() {
    	
    	}
    
    }

    The Public int onLoop() HAS to have return 600; (or any other amount) in it because it's a public int which is unlike all the other voids

    We now need to add a log on when the script started in the OnStart() method to explain in the debug console that the Script has started

    we do this by adding:

     

    public void OnStart() {
    	log("Script has now Started!");
    	}

    I also like to add a little flare to my log scripts just because I can like this:

     

    public void onStart() {
    		log("-----------------------PolyAutoScript----------------------");
    		log("Starting PolyAutoScript Script...");
    		log("The script is currently in it's Early Release!");
    		log("So if there is any bugs I recommend posting them to");
    		log("The PolyAutoScripter Thread, Thank you!");
    		log("------------------------------------------------------------------");
    	}

     

    But that is your own choice if you do so or not.

    We also can add one on the OnExit() method this can explain when the script is ending or stopping in the Debug Console we do this like this:

     

    public void onExit() {
    		log("----------------------------------------------------");
    		log("   Stopped PolyAutoScript...");
    		log("----------------------------------------------------");
    	}

    I also fancied mine up like this because of the blatant fact of cause I can in this one.

     

    from here is where we started coding whatever script we are doing, I am not going to code a full script in this thread I am just going to add how to add API's in-depth such as auto casting or how to use widgets etc. this will help guide you through without issues hopefully on how to use them.

     

    I will Implement a lot more shortly!

     

    nHd1Kl1.png

     

    If you are planning on making private scripts to bot heavily I recommend buying a private proxy as if you bot with your account on a day to day basis you will be found and banned and if you are not using one of these proxies your IP will be flagged and it is never nice knowing that the Jagex team are checking up on your new accounts ensuring you are a botter equalling in faster bans on different accounts.

     

    I am going to enter two methods of getting proxies to help ensure longer account survival and less chance of your IP getting logged.

     

    Method #1:

    You can buy multiple proxies from different websites really cheaply over the internet what we are looking for is a IPV4 SOCKS Proxy for the proxy to work on Dream bot and mostly other bots if you are using those - which I highly recommend sticking to Dream bot for that premium beauty :P shout-out Dreambot Aha - 

    You can buy these proxies at websites like:

    Proxy6.net

     

    These are nice cheap proxies with good ping times meaning you won't ensure a lot of lag in your botting times you can also get a percentage off using the referral code:

    "Eduardino" For 5% off your purchases from the botting Youtuber: Eduardino I recommend you watch for all your botting needs!

     

    Method #2:

    This one is a little more in-depth so you are better off focusing on buying a proxy instead but if you don't have the money to buy one you can always use this method here:

    1. Go To the Website: Google Console Developers

    2. Create a new Account on the page

    3. Create a New Project once in your account

    4. Once that is complete you can create a VPS by going on the side menu and clicking "Compute" then VM instances

    5. Choose the region close to you!

    6. Make sure you select 13GB 2 Core Processor.

    Which can be found here: Screenshot Link

    7. Then wait a Minute or 2 as the VM instance creates itself.

    8. Then click "Connect RDP" Button

    9. Wait a Couple of seconds and once you are connected go to Internet Explorer and Download Firefox as it has no Security Options or Disable the Internet Security Options on the Internet Options Tab on the Browser and then Install Java and the DreamBot Launcher and use it like normal.

    This will have a new IP and one that cannot be traced back to you, you can also use this method to run RSPS's and other methods as it is a free VPS all you need it you Credit Card Details (It won't Automatic Charge you after Trial is up) this should give you a few months of botting time until you redo the process to get it for free again at a later date. I hope that was easy enough to understand for you guys!

     

    Link to comment
    Share on other sites

    4 hours ago, Tommy5K said:

    JavaScript

    Nice work on the tutorial, very well presented and concise, just wanted to point out that JavaScript and Java are two very different things, so you may want to modify that in the guide!

    Link to comment
    Share on other sites

    21 minutes ago, Pseudo said:

    Nice work on the tutorial, very well presented and concise, just wanted to point out that JavaScript and Java are two very different things, so you may want to modify that in the guide!

    Yes I know I didn't mean to do that as noticed by the Script having a Capital but I'll resolve it on the Next update I know JavaScript is just all text and Java code needs to be recompiled had that argument with a guy on Armedunity website a unity game based website so I've basically contridicted myself by writing Javascript in stead of Java RIP

    Link to comment
    Share on other sites

    Nice guide so far, although you have a couple problems in your code. 

    public class Main extends AbstractScript {
      
    	public void OnStart() {
    
    	}
    
    	public int onLoop() {
    	
    	return 600;
    	}
    
    	public void OnExit() {
    	
    	}
    
    }

    should be:

    public class Main extends AbstractScript {
      	@Override
    	public void onStart() {
    
    	}
      
    	@Override
    	public int onLoop() {
    		return 600;
    	}
      
    	@Override
    	public void onExit() {
    	
    	}
    }

    The method names are incorrect, ie: OnStart should be onStart. Also, you should always use the override annotation when you are overriding a method, which would prevent the first problem from occurring. It will check the super class for a method named OnStart and would give an error when it doesn't find it.

    Link to comment
    Share on other sites

    Forgot to Overrides damn it aha one sec refix

    edit:

    Done it and added the capitals I don't know why I honestly forgot that.

    Link to comment
    Share on other sites

    as someone who has a very brief understanding of scripting (i can tell what stuff does by looking at it) - This is a very well presented guide :)

    Link to comment
    Share on other sites

    • 2 months later...
    2 hours ago, carter23 said:

    Who gives a fuck about annotating @override on the methods, as long as the subclass'es method name is the same then it will override it regardless

    You're right, it's not required. However, if you accidentally write the method name wrong, you might have hard time figuring out why your code doesn't work as you expected. If you had that annotation, most IDEs will underline it in red and tell you there is no such method to override. Also, when you look at your source code after a long time, it doesn't take you any extra time to understand it's an overridden method. If you work in a team, they'll understand it too. It's good practice.

    Link to comment
    Share on other sites

    Archived

    This topic is now archived and is closed to further replies.

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