Kirito 5 Posted November 16, 2016 So i was following a tutorial from Dreamlicker after following the whole tutorial i ended up with 45 errors, 4 warnings and 2 typos. also after compiling the script it doesn't show up in the local scripts repository. package main; 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; import util.Wood; import static org.dreambot.api.Client.getClient; import static org.dreambot.api.methods.MethodProvider.sleepUntil; @ScriptManifest(category = Category.WOODCUTTING, name = "Simple Woodcutter", author = "Kirito", version = 1.0) public class mainclass extends AbstractScript{ private int state = -1; private Wood currentLog; private boolean drop = true; //private int anInt; @Override public void onStart() { super.onStart(); state = 0; currentLog = Wood.NORMAL; } @Override public int onLoop() { if (state == 0) cut(); else { if (state == 1) { bank(); } else { if (state == 2) { drop(); } } return Calculations.random(300, 400); } return 0; } private void cut() { if (!getInventory().isFull()) { GameObject gO = getGameObjects().closest(f -> f.getName().equals(currentLog.getTreeName())); if (getLocalPlayer().distance(gO) > 5) { getWalking().walk(gO); sleepUntil(() -> !getLocalPlayer().isMoving()) || getLocalPlayer().distance(getClient().getDestination()) < 7, Calculations.random(4600, 5400); } else { if (gO.Interact("Chop Down")) { sleepUntil(() -> !gO.exists() || !getLocalPlayer().isAnimating(), Calculations.random(12000, 15000)); } } else{ if (drop) { state = 2; } else { state = 1; } } } } private void bank() { if (getBank().isOpen()) { getBank().depositAllExcept(f -> f.getName().contains("axe")); getBank().Close(); sleepUntil(() -> !getBank().isOpen(), Calculations.random(2000, 2800)); state = 0; if (getLocalPlayer().distance(getBank().getClosestBankLocation().getCenter()) > 5) { if (getWalking().walk(getBank().getClosestBankLocation().getCenter())) sleepUntil(() -> !getLocalPlayer().isMoving() || getLocalPlayer().distance(getClient().getDestination()) < 8 , Calculations.random(3500, 5000)); } else { getBank().open(); sleepUntil(() -> getBank().isOpen(), Calculations.random(2000, 2800)); } } } private void drop() { if (getInventory().contains(currentLog.getLogName())) { getInventory().dropAll(currentLog.getLogName()); } else { state = 0; } } } Current errors: Error:(53, 64) java: not a statement, Error:(53, 126) java ';' expected, Error:58, 15) java 'else' without 'if' if anyone could help me with this or tell me what i'm doing wrong i would be really gratefull.
Dreamlicker 750 Posted November 16, 2016 What are the errors? Seems like you did not include the client.jar as a dependency.
rexas 12 Posted November 16, 2016 You need to add script manifest annotation above your main class, that's why it doesn't show up in local repositary. @ScriptManifest(category = Category.WOODCUTTING, name = "NAME", author = "AUTHOR", version = 1.0)
Kirito 5 Author Posted November 16, 2016 What are the errors? Seems like you did not include the client.jar as a dependency. I did include the client.jar as you described in your video tutorial. You need to add script manifest annotation above your main class, that's why it doesn't show up in local repositary. @ScriptManifest(category = Category.WOODCUTTING, name = "NAME", author = "AUTHOR", version = 1.0) thx i totally forgot that part of the script lol.
Kirito 5 Author Posted November 16, 2016 You're missing a ; on line 45 written as in the tutorial sleepUntill(() -> !getLocalPlayer().isMoving() || getLocalPlayer().distance(getClient().getDestination()) < 7, Calculations.random(4600, 5400));
Dreamlicker 750 Posted November 16, 2016 written as in the tutorial sleepUntill(() -> !getLocalPlayer().isMoving() || getLocalPlayer().distance(getClient().getDestination()) < 7, Calculations.random(4600, 5400)); Line # are from your post http://i.imgur.com/emhuCPv.png
Kirito 5 Author Posted November 16, 2016 Line # are from your post http://i.imgur.com/emhuCPv.png looks now like this getWalking().walk(gO); sleepUntill(() -> !getLocalPlayer().isMoving()) || getLocalPlayer().distance(getClient().getDestination()) < 7, Calculations.random(4600, 5400)) }else{
rexas 12 Posted November 16, 2016 Click on script manifest and press alt + enter to import it, same for other api
Kirito 5 Author Posted November 16, 2016 Click on script manifest and press alt + enter to import it, same for other api i already did that but now i keep getting incompatible. types found: 'import org.dreambot.api.script.Category', required: 'import org.dreambot.api.script.Category' while the category is already imported
Recommended Posts
Archived
This topic is now archived and is closed to further replies.