ParaStyle 2 Posted September 26, 2018 Hello everyone I'm pretty new to scripting and I have a question. I'm making a script that picks up bones and then buries them. When the inventory is full the script starts burying the bones, but as soon as one bone has been buried, the script picks up another bone. How can I make the script bury all the bones in my inventory? BuryNode: public class BuryNode extends Node { private Data d = new Data(); public BuryNode(ParaBoneBurier main) { super(main); } @Override public boolean validate() { return c.getInventory().contains(d.BONES_ID); } @Override public int execute() { if(!c.getLocalPlayer().isAnimating() && !c.getLocalPlayer().isMoving()){ c.getInventory().get(d.BONES_ID).interact("Bury"); } return 1000; } } TakeNode: public class TakeNode extends Node { private Data d = new Data(); public TakeNode(ParaBoneBurier main) { super(main); } @Override public boolean validate() { return !c.getLocalPlayer().isMoving() && !c.getLocalPlayer().isAnimating() && !c.getInventory().isFull() && d.COWS_AREA.contains(c.getLocalPlayer()); } @Override public int execute() { GroundItem bones = c.getGroundItems().closest(d.BONES_ID); if(bones != null){ bones.interact("Take"); } return 1000; } } Thanks!
LogicSoup 92 Posted September 26, 2018 for (Item i: getInventory().all()) { if (i != null && i.hasAction("Bury")) { if (i.interact("Bury")) sleep(700); } }
LogicSoup 92 Posted September 26, 2018 If you are new to scripting then you shouldnt even be using the 'Node' framework. It's bloat and bad to use. You can use the script loop.
ParaStyle 2 Author Posted September 26, 2018 Thank you for the answers! The for each did the job. 14 minutes ago, LogicSoup said: If you are new to scripting then you shouldnt even be using the 'Node' framework. It's bloat and bad to use. You can use the script loop. Can you tell me why the Node framework is bad?
Milasoft 202 Posted September 26, 2018 The node framework is not bad. You have to add a condition to your take node so that if the inventory contains bones it wont validate.
Recommended Posts
Archived
This topic is now archived and is closed to further replies.