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
  • Would someone help tell me why this script only do once?


    hilarion4

    Recommended Posts

    Im new and im trying to code some dreamt scripts. here's my code.

    Quote

     

     

     

    
    import org.dreambot.api.methods.item.GroundItems;
    import org.dreambot.api.script.AbstractScript;
    import org.dreambot.api.script.ScriptManifest;
    import org.dreambot.api.utilities.Logger;
    import org.dreambot.api.utilities.Sleep;
    import org.dreambot.api.wrappers.interactive.NPC;
    import org.dreambot.api.wrappers.items.GroundItem;
    import org.dreambot.api.script.Category;
    
    
    
    import org.dreambot.api.methods.interactive.NPCs;
    
    @ScriptManifest(name = "Chicken Killer", description = "My script description!", author = "Developer Name",
                    version = 1.0, category = Category.COMBAT, image = "")                             
    public class teste extends AbstractScript {
    	
    
    	GroundItem pena = GroundItems.closest("Feather");
    	NPC chicken = NPCs.closest("Chicken");
    	private int state = 0;
    	@Override
        public int onLoop() {
    		
    		if (state == 0) {
    		matar();
    		}
    		if (state != 0) {
    			coletar();
    		}
    		
    		return 0;
    
    }
    
    	private void matar() {
    		
    		if (chicken != null) {
    			chicken.interact("Attack");
    			Logger.log("Atacou");
    			Sleep.sleep(4000,5000);
    			state++;
    			}
    		}
    		
    	private void coletar() {
    				if (pena != null) 
    				{
    				pena.interact("Take");
    				Logger.log("Pegou");
    				state = 0;
    		}
    
    		
    			
    		}
    	
    		
    		
    	}
    	

     

    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.