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
  • Simple Potion Maker


    zang

    Recommended Posts

    This script can be used to make any potion as well as wines. Currently it's hard coded to make antifire potions but all you need to do is change the item ids of  unf,dust,anti to ingredient 1, ingredient 2, and fished potion respectively.It is coded so that it will also pick items that are in adjacent item slots. This is my first released script so it may be buggy and get you banned. So use at your own risk! I may or may not add in a paint later on.

    How to use:

    1. Set Item Id's to desired usage

    2. Stand in front of any bank with an empty inventory. (Recommend you have default withdraw amount set to X) 

    3. Press Start

    import java.util.Random;
    import org.dreambot.api.script.AbstractScript;
    import org.dreambot.api.script.Category;
    import org.dreambot.api.script.ScriptManifest;
    import java.awt.*;
    /**
     *
     * @author Zang
     */
    @ScriptManifest(category = Category.HERBLORE, name = "Antifire", author = "zang", version = 1.0)
    public class Main extends AbstractScript  
    {
        int unf = 2483;  //The unfinished potion
        int dust = 241;  //The second ingrediant
        int anti = 2454; //The finished potion
        Random rand = new Random();
        
        
        
        public void onStart()
        {
                     
        }
        public int onLoop()
        {
                if(getInventory().count(anti) == 14)
                {
                    if(!getBank().isOpen())
                        if(getBank().open())
                        {
                            sleep(rand.nextInt(187)+600);
                            getBank().depositAllItems();    
                        }
                    sleep(rand.nextInt(187)+600);
                    if(rand.nextInt(2) + 1 == 1)
                    {
                        getBank().withdraw(dust,14);
                        sleep(rand.nextInt(187)+600);
                        getBank().withdraw(unf,14);
                        sleep(rand.nextInt(187)+600);
                        getBank().close();
                    }
                    else
                    {
                        getBank().withdraw(unf,14);
                        sleep(rand.nextInt(187)+600);
                        getBank().withdraw(dust,14);
                        sleep(rand.nextInt(187)+600);
                        getBank().close();
                    }
                    
                }
                if(getInventory().getEmptySlots() == 28)
                {
                    if(!getBank().isOpen())
                        getBank().open();
                    int first = rand.nextInt(1) + 1;
                    if(first == 1)
                    {
                        getBank().withdraw(dust,14);
                        sleep(rand.nextInt(187)+600);
                        getBank().withdraw(unf,14);
                        sleep(rand.nextInt(187)+600);
                        getBank().close();
                        
                    }
                    else
                    {
                        getBank().withdraw(unf,14);
                        sleep(rand.nextInt(187)+600);
                        getBank().withdraw(dust,14);
                        sleep(rand.nextInt(187)+600);
                        getBank().close();
                    }
                }
                if(getInventory().count(unf) == 14  && getInventory().count(dust) == 14)
                {
                    randPot(rand.nextInt(1) + 1);
                    sleep(rand.nextInt(100)+700);
                    if (getWidgets().getWidget(270).getChild(14) !=null)
                     if(getWidgets().getWidget(270).getChild(14).interact())
                         sleep(rand.nextInt(187)+600);
                    
                }   
            return 600;
        }
        
        
        @Override
        public void onExit()
        {
    
        }
    
        @Override
        public void onPaint(Graphics graphics)
        {
            
        }
        
        public void randPot(int x)
        { 
            int start;
            int edge = rand.nextInt(3);
            int[] pos1 = new int[]{14,16,17,18};
            int[] pos2 = new int[]{9,10,11,13};
            
            if(x == 1)
                start = rand.nextInt(13) + 9;
            else
                start = rand.nextInt(18) + 14;
            if(start == 9)
                getInventory().getItemInSlot(9).useOn(getInventory().getItemInSlot(14));
            if(start == 10)
                getInventory().getItemInSlot(10).useOn(getInventory().getItemInSlot(rand.nextInt(1)+14));
            if(start == 11)
                getInventory().getItemInSlot(11).useOn(getInventory().getItemInSlot(rand.nextInt(1)+14));
            if(start == 12)
                getInventory().getItemInSlot(12).useOn(getInventory().getItemInSlot(rand.nextInt(1)+16));
            if(start == 13)
                getInventory().getItemInSlot(13).useOn(getInventory().getItemInSlot(pos1[edge]));
            if(start == 14)
                getInventory().getItemInSlot(14).useOn(getInventory().getItemInSlot(pos2[edge]));
            if(start == 15)
                getInventory().getItemInSlot(15).useOn(getInventory().getItemInSlot(rand.nextInt(1)+10));
            if(start == 16)
                getInventory().getItemInSlot(16).useOn(getInventory().getItemInSlot(rand.nextInt(1)+12));
            if(start == 17)
                getInventory().getItemInSlot(17).useOn(getInventory().getItemInSlot(rand.nextInt(1)+12));
            if(start == 18)
                getInventory().getItemInSlot(18).useOn(getInventory().getItemInSlot(13));    
        }
        
    
        
    }

     

    Link to comment
    Share on other sites

    Good job on the release, keep at it. 

     

    You ought to really look at dynamic sleeping though, as well as revising most of the logic, and also Java conventions, it's quite difficult to read due to the messy structure.

     

    I've just taken 5 minutes to mash together a version of my own, it's neither tested nor fool proof, just thinking it may provide some guidance on the use of dynamic sleeping/slightly better logic (I say slightly better as what I've written up isn't perfect/totally logical sound).

    	import org.dreambot.api.script.AbstractScript;
    import org.dreambot.api.script.Category;
    import org.dreambot.api.script.ScriptManifest;
    	@ScriptManifest(category = Category.COMBAT, name = "Example of an item combiner", author = "Pseudo", version = 0.1)
    public class ExampleCombiner extends AbstractScript {
    	    private static final String INPUT_ONE = "Vial of water";
        private static final String INPUT_TWO = "Guam leaf";
    	
        public void onStart() {
            log("Welcome to the example combiner, bae");
        }
    	    @Override
        public int onLoop() {
            if (!getInventory().contains(INPUT_ONE, INPUT_TWO)) { //Inventory doesn't contain at least one of our necessary items
                if (getBank().isOpen()) {
                    if (!getInventory().isEmpty()) {
                        if (getBank().depositAllItems()) { //Deposit our inventory contents (we don't have the right resources from the above check)
                            sleepUntil(() -> getInventory().isEmpty(), 3000); //Wait until we have no items in our inventory (3 second time out)
                        }
                    } else { //Inventory is empty, lets withdraw our items (note this isn't necessarily foolproof as if we fail to withdraw both input items, we may get stuck)
                        if (getBank().withdraw(INPUT_TWO, 14)) {
                            sleepUntil(() -> getInventory().contains(INPUT_TWO), 3000); //Wait until we successfully pull the item to our inventory (3s time out)
                        }
                        if (getInventory().contains(INPUT_TWO)) {
                            if (getBank().withdraw(INPUT_ONE, 14)) {
                                sleepUntil(() -> getInventory().contains(INPUT_TWO), 3000); //Same logic as above
                            }
                        }
                    }
                } else {
                    if (getBank().open()) //Utilising the boolean value of open
                        sleepUntil(() -> getBank().isOpen(), 5000); //Wait until bank is open (5s timeout)
                }
            } else {
                if (getBank().isOpen()) getBank().close(); //If bank is open we can't do our interactions, close it.
    	            int inputCount = getInventory().get(INPUT_ONE).getAmount();
    	            if (getInventory().get(INPUT_ONE).useOn(INPUT_TWO)) {
                    sleepUntil(() -> getInventory().get(INPUT_ONE).getAmount() < inputCount, 3000); //Sleep until our input items has reduced by one
                } //Note above isn't necessary and can be revised if you intend on spam clicking to combine (simply iterate over inventory slots)
            }
            return 100;
        }
    }
    

     

    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.