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
  • I am noob


    Kierze21

    Recommended Posts

    So i just made my first ever script

    package CowKiller;
    
    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;
    
    @ScriptManifest(category = Category.COMBAT, name = "Cow Kiler", author = "Kierze", version = 1.0)
    public class MainClass extends AbstractScript
    {
        public boolean inCombat = false;
    
        @Override
        public int onLoop()
        {
            if(getLocalPlayer().isInCombat())
            {
                inCombat = true;
            }
            GameObject cow = getGameObjects().closest(gameObject -> gameObject != null && gameObject.getName().equals("Cow") && gameObject.hasAction("Attack"));
            if(!inCombat)
            {
                cow.interact("Attack");
                sleepUntil(() -> getLocalPlayer().isInCombat(), Calculations.random(5000, 7000));
            }
            return 600;
        }
        public void OnStart()
        {
            log("Started");
        }
        public void OnExit()
        {
    
        }
    }
    
    

    and i was wondering on how to actually test it

    From my own knowledge/testing i guess you export as a .Jar then put it in "Scripts" folder inside the dreambot folder, however when i try to export as jar it says 

     

    ng1pMEC.png?1

    Link to comment
    Share on other sites

    A normal Java program requires the main method to be called main (no exceptions). DreamBot uses just jar files, so there is indeed a chance that you are actually exporting the jar file as a runable jar file, which requires a main method.

    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.