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
  • is there any way to make custom parameters in quickstart and utilize it in script ?


    drdr444

    Recommended Posts

    i want to make custom parameters in quickstart and make use of them by like Run-Time Type Information.

    for example , if param 1 is set as patternA, a script attacks monsterA, 

    and if param 1 is set as patternB, the script attacks monsterB.

    in short, i want to run the same script differently depending on quickstart parameters,

    so that i dont have to make many simular scripts.

    if it is possible, plz show me some exaple codes.

    thanks in advance.

    Link to comment
    Share on other sites

    yeah you can easily pass params from quickstart to your onStart method in your script

     

    Script setup (write your own code to handle the things you mentioned, this is just showing you how to pass the params)

    public void onStart(String... params) {
            for (String param : params) {
    			System.out.println(`Passed parameter: ${param}`);
    		}
    
    		onStart(); // Calling your default on start if you also plan on using this script without parameters
    }
    
    public void onStart() {
    	// code you use with and without parameters (starting GUIs, kicking off establishing external connects etc)
    }




    CLI Command building

    official docs are pretty POG -> https://dreambot.org/guides/user-guide/quickstart/#available-parameters
     

    In the 'Available Parameters' section of that post you'll see a flag called '-params' these are the params that get passed to your new onStart(String .. params){} method you added to your script.  
     

    java -jar C:\Users\YOURNAME\DreamBot\BotData\client.jar -script "Test Script" -params Param1 Param2 Param3


    simple as that~

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