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
  • Want to script


    Exoskill

    Recommended Posts

    Hello... im new here and i have some programming knowledge. I want to see if anybody can provide me with answer on writing a simple script. Walking, Magic Casting, Banking, Eating. Basic stuff. Maybe a function or two. First I have to setup a IDE. Build paths and such. Im not much of a script kidde as i do understand most code i research. Lend me a Hand and point me to the right direction. Thanks xD

    Link to comment
    Share on other sites

    On 8/21/2021 at 6:37 PM, Pandemic said:

    Hey there, check out our Scripter Guides: https://dreambot.org/guides/scripter-guide/starting/

    It has a few tutorials to get you up and running :) 

    Okay this is very helpful. Thank you. Yet I have had a problem of some of the import class not found in the external JAR.

    ~[C:\Users\Odin\DreamBot\BotData] ~ client.jar is what was missing... xD

     

    On 8/21/2021 at 7:03 PM, Sikovit said:

    I also recommend Visual Scripting by @Hashtag if you're new to OSRS scripting.
    No coding knowledge required!

    Yes I seen something like this around. I was really hoping to get my hands on such technology.

    On 8/22/2021 at 7:35 AM, Axolotl said:

    Use scripts from the local SDN as reference and there is an amazing search tool within their javadocs to find pre built functions: https://dreambot.org/javadocs/overview-summary.html

    My first objective is to create zamorak wine telegrab

    14 hours ago, Hosfad said:

    @Exoskill if you need help with anything hit me up brother 

    Desired outcome : start at bank with 5 lobster, walk to temple, 2 sqaure away from door, no roofs, cast_spell, eat if hp 25%, full inv, bank repeat stop when no lobster left.

    Link to comment
    Share on other sites

    Step 1:  setup the way you want to do your checking..

     

    Ok so think of it this way: Every action has a condition that should be met, so your script is a conditional ladder.

    You could use 1 of the following methods for this:

    - States as an Enum + Checker Method (mostly used by beginners, I don't recommend it in future scripting as it goes through 3-4 conditionals before reaching execution)

    - Nodes

     - States as derived objects from a parent State class that has an abstract conditional method and an abstract action method (Polymorphism)

     

    public abstract class State {
    
    	public abstract boolean verify();
    	
    	public abstract void execute();
    
    }
    
    public class Eat extends State {
    
    	public boolean verify() {
    		return ...getHealthPercentage() < 20; 
    	}
                                                 
        public void execute() {
           //Check inventory for food items (has action Eat for an example)
           //Interact with a sleepUntil conditional (ex: sleepUntil health is higher than what it is)                                      
        }
    
    }
                                                 
    //Then initialize the states (in order, so like walking before fighting) in onStart and add them into an ArrayList          
             
    //loop through the states
        for(State state : states) {
          if(state.verify()) state.execute(); //you can break; after the execute invocation if there aren't any needed actions after this state
        }
              

    ..something like that..

    Step 2) Read the DreamBot API and use the methods there to do what you want

    so like for eating.. go to the Inventory class in the DreamBot API.. look at the methods there

    so think about it.. what do you need first? to check if there is food! well you could use the contains method or the hasAction method to loop through the inventory items and get an item with the action "Eat"

    what then? you need to interact with it.. items are objects of the class Item.. go to the class Item in the API.. can you find a method useful for interaction? no? scroll down and read the inherited methods from the parent classes.. there you are! the interact() method! ely pzly!

     

    I hope this helps!

     

    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.