October 22, 20169 yr public int onLoop() throws InterruptedException { for (Node n : nodes) { if (n.validate()) { n.execute(); } } return 200; } When I run this, it checks validate and then executes, but after it has finished executing it just stands there?
October 22, 20169 yr public int onLoop() throws InterruptedException { for (Node n : nodes) { if (n.validate()) { n.execute(); } } return 200; } When I run this, it checks validate and then executes, but after it has finished executing it just stands there? how many nodes do you have, and can we see see your validate() statements? also are you sure its not continuously looping in your execute() methods?
October 22, 20169 yr Author how many nodes do you have, and can we see see your validate() statements? also are you sure its not continuously looping in your execute() methods? Just one node. public boolean validate() throws InterruptedException { return tree != null && tree.hasAction("Chop down") && !sA.myPlayer().isAnimating() && !sA.inventory.isFull(); Edited October 22, 20169 yr by Expels
October 22, 20169 yr Just one node. public boolean validate() throws InterruptedException { return tree != null && tree.hasAction("Chop down") && !sA.myPlayer().isAnimating() && !sA.inventory.isFull(); you shouldnt be using a node format for just 1 node. regardless, does it chop 1 tree then just stop working?
October 22, 20169 yr Author you shouldnt be using a node format for just 1 node. regardless, does it chop 1 tree then just stop working? I have added dropping as well, but yes I chops once and then just stands around.
October 22, 20169 yr Just one node. public boolean validate() throws InterruptedException { return tree != null && tree.hasAction("Chop down") && !sA.myPlayer().isAnimating() && !sA.inventory.isFull(); Why not just return one thing such as the inventory not being full and make it simpler instead of accessing a unnecessary tree variable you created when you don' t need it. e.g for Chop return !sA.getInventory().isFull(); for Drop return sA.getInventory().isFull(); May or may not fix your problem but you don't need to null check something in your validate unless you were planning on doing something like this which I have in my BDK/Gwd (S.getGroundItems().closest(gi -> S.AREA_DRAGONS.contains(gi) && lootList.contains(gi.getName()) && S.getMap().canReach(gi)) != null); Also im assuming your node framework was taken from Booch's tutorial right?
October 22, 20169 yr Author Why not just return one thing such as the inventory not being full and make it simpler instead of accessing a unnecessary tree variable you created when you don' t need it. e.g for Chop return !sA.getInventory().isFull(); for Drop return sA.getInventory().isFull(); May or may not fix your problem but you don't need to null check something in your validate unless you were planning on doing something like this which I have in my BDK/Gwd (S.getGroundItems().closest(gi -> S.AREA_DRAGONS.contains(gi) && lootList.contains(gi.getName()) && S.getMap().canReach(gi)) != null); Also im assuming your node framework was taken from Booch's tutorial right? If I just check if Inventory is full then it will just spam click. Doing it that way doesn't work anyway. And yes.
October 22, 20169 yr If I just check if Inventory is full then it will just spam click. Doing it that way doesn't work anyway. And yes. You do know validate only toggles the class to activate. If it spams click that's you're interaction code To fix 'spam clicks' use cond sleeps and checks i.e long logCount = getInventory().getAmount("Name of log"); and let's say ur interacting with a tree for eg if(tree.interact("Chop down")) { cond sleep(7500) return getInventory().getAmount("Name of log") > logCount; that should fix spam clicks tbh
October 22, 20169 yr Author You do know validate only toggles the class to activate. If it spams click that's you're interaction code To fix 'spam clicks' use cond sleeps and checks i.e long logCount = getInventory().getAmount("Name of log"); and let's say ur interacting with a tree for eg if(tree.interact("Chop down")) { cond sleep(7500) return getInventory().getAmount("Name of log") > logCount; that should fix spam clicks tbh It would fix the spam clicking but it still doesn't loop it just stands there after chopping down the tree, there are no errors and the script doesn't stop, so I'm not really sure what is causing it.
October 22, 20169 yr It would fix the spam clicking but it still doesn't loop it just stands there after chopping down the tree, there are no errors and the script doesn't stop, so I'm not really sure what is causing it. Are you still using that tree variable at the top of your class? Could you share more code? It'd really help Your full chop class and ur main class preferably
October 22, 20169 yr Author Are you still using that tree variable at the top of your class? Could you share more code? It'd really help Your full chop class and ur main class preferably private List<Node> nodes = new ArrayList<Node>(); @[member=Override] public void onStart() { Collections.addAll(nodes, new Chopping(this)); } @[member=Override] public int onLoop() throws InterruptedException { for (Node n : nodes) { if (n.validate()) { n.execute(); break; } } return 200; } Constants c = new Constants(); RS2Object tree = sA.objects.closest("Tree"); public Chopping(Script sA) { super(sA); // TODO Auto-generated constructor stub } @[member=Override] public boolean validate() throws InterruptedException { return !sA.inventory.isFull(); } @[member=Override] public int execute() { if (tree != null) { tree.interact("Chop down"); new ConditionalSleep(1000, 4000) { @[member=Override] public boolean condition() throws InterruptedException { // TODO Auto-generated method stub return !sA.myPlayer().isAnimating(); } }.sleep(); } else { sA.camera.toEntity(tree); } return 200; } }
October 22, 20169 yr private List<Node> nodes = new ArrayList<Node>(); @[member='Override'] public void onStart() { Collections.addAll(nodes, new Chopping(this)); } @[member='Override'] public int onLoop() throws InterruptedException { for (Node n : nodes) { if (n.validate()) { n.execute(); break; } } return 200; } Constants c = new Constants(); RS2Object tree = sA.objects.closest("Tree"); public Chopping(Script sA) { super(sA); // TODO Auto-generated constructor stub } @[member='Override'] public boolean validate() throws InterruptedException { return !sA.inventory.isFull(); } @[member='Override'] public int execute() { tree = sA.objects.closest("Tree"); if (tree != null) { tree.interact("Chop down"); new ConditionalSleep(1000, 4000) { @[member='Override'] public boolean condition() throws InterruptedException { // TODO Auto-generated method stub return !sA.myPlayer().isAnimating(); } }.sleep(); } else { sA.camera.toEntity(tree); } return 200; } } you only call "tree = sA.objects.closest("Tree");" once when you make an instance of the class. id recommend adding it into the execute method as the first line as above. also, id make it a local variable instead of global.
October 22, 20169 yr you only call "tree = sA.objects.closest("Tree");" once when you make an instance of the class. id recommend adding it into the execute method as the first line as above. also, id make it a local variable instead of global. What i was literally going to say :P
October 22, 20169 yr Author you only call "tree = sA.objects.closest("Tree");" once when you make an instance of the class. id recommend adding it into the execute method as the first line as above. also, id make it a local variable instead of global. Now it works. Thank you!
Create an account or sign in to comment