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
  • LostChickens


    LostxMax

    Recommended Posts

    Basic chicken fighter with antiban

     

    Very simple chicken fighter that will kill chickens and pick up feathers.

     

    I know there are 3 million of these available but eh, just wanted to say I did it.

    import org.dreambot.api.methods.Calculations;
    import org.dreambot.api.methods.tabs.Tab;
    import org.dreambot.api.script.AbstractScript;
    import org.dreambot.api.script.Category;
    import org.dreambot.api.script.ScriptManifest;
    import org.dreambot.api.utilities.Timer;
    import org.dreambot.api.utilities.impl.Condition;
    import org.dreambot.api.wrappers.interactive.NPC;
    import org.dreambot.api.wrappers.items.GroundItem;
    
    import java.awt.*;
    
    	@ScriptManifest(name = "LostChickens", author = "LostxMax", description = "Basic Chicken Killer", version = 2.0, category = Category.COMBAT)
    	public class LostChickens extends AbstractScript {
    
    		private Timer t = new Timer();
    		public int feathers;
    
    		@Override
    		public void onStart() {
    			log("Welcome to a basic chicken killer");
    			log("We will kill chickens and pick up feathers");
    
    		}
    
    		@SuppressWarnings("unused")
    		private State state;
    		
    		private enum State{
    			Kill, Wait, Anti;
    		}
    		
    		private State getState(){
    		if(getLocalPlayer().canAttack() && !getLocalPlayer().isInCombat() && !getLocalPlayer().isMoving()){
    			return State.Kill;
    		}
    		if(Calculations.random(234) == 1 && getLocalPlayer().isInCombat()) {
    			return State.Anti;
    		}
    		else {
    			return State.Wait;
    		}
    		
    		}
    		
    		@Override
    		public int onLoop() {
    			switch (getState()) {
    			case Kill:
    				NPC chicken = getNpcs().closest("Chicken"); //Getting Chicken
    				GroundItem feather = getGroundItems().closest("Feather"); //Getting Feather
    				if(chicken != null && !chicken.isInCombat() && chicken.canAttack()) {
    					chicken.interact("Attack");
    					getCamera().rotateToEntity(chicken);
    					
    					sleepUntil(new Condition(){
    		    			@Override
    		    			public boolean verify(){
    		    			return chicken.getHealth() <= 0;
    		    			}
    		    			},Calculations.random(512));
    				}
    				if(feather != null && feather.exists() && !getLocalPlayer().isMoving() && !chicken.isOnScreen() && !getLocalPlayer().isInCombat()) {
    					feather.interact("Take");
    					feathers = getInventory().count("Feather");
    				}
    				break;
    			case Anti:
    				int Anti1 = Calculations.random(3);
    				switch(Anti1) {
    				case 1:
    					getTabs().open(Tab.STATS);
    					sleep(Calculations.random(5000));
    					getTabs().open(Tab.INVENTORY);
    				break;
    				case 2:
    					getMouse().moveMouseOutsideScreen();
    				break;
    				case 3:
    					getTabs().open(Tab.COMBAT);
    					sleep(Calculations.random(5000));
    					getTabs().open(Tab.INVENTORY);
    				}
    			case Wait:
    				sleep(Calculations.random(1240,3333));
    				break;
    			}
    			return Calculations.random(347);
    		}
    			
    		@Override
    		public void onExit() {
    
    		}
    
    		public void onPaint(Graphics2D g) {
    			g.setColor(Color.WHITE);
    			g.setFont(new Font("Arial", 1, 11));
    			g.drawString("Time Running: " + t.formatTime(), 25, 50);
    			g.drawString("Feathers Picked up: " +feathers, 25, 60);
    		}
    	}
    

    also for those that have no idea what to do with that big scary thing above:

    https://dl.dropboxusercontent.com/u/141805798/LostChickens.jar

    Link to comment
    Share on other sites

    Thanks mate for helping me learning to script!

     

    Duno if Voches are needed for this site (Still very used to rune-server) but

     

    i Vouch for this guy.

    Link to comment
    Share on other sites

    • 2 years later...

    Does this support ranging? If not how would I get it to support ranging? :D (I realize the thread is super old)

    Link to comment
    Share on other sites

    • 1 month later...

    @Yato

    The attack action doesn't care what you're wielding, so ranging is naturally supported. If you do decide to range you might want to consider modifying the script to also pick up ammo and equipt it.

    Link to comment
    Share on other sites

    • 1 year later...

    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.