Kirito 5 Share Posted November 18, 2016 so i finally finished a woodcutting script i'm working on but now i'm in a bit off trouble, so it cuts the tree and drops the logs it needs to drop but for now it cuts 1 log and instantly drops it also it keeps spamming the tree even tough its already copping/cutting that tree. so what i need now is that it waits till the animation off chopping is done then starts cutting again and for the dropping part how do i make it so that it waits till the inventory is full? i'l post the code when its requested to post it Link to comment Share on other sites More sharing options...
triblion 56 Share Posted November 18, 2016 so i finally finished a woodcutting script i'm working on but now i'm in a bit off trouble, so it cuts the tree and drops the logs it needs to drop but for now it cuts 1 log and instantly drops it also it keeps spamming the tree even tough its already copping/cutting that tree. so what i need now is that it waits till the animation off chopping is done then starts cutting again and for the dropping part how do i make it so that it waits till the inventory is full? i'l post the code when its requested to post it Pasting code would help, but you could just implement a if(!getAnimation() == //the animation)) { choptree(): or just if(getLocalPlayer.isStandingStill) choptree(); Basic way's of doing it but will work Link to comment Share on other sites More sharing options...
Kirito 5 Author Share Posted November 18, 2016 Pasting code would help, but you could just implement a if(!getAnimation() == //the animation)) { choptree(): or just if(getLocalPlayer.isStandingStill) choptree(); Basic way's of doing it but will work ok so the current code is 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.methods.Calculations; @ScriptManifest(author = "Kirito", name = "Simple Power Chopper", version = 1.0, description = "Simply cuts tree's anywhere and drops them.", category = Category.WOODCUTTING) public class main extends AbstractScript { public void onStart() { log("Welcome to Simple Power Chopper by Kirito."); log("This is my first script please leave feedback and or report bugs on the topic."); log("Enjoy gaining levels!."); } private enum State { CHOP, DROP, WAIT }; private State getState() { GameObject tree = getGameObjects().closest("Tree"); if (!getInventory().isEmpty()) return State.DROP; if (tree != null) return State.CHOP; return State.WAIT; } public void onExit() { log("Thank you for using Simple Power Chopper by Kirito."); } @Override public int onLoop() { switch (getState()) { case CHOP: GameObject tree = getGameObjects().closest("Tree"); if (tree != null) { log("Status: Chopping that tree"); tree.interact("Chop Down"); return Calculations.random(1500, 2000); } case DROP: log("Status: Dropping all logs"); getInventory().dropAll("Logs"); break; case WAIT: sleep(Calculations.random(500, 600)); break; } return Calculations.random(500, 600); } } Link to comment Share on other sites More sharing options...
triblion 56 Share Posted November 18, 2016 @Override public int onLoop() { switch (getState()) { case CHOP: GameObject tree = getGameObjects().closest("Tree"); if (tree != null && getLocalPlayer.isStandingStill()) { log("Status: Chopping that tree"); tree.interact("Chop Down"); return Calculations.random(1500, 2000); } ok so the current code is 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.methods.Calculations; @ScriptManifest(author = "Kirito", name = "Simple Power Chopper", version = 1.0, description = "Simply cuts tree's anywhere and drops them.", category = Category.WOODCUTTING) public class main extends AbstractScript { public void onStart() { log("Welcome to Simple Power Chopper by Kirito."); log("This is my first script please leave feedback and or report bugs on the topic."); log("Enjoy gaining levels!."); } private enum State { CHOP, DROP, WAIT }; private State getState() { GameObject tree = getGameObjects().closest("Tree"); if (!getInventory().isEmpty()) return State.DROP; if (tree != null) return State.CHOP; return State.WAIT; } public void onExit() { log("Thank you for using Simple Power Chopper by Kirito."); } @Override public int onLoop() { switch (getState()) { case CHOP: GameObject tree = getGameObjects().closest("Tree"); if (tree != null) { log("Status: Chopping that tree"); tree.interact("Chop Down"); return Calculations.random(1500, 2000); } case DROP: log("Status: Dropping all logs"); getInventory().dropAll("Logs"); break; case WAIT: sleep(Calculations.random(500, 600)); break; } return Calculations.random(500, 600); } } Would be one way to do it (syntax should be correct) NOTE: Probably not the best way but will work none the less Link to comment Share on other sites More sharing options...
Kirito 5 Author Share Posted November 18, 2016 @Override public int onLoop() { switch (getState()) { case CHOP: GameObject tree = getGameObjects().closest("Tree"); if (tree != null && getLocalPlayer.isStandingStill()) { log("Status: Chopping that tree"); tree.interact("Chop Down"); return Calculations.random(1500, 2000); } Would be one way to do it (syntax should be correct) NOTE: Probably not the best way but will work none the less then i get the problem "getrLocalPlayer cannot be resolved" Link to comment Share on other sites More sharing options...
triblion 56 Share Posted November 18, 2016 then i get the problem "getrLocalPlayer cannot be resolved" if you pasted that (it might just be a type) make sure it's spelt right, you could also make it a different if statment not just && or use getAnimation() == <woodcutting one> Link to comment Share on other sites More sharing options...
Kirito 5 Author Share Posted November 18, 2016 if you pasted that (it might just be a type) make sure it's spelt right, you could also make it a different if statment not just && or use getAnimation() == <woodcutting one> hmm its also strange that i aint find any info on this page https://dreambot.org/javadocs/org/dreambot/api/wrappers/interactive/Character.html Link to comment Share on other sites More sharing options...
triblion 56 Share Posted November 18, 2016 hmm its also strange that i aint find any info on this page https://dreambot.org/javadocs/org/dreambot/api/wrappers/interactive/Character.html if(getLocalPlayer.isStandingStill()) { choptree(); } Would bring no error for me unless I either A) put a typo Put the syntax wrong or C) had no method for choptree, make sure it is all correct also if not try getAnimation Link to comment Share on other sites More sharing options...
rokaHakor 171 Share Posted November 18, 2016 Don't forget the parenthesis after getLocalPlayer getLocalPlayer().isStandingStill() Link to comment Share on other sites More sharing options...
Kirito 5 Author Share Posted November 18, 2016 if(getLocalPlayer.isStandingStill()) { choptree(); } Would bring no error for me unless I either A) put a typo Put the syntax wrong or C) had no method for choptree, make sure it is all correct also if not try getAnimation idk if this is correct @Override public int onLoop() { switch (getState()) { case CHOP: if(getLocalPlayer.isStandingStill()){ GameObject tree = getGameObjects().closest("Tree"); log("Status: Chopping that tree"); tree.interact("Chop Down"); return Calculations.random(1500, 2000); } case DROP: log("Status: Dropping all logs"); getInventory().dropAll("Logs"); break; case WAIT: sleep(Calculations.random(500, 600)); break; } return Calculations.random(500, 600); } } lolafter re-checking the code its gone forgot to place () behind if(getLocalPlayer"()".isStandingStill()){ now for the dropping part i did the same as above but then for the inventory if (!getInventory().isFull()) { log("Status: Dropping all logs"); getInventory().dropAll("Logs"); } Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.