Kierze21 0 Share Posted May 30, 2016 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 Link to comment Share on other sites More sharing options...
Harold 11 Share Posted May 30, 2016 This is because I believe you're trying to export it as a standalone jar file (without a main(String[] args) method in your main class). You should export your script using the IntelliJ artifacts window, see https://www.jetbrains.com/help/idea/2016.1/c for more info. Link to comment Share on other sites More sharing options...
Cardozz 46 Share Posted May 30, 2016 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 More sharing options...
Kierze21 0 Author Share Posted May 30, 2016 This is because I believe you're trying to export it as a standalone jar file (without a main(String[] args) method in your main class). You should export your script using the IntelliJ artifacts window, see https://www.jetbrains.com/help/idea/2016.1/c for more info. this was the issue, thanks for helping Link to comment Share on other sites More sharing options...
Mad 86 Share Posted May 31, 2016 ur inCombat variable is always gonna stay true if u are in combat once Link to comment Share on other sites More sharing options...
Explicit 213 Share Posted May 31, 2016 This is because I believe you're trying to export it as a standalone jar file (without a main(String[] args) method in your main class). You should export your script using the IntelliJ artifacts window, see https://www.jetbrains.com/help/idea/2016.1/c for more info. omg you're not dead Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.