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
  • Computor's Cannonball Smither


    Computor

    Recommended Posts

    Posted

    Hey all,

    I started by making a cannonballer for myself, but I've seen a few people ask for one, so I'm releasing mine. I won't be developing this script further. If I write a script for the SDN it will be a full AIO smither. This script was simply made for my own purposes. It should work pretty flawlessly. If it doesn't start right away, just wait (it's working on a timer, so give it 30 seconds to start smithing).

     

    WARNING: This bot will run your client memory really high (it's storing lots of data for the antiban, I could fix, but cbf because I have enough RAM).

    (Will run at 1000+ mb sometimes.)

     

    Features:

    Crappy paint (only shows total bars made)

    Strong antiban (has lots of random antiban stuffs)

    ONLY WORKS AT NEITIZNOT (no walking methods, works because furnace/bank are so close to each other).

     

    Link to jar: https://mega.co.nz/#!FkdRRBZJ!sbyNH1SxhNL_P9mvvGq-Q-f5qd2_NMNgz5YJXeeC23k

     

    Main Code:

     

     

    package Smither;
    
    import org.dreambot.api.methods.Calculations;
    import org.dreambot.api.script.AbstractScript;
    import org.dreambot.api.script.Category;
    import org.dreambot.api.script.ScriptManifest;
    import org.dreambot.api.wrappers.interactive.GameObject;
    import org.dreambot.api.wrappers.widgets.WidgetChild;
    import org.dreambot.api.utilities.Timer;
    
    import java.awt.*;
    import java.util.List;
    
    @ScriptManifest(name = "test", author = "test", description = "", version = 1, category = Category.MISC)
    public class testSmither extends AbstractScript {
    	public static final Object ANTIBAN_LOCK = new Object();
    	private Thread antiThread;
    	boolean timeToBank = false;
    	boolean timeToSmelt = false;
    	Anti anti;
    	Timer timer;
    
    	@Override
    	public void onStart() {
    		timer = new Timer();
    		anti = new Anti(this);
    		antiThread = new Thread(anti);
    		antiThread.start();
    	}
    
    	@Override
    	public int onLoop() {
    		synchronized (ANTIBAN_LOCK) {
    
    			List<WidgetChild> widgetChildList = getWidgets().getWidgetChildrenContainingText("Steel bar");
    			if (!widgetChildList.isEmpty()) {
    				if(widgetChildList.get(0).interact("Make All")){ //THANK YOU ART FOR THIS IDEA/CODE
    					anti.bar = 30;
    					anti.timeToSmelt = true;
    					sleep(4000,6000);
    					timeToSmelt = false;
    				}
    			}else{
    				if(!timeToBank && !getLocalPlayer().isMoving() && getLocalPlayer().isStandingStill() && timeToSmelt){
    					GameObject furnace = getGameObjects().getClosest(21303);
    					if(furnace.isOnScreen()){
    						getInventory().interactWithItem("Steel bar", "Use");
    						furnace.interact("Use");
    						sleep(800,900);
    						timeToSmelt = false;
    					}else {
    						getCamera().mouseRotateToEntity(furnace);
    						sleep(200);
    					}
    				}
    			}
    		}
    		return Calculations.random(100, 200);
    	}
    
    	public void banking(){
    		if(getBank().isOpen() && timeToBank){
    			timeToSmelt = true;
    			if (getBank().getItem("Steel bar").getAmount() < 27){
    				stop();
    			}
    			if(getInventory().contains("Cannonball")){
    				getBank().deposit("Cannonball");
    			}
    			if(!getInventory().contains("Ammo mould")){
    				getBank().withdraw("Ammo mould", 1);
    			}
    			if(getInventory().contains("Ammo mould") && getInventory().getCount("Steel bar") <= 27){
    				getBank().withdraw("Steel bar");
    			}
    			if(getInventory().getCount("Steel bar") == 27){
    				getBank().close();
    				anti.bar = 30;
    				anti.timeToSmelt = true;
    				timeToSmelt = true;
    				timeToBank = false;
    			}else{
    				getBank().depositAll();
    			}
    		}else if(timeToBank && !getLocalPlayer().isMoving()){
    			timeToSmelt = true;
    			GameObject bank = getGameObjects().getClosest(21301);
    			bank.interact("Use");
    			anti.bar = 30;
    			anti.timeToSmelt = true;
    			sleep(800,900);
    		}
    	}
    
    	public void onPaint(Graphics2D g) {
    		g.drawString("Bars made: " + anti.barCount, 200, 240);
    	}
    
    	@Override
    	public void onExit() {
    		anti.kill();
    		antiThread.interrupt();
    		try {
    			antiThread.join();
    		} catch (InterruptedException e) {
    			e.printStackTrace();
    		}
    		antiThread = null;
    
    	}
    } 

     

     

     

    Antiban Code:

     

     

    package Smither;
    
    import java.awt.Rectangle;
    import java.util.ArrayList;
    import java.util.List;
    import java.util.Random;
    import java.util.concurrent.atomic.AtomicBoolean;
    
    import org.dreambot.api.methods.MethodProvider;
    import org.dreambot.api.methods.tabs.Tab;
    import org.dreambot.api.utilities.Timer;
    import org.dreambot.api.wrappers.interactive.GameObject;
    import org.dreambot.api.wrappers.widgets.WidgetChild;
    
    class Anti implements Runnable {
    	int bar = 30;
    	int antiType;
    	int bar1 = 0;
    
    	int first = 0;
    	int second = 0;
    	int barCount = 0;
    	GameObject furnace;
    	Rectangle randomSpotToMove = new Rectangle(0,0,764,502); //xPos,yPos,width,height
    	boolean timeToSmelt = true;
    	boolean antiBanTime = true;
    
    	//multithreading
    	private testSmither s;
    	Timer t = new Timer(15000);
    	private AtomicBoolean running = new AtomicBoolean(true);
    	public Anti(testSmither mainclass) {
    		s = mainclass;
    	}
    	//multithreading
    
    	@Override
    	public void run() {
    		while(running.get()) {
    			synchronized (testSmither.ANTIBAN_LOCK) {
    				loop();
    			}
    		}
    	}
    
    	private void loop() {
    
    		first = s.getInventory().getCount("Steel bar");
    		if(first < second){
    			barCount++;
    		}
    		second = s.getInventory().getCount("Steel bar");
    
    		try {
    			if(!s.timeToSmelt){
    				List<WidgetChild> widgetChildList = s.getWidgets().getWidgetChildrenContainingText("Steel bar");
    				if (!widgetChildList.isEmpty()) { //clicks continue on ANY "click here to continue" option
    					widgetChildList.get(0).interact("Make All"); //THANK YOU ART FOR THIS IDEA/CODE
    					MethodProvider.sleep(300, 600);
    				}
    			}
    
    			if(s.getInventory().getCount("Steel bar") < 27){
    				timeToSmelt = false;
    			}else{
    				timeToSmelt = true;
    				s.timeToSmelt = true;
    			}
    
    			if(s.getInventory().isEmpty() || s.getInventory().getCount("Steel bar") < 1 || !s.getInventory().contains("Ammo mould")){
    				s.timeToBank = true;
    			}else{
    				s.timeToBank = false;
    			}
    
    
    			if(s.timeToBank){
    				s.banking();
    			}
    
    
    			if(!timeToSmelt){
    				if(t.remaining() < 0){
    					antiBanTime = false;
    					MethodProvider.log("Timer done");
    					bar1 = s.getInventory().getCount("Steel bar");
    					if(bar1 >= (bar-1)){
    						furnace = s.getGameObjects().getClosest(21303);
    						if(furnace.isOnScreen()){
    							s.getInventory().interactWithItem("Steel bar", "Use");
    							furnace.interact("Use", true);
    						}else{
    							s.getCamera().rotateToEntity(furnace);
    							s.getInventory().interactWithItem("Steel bar", "Use");
    							furnace.interact("Use", true);
    						}
    					}
    					MethodProvider.log("Timer start over");
    					t.reset();
    					bar = s.getInventory().getCount("Steel bar");
    					antiBanTime = true;
    				}
    			}
    
    			//antiban
    			if(!s.timeToBank && !s.timeToSmelt){
    				antiType = randInt(1,100);
    				switch (antiType) {
    					case 1: //move mouse to random location on screen
    						s.getMouse().move(randomSpotToMove); //move to random location in rectangle
    						break;
    
    					case 2: //mouse rotate camera to random place
    						s.getCamera().mouseRotateTo(randInt(1, 2041), randInt(128, 383)); //move camera random place
    						break;
    
    					case 3: //camera to random place
    						s.getCamera().rotateTo(randInt(1, 2041), randInt(128, 383)); //move camera random place
    						break;
    
    					case 4: //if random object has an examine option, examine it
    						getObject("Yes");
    						break;
    
    					case 5: //right click a random object
    						getObject("");
    						break;
    
    					case 6: //move mouse to random location on screen 1-5 times
    						int iCount = 0;
    						int random;
    						random = randInt(1,5);
    						while(iCount <= random){
    							s.getMouse().move(randomSpotToMove); //move to random location in rectangle
    							MethodProvider.sleep(50, 600);
    							iCount++;
    						}
    						iCount = 0;
    						break;
    
    					case 7: //rotate with mouse, then arrow keys
    						s.getCamera().mouseRotateTo(randInt(1, 2041), randInt(128, 383)); //move camera random place
    						MethodProvider.sleep(50, 600);
    						s.getCamera().rotateTo(randInt(1, 2041), randInt(128, 383)); //move camera random place
    						break;
    
    					case 8: //move mouse off screen
    						s.getMouse().moveMouseOutsideScreen();
    						break;
    
    					case 9: //open skill tab and hover a random skill
    						if(s.getTabs().getOpen() == Tab.STATS){
    							s.getMouse().move(s.getWidgets().getChildWidget(320, randInt(1,23)).getRectangle());
    							MethodProvider.sleep(800,2000);
    						}else {
    							s.getTabs().open(Tab.STATS);
    							MethodProvider.sleep(800, 1000);
    
    							if(s.getTabs().getOpen() == Tab.STATS){
    								s.getMouse().move(s.getWidgets().getChildWidget(320, randInt(1,23)).getRectangle());
    								MethodProvider.sleep(800,2000);
    							}
    						}
    
    						s.getTabs().open(Tab.INVENTORY);
    						break;
    
    					case 10: //open skill tab and hover the smithing skill
    						if(s.getTabs().getOpen() == Tab.STATS){
    							s.getMouse().move(s.getWidgets().getChildWidget(320, 18).getRectangle());
    							MethodProvider.sleep(800,2000);
    						}else {
    							s.getTabs().open(Tab.STATS);
    							MethodProvider.sleep(800,1000);
    
    							if(s.getTabs().getOpen() == Tab.STATS){
    								s.getMouse().move(s.getWidgets().getChildWidget(320, randInt(1,18)).getRectangle());
    								MethodProvider.sleep(800,2000);
    							}
    						}
    
    						s.getTabs().open(Tab.INVENTORY);
    						break;
    
    					case 11: //open a random tab
    						int tab;
    						tab = randInt(1,14);
    
    						if(tab == 1){
    							s.getTabs().open(Tab.QUEST);
    						}else if(tab == 2){
    							if(s.getTabs().getOpen() != Tab.INVENTORY){
    								s.getTabs().open(Tab.INVENTORY);
    							}
    						}else if(tab == 3){
    							s.getTabs().open(Tab.STATS);
    						}else if(tab == 4){
    							s.getTabs().open(Tab.CLAN);
    						}else if(tab == 5){
    							s.getTabs().open(Tab.COMBAT);
    						}else if(tab == 6){
    							s.getTabs().open(Tab.EMOTES);
    						}else if(tab == 7){
    							s.getTabs().open(Tab.EQUIPMENT);
    						}else if(tab == 8){
    							s.getTabs().open(Tab.FRIENDS);
    						}else if(tab == 9){
    							s.getTabs().open(Tab.IGNORE);
    						}else if(tab == 10){
    							s.getTabs().open(Tab.MAGIC);
    						}else if(tab == 11){
    							s.getTabs().open(Tab.MUSIC);
    						}else if(tab == 12){
    							s.getTabs().open(Tab.PRAYER);
    						}else if(tab == 13){
    							s.getTabs().open(Tab.LOGOUT);
    						}else{
    							s.getTabs().open(Tab.OPTIONS);
    						}
    						MethodProvider.sleep(500,2000);
    
    						if(s.getTabs().getOpen() != Tab.INVENTORY){ //opens inventory back up when done in tab
    							s.getTabs().open(Tab.INVENTORY);
    						}
    						break;
    				}
    			}
    			//end of antiban
    		}catch(Exception e) {
    			e.printStackTrace();
    			kill();
    		}
    		MethodProvider.sleep(200,500);
    	}
    
    	public void getObject(String examine){ //method for obtaining objects
    		List<GameObject> objects;
    		objects = s.getGameObjects().getObjects();
    		List<GameObject> filtered = new ArrayList<>();
    		if(objects != null) {
    			for (GameObject object : objects) {
    				if (object.isOnScreen() && object.getActions() != null && object.getActions().length > 0) {
    					filtered.add(object);
    				}
    			}
    		}
    
    		GameObject chosen = filtered.get(randInt(0,filtered.size()-1));
    		MethodProvider.log("Object: "+chosen);
    		if(chosen.isOnScreen()){
    			if(s.getClient().getMenu().isMenuVisible() && examine.equals("Yes")){
    				s.getClient().getMenu().clickAction("Examine");
    				s.getMouse().move(randomSpotToMove); //move to random location in rectangle
    			}else {
    				s.getMouse().move(chosen);
    				s.getMouse().click(true);
    				if(s.getClient().getMenu().isMenuVisible() && examine.equals("Yes")){
    					s.getClient().getMenu().clickAction("Examine");
    					s.getMouse().move(randomSpotToMove); //move to random location in rectangle
    					MethodProvider.sleep(600,900);
    				}else{
    					MethodProvider.sleep(600,900);
    					s.getMouse().move(randomSpotToMove); //move to random location in rectangle
    				}
    			}
    		}else{
    			s.getCamera().rotateToEntity(chosen);
    			if(s.getClient().getMenu().isMenuVisible()&& examine.equals("Yes")){
    				s.getClient().getMenu().clickAction("Examine");
    				s.getMouse().move(randomSpotToMove); //move to random location in rectangle
    			}else {
    				s.getMouse().move(chosen);
    				s.getMouse().click(true);
    				if(s.getClient().getMenu().isMenuVisible()&& examine.equals("Yes")){
    					s.getClient().getMenu().clickAction("Examine");
    					MethodProvider.sleep(600,900);
    					s.getMouse().move(randomSpotToMove); //move to random location in rectangle
    				}else{
    					MethodProvider.sleep(600,900);
    					s.getMouse().move(randomSpotToMove); //move to random location in rectangle
    				}
    			}
    		}
    	}
    
    	public void kill() {
    		running.set(false);
    	}
    
    	public static int randInt(int min, int max) {
    		Random rand = new Random();
    		int randomNum = rand.nextInt((max - min) + 1) + min;
    		return randomNum;
    	}
    }
    

     

     

    Posted

    How the fuck do you store 800mb of antiban data....


    
    
    					case 11: //open a random tab
    						int tab;
    						tab = randInt(1,14);
    
    						if(tab == 1){
    							s.getTabs().open(Tab.QUEST);
    						}else if(tab == 2){
    							if(s.getTabs().getOpen() != Tab.INVENTORY){
    								s.getTabs().open(Tab.INVENTORY);
    							}
    						}else if(tab == 3){
    							s.getTabs().open(Tab.STATS);
    						}else if(tab == 4){
    							s.getTabs().open(Tab.CLAN);
    						}else if(tab == 5){
    							s.getTabs().open(Tab.COMBAT);
    						}else if(tab == 6){
    							s.getTabs().open(Tab.EMOTES);
    						}else if(tab == 7){
    							s.getTabs().open(Tab.EQUIPMENT);
    						}else if(tab == 8){
    							s.getTabs().open(Tab.FRIENDS);
    						}else if(tab == 9){
    							s.getTabs().open(Tab.IGNORE);
    						}else if(tab == 10){
    							s.getTabs().open(Tab.MAGIC);
    						}else if(tab == 11){
    							s.getTabs().open(Tab.MUSIC);
    						}else if(tab == 12){
    							s.getTabs().open(Tab.PRAYER);
    						}else if(tab == 13){
    							s.getTabs().open(Tab.LOGOUT);
    						}else{
    							s.getTabs().open(Tab.OPTIONS);
    						}
    						MethodProvider.sleep(500,2000);

    You can literally write that all in one line with #values, as can you with a ton of other stuff you have.....

    s.getTabs().open(Tab.values()[randInt(1, 14)]);
    
    Posted

     

    How the fuck do you store 800mb of antiban data....

    You can literally write that all in one line with #values, as can you with a ton of other stuff you have.....

    s.getTabs().open(Tab.values()[randInt(1, 14)]);
    

    Data comes from where I get the surrounding game objects...it updates every time instead of updating once. I know I don't need to update it multiple times, but like I said in the OP, cbf to fix because my RAM can support it. Also: the client usually runs at ~300mb without loading scripts.

     

    In terms of writing the same method in the future: thanks for the tip. Otherwise, I don't give a shit, wrote the script in under 3 hours, was meant for me and only me. Try reading the OP.

    Posted

    Data comes from where I get the surrounding game objects...it updates every time instead of updating once. I know I don't need to update it multiple times, but like I said in the OP, cbf to fix because my RAM can support it. Also: the client usually runs at ~300mb without loading scripts.

     

    In terms of writing the same method in the future: thanks for the tip. Otherwise, I don't give a shit, wrote the script in under 3 hours, was meant for me and only me. Try reading the OP.

    It doesn't matter who it was written for, you should always be programming with proper technique. Your antiban class could have been used for every script you make but now you have to rewrite it every time.

     

    Also, what do you mean the data comes from surrounding game objects? I don't see anything in your code that would keep it in memory.

    Posted

    It doesn't matter who it was written for, you should always be programming with proper technique. Your antiban class could have been used for every script you make but now you have to rewrite it every time.

     

    Also, what do you mean the data comes from surrounding game objects? I don't see anything in your code that would keep it in memory.

     

     

     

    public void getObject(String examine){ //method for obtaining objects
    		List<GameObject> objects;
    		objects = s.getGameObjects().getObjects();
    		List<GameObject> filtered = new ArrayList<>();
    		if(objects != null) {
    			for (GameObject object : objects) {
    				if (object.isOnScreen() && object.getActions() != null && object.getActions().length > 0) {
    					filtered.add(object);
    				}
    			}
    		}
    
    		GameObject chosen = filtered.get(randInt(0,filtered.size()-1));
    		MethodProvider.log("Object: "+chosen);
    		if(chosen.isOnScreen()){
    			if(s.getClient().getMenu().isMenuVisible() && examine.equals("Yes")){
    				s.getClient().getMenu().clickAction("Examine");
    				s.getMouse().move(randomSpotToMove); //move to random location in rectangle
    			}else {
    				s.getMouse().move(chosen);
    				s.getMouse().click(true);
    				if(s.getClient().getMenu().isMenuVisible() && examine.equals("Yes")){
    					s.getClient().getMenu().clickAction("Examine");
    					s.getMouse().move(randomSpotToMove); //move to random location in rectangle
    					MethodProvider.sleep(600,900);
    				}else{
    					MethodProvider.sleep(600,900);
    					s.getMouse().move(randomSpotToMove); //move to random location in rectangle
    				}
    			}
    		}else{
    			s.getCamera().rotateToEntity(chosen);
    			if(s.getClient().getMenu().isMenuVisible()&& examine.equals("Yes")){
    				s.getClient().getMenu().clickAction("Examine");
    				s.getMouse().move(randomSpotToMove); //move to random location in rectangle
    			}else {
    				s.getMouse().move(chosen);
    				s.getMouse().click(true);
    				if(s.getClient().getMenu().isMenuVisible()&& examine.equals("Yes")){
    					s.getClient().getMenu().clickAction("Examine");
    					MethodProvider.sleep(600,900);
    					s.getMouse().move(randomSpotToMove); //move to random location in rectangle
    				}else{
    					MethodProvider.sleep(600,900);
    					s.getMouse().move(randomSpotToMove); //move to random location in rectangle
    				}
    			}
    }
    		}

     

     

     

    For some reason it keeps the data every time it runs. I tried taking out the getObject method, and it stays under ~600mb. Idk why it keeps it, I just know that that is the cause.

    Posted

    For some reason it keeps the data every time it runs. I tried taking out the getObject method, and it stays under ~600mb. Idk why it keeps it, I just know that that is the cause.

    Must be a bot issue.

    Posted

    1000mb? Holy shit.

     

    Congrats on the release non the less :P

    Posted

    1000mb? Holy shit.

     

    Congrats on the release non the less :P

    it's really not THAT bad...just a warning in case you don't have 3gb+ memory on your computer

    Posted

    it's really not THAT bad...just a warning in case you don't have 3gb+ memory on your computer

     

    If planning to run multiple accounts goldfarming this, its quite big :P

    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.