Jump to content

Welcome to DreamBot

VIP Enhancement

Want to upgrade your DreamBot experience? Consider signing up for VIP!
VIP allows you to run as many accounts as you want, view the forums ad-free, receive 10% off all script purchases, and so much more!
Visit the store to learn about all of these great features!

Upgrade to VIP Now
Frequently Asked Questions
  • Are you not able to open the client? Make sure you have Java 8 installed
  • Help! My bot doesn't do anything! Enable fresh start in client settings and restart the client
  • How to purchase with PayPal/OSRS gold? You can purchase vouchers from other users
  • Try asking for help in the chatbox
Download the DreamBot client today!
Sign in to follow this  
LostxMax

LostChickens

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

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

×
×
  • Create New...