julord 0 Share Posted January 27, 2017 Hi everyone My java does not support this code. How do I change it to my code work?? private void chopTree(String nameOfTree){ GameObject tree = getGameObjects().closest(gameObject -> gameObject != null && gameObject.getName().equals(nameOfTree)); if(tree != null && tree.interact("Chop down")){ int countLog = getInventory().count("Logs"); sleepUntil(() -> getInventory().count("Logs") > countLog, 12000); My version java: 1.8.0_121 Please help The entire script: package BasicWoodcutter; import org.dreambot.api.methods.Calculations; import org.dreambot.api.methods.filter.Filter; import org.dreambot.api.methods.map.Area; 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 org.dreambot.api.wrappers.interactive.NPC; import java.awt.*; /** * Created by Computor on 7/8/2015. */ @ScriptManifest(category = Category.WOODCUTTING, name = "Basic WoodCutter", author = "Computor", version = 1.0) public class MainClass extends AbstractScript{ Area bankArea = new Area(3092, 3240, 3097, 3246, 0); Area treeArea = new Area(3091, 3290, 3072, 3310, 0); @Override public void onStart(){ log("Hi"); } @Override public int onLoop() { /** * Chopping trees: Time to chop some trees, our inventory isn't full. We want to fill it up. */ if(!getInventory().isFull()){ if(treeArea.contains(getLocalPlayer())){ chopTree("Tree"); //change "Tree" to the name of your tree. }else{ if(getWalking().walk(treeArea.getRandomTile())){ sleep(Calculations.random(3000, 5500)); } } } /** * Banking: Time to bank our logs. Our inventory is full, we want to empty it. */ if(getInventory().isFull()){ //it is time to bank if(bankArea.contains(getLocalPlayer())){ bank(); }else{ if(getWalking().walk(bankArea.getRandomTile())){ sleep(Calculations.random(3000, 6000)); } } } return 600; } @Override public void onExit() { log("Bye"); } @Override public void onPaint(Graphics graphics) { } private void chopTree(String nameOfTree){ GameObject tree = getGameObjects().closest(gameObject -> gameObject != null && gameObject.getName().equals(nameOfTree)); if(tree != null && tree.interact("Chop down")){ int countLog = getInventory().count("Logs"); sleepUntil(() -> getInventory().count("Logs") > countLog, 12000); } } private void bank(){ NPC banker = getNpcs().closest(npc -> npc != null && npc.hasAction("Bank")); if(banker != null && banker.interact("Bank")){ if(sleepUntil(() -> getBank().isOpen(), 9000)){ if(getBank().depositAllExcept(item -> item != null && item.getName().contains("axe"))){ if(sleepUntil(() -> !getInventory().isFull(), 8000)){ if(getBank().close()){ sleepUntil(() -> !getBank().isOpen(), 8000); } } } } } } } the entire script Link to comment Share on other sites More sharing options...
Zibele 18 Share Posted January 27, 2017 Did you add the dreambot client as an external jar? By the way copy and pasting code is a terrible way to learn.. Link to comment Share on other sites More sharing options...
Im A Baller 348 Share Posted January 27, 2017 Hi everyone My java does not support this code. How do I change it to my code work?? You don't need to use lambda for that. Just do: GameObject tree = getGameObjects().closest(nameOfTree); Link to comment Share on other sites More sharing options...
julord 0 Author Share Posted January 28, 2017 So, I added, but does not work and is not copied and pasted https://www.youtube.com/embed/YXsMRTcAm7o Please enable this movie in 4m 45s Thanks Im A Baller and then what do I do to make the script raised just clicked on a tree chop down Thank you, I did it.Super forum !!!! Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.