Kirito 5 Author Share Posted November 16, 2016 Mark all the code, copy it, remove all code, save, paste, save, look if it works... once a month i have this issue with eclipse (eventho ur using intellij) and this fixes it did not work :/ i gonna leave it as it is and sleep a night thinking about it. Link to comment Share on other sites More sharing options...
rexas 12 Share Posted November 16, 2016 What i usually do on intelij when i get some wierd error. I click on the part where the red zigzag underline is and press alt + enter, then bunch of options appear, choose the first option. Sometimes intelij is smart enough to fix your problem. I'm not saying it's the best practice to do this, but when you are a beginner and have no idea what you are doing this could help. I think you should try something simpler and see if it works, then build around it. import org.dreambot.api.script.AbstractScript; import org.dreambot.api.script.Category; import org.dreambot.api.script.ScriptManifest; @ScriptManifest(category = Category.MISC, name = "Test", author = "Test", version = 1.0) public class Test extends AbstractScript { @Override public int onLoop() { getWalking().walk(getLocalPlayer().getTile().getArea(10).getRandomTile()); sleep(2000); return 0; } } Link to comment Share on other sites More sharing options...
Nuclear Nezz 2056 Share Posted November 17, 2016 Could you update your original post with your new code now that you have ScriptManifest and such? Also please just use the code tag, I don't know where you're getting the line numbers and such but it has color formatting in it, and it's really difficult to read. Link to comment Share on other sites More sharing options...
Hoodz 161 Share Posted November 17, 2016 You're missing a ; on line 45 and thats the beginning... Link to comment Share on other sites More sharing options...
Kirito 5 Author Share Posted November 17, 2016 Could you update your original post with your new code now that you have ScriptManifest and such? Also please just use the code tag, I don't know where you're getting the line numbers and such but it has color formatting in it, and it's really difficult to read. i'l update the top post with the new code i'm down to 25-26 errors atm :/ ok i changed the tags from spoiler to just code and i still keep getting those white lines wich is kinda weird :/ Link to comment Share on other sites More sharing options...
rexas 12 Share Posted November 17, 2016 Fixed some problems, for example you wrote 'Interact' instead if non capital 'interact' and added too many brackets in some places. 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.Category; import org.dreambot.api.script.ScriptManifest; import org.dreambot.api.utilities.impl.Condition; 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 { // you put else statement in the wrong place, this is correct 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; } } } Link to comment Share on other sites More sharing options...
Kirito 5 Author Share Posted November 17, 2016 Fixed some problems, for example you wrote 'Interact' instead if non capital 'interact' and added too many brackets in some places. 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.utilities.impl.Condition; 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; } } } is it possible to highlight the parts where i did go wrong? i wanna see where i made mistakes anyways new errors popping up Error:(14, 36) java: an enum annotation value must be an enum constant Error:(14, 28) java: cannot find symbol symbol: variable Category Link to comment Share on other sites More sharing options...
rexas 12 Share Posted November 17, 2016 I don't know how to highlight code in this editor. Try changing import org.dreambot.api.script.Category.*; to import org.dreambot.api.script.Category; And if you really wanna learn, then try writing simple script and understand why are you writing it like that. Link to comment Share on other sites More sharing options...
Kirito 5 Author Share Posted November 17, 2016 i did folow o I don't know how to highlight code in this editor. Try changing import org.dreambot.api.script.Category.*; to import org.dreambot.api.script.Category; And if you really wanna learn, then try writing simple script and understand why are you writing it like that. i did follow an other tutorial "Tea stall thiefer" but that tutorial was out dated so i found this tutorial by Dreamlick and started following it then i ended up with the errors i had yesterday and fixed some off em later on ended up with 26 errors wich i cant seem to find the problem with and i'l try what you just said Edit: nope didn't solve my problem it jsut grays out Edit 2: Tutorial i first followed https://dreambot.org/forums/index.php/topic/628-scripting-tutorial-in-depth-no-prior-knowledge-needed-where-to-get-started-by-apaec/ Link to comment Share on other sites More sharing options...
rexas 12 Share Posted November 17, 2016 Try this script, it walks around f2p package main; import org.dreambot.api.methods.Calculations; import org.dreambot.api.methods.map.Tile; import org.dreambot.api.script.AbstractScript; import org.dreambot.api.script.Category; import org.dreambot.api.script.ScriptManifest; import java.util.Random; @ScriptManifest(category = Category.MISC, name = "Walker", author = "rex", version = 1.0) public class mainclass extends AbstractScript { private Tile nextTile; private Tile one = new Tile(3237, 3148, 0); private Tile two = new Tile(3298, 3369, 0); private Tile three = new Tile(3274, 3477, 0); private Tile four = new Tile(3161, 3424, 0); private Tile five = new Tile(3005, 3362, 0); private Tile six = new Tile(3071, 3327, 0); private Tile[] tiles = {one, two, three, four, five, six}; public void onStart() { nextTile = tiles[rollNumber(0, 5)]; } @Override public int onLoop() { walk(); return Calculations.random(500,1000); } public int rollNumber(int min, int max) { return new Random().nextInt(max - min + 1) + min; } public void walk() { if(nextTile.getArea(10).contains(getLocalPlayer())) { nextTile = tiles[rollNumber(0, 5)]; } else { getWalking().walk(nextTile.getArea(10).getRandomTile()); sleep(2000,3000); } } } Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.