Jump to content
Frequently Asked Questions
  • Are you not able to open the client? Try following our getting started guide
  • Still not working? Try downloading and running JarFix
  • Help! My bot doesn't do anything! Enable fresh start in client settings and restart the client
  • How to purchase with PayPal/OSRS/Crypto gold? You can purchase vouchers from other users
  • Keep burying bones until inventory is empty


    ParaStyle

    Recommended Posts

    Posted

    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!

    Posted
    for (Item i: getInventory().all()) {
    	if (i != null && i.hasAction("Bury")) {
    		if (i.interact("Bury"))
    			sleep(700);
    	}
    }

     

    Posted

    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.

    Posted

    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?

    Posted

    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.

    Archived

    This topic is now archived and is closed to further replies.

    ×
    ×
    • Create New...

    Important Information

    We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.