Jump to content

A simple Bone burier


seasons 4

Recommended Posts

I was wondering how one goes about burying all bones in inventory. I understand ".dropALL();" and how it is able to drop all the items, but i wish to bury and "buryALL();" simply wont work. For this one a simple answer would be great but, if someone could direct me in the direction of which I can look this information up for myself that would be even better.

  • Like 1
Link to comment
Share on other sites

Thank you, where do i go about getting the information i need. Via the libraries and what not. I need to know how to pick everything up and basically everything else. 

 

To pick up look at the GroundItems API : http://osbot.org/api/org/osbot/rs07/api/GroundItems.html

 

anything else will be in API : http://osbot.org/api

 

 

 

example:

GroundItem g = getGroundItems().closest("item name"); //basic

//always nullcheck
if (g != null){
   g.interact("action");
}


Edited by TheObserver
Link to comment
Share on other sites

 

To pick up look at the GroundItems API : http://osbot.org/api/org/osbot/rs07/api/GroundItems.html

 

anything else will be in API : http://osbot.org/api

 

 

 

example:

GroundItem g = getGroundItems().closest("item name"); //basic

//always nullcheck
if (g != null){
   g.interact("action");
}


Thank you very much

 

  • Like 1
Link to comment
Share on other sites



Item[] bones = getInventory().getItems();
        Item[] var2 = bones;
        int var3 = bones.length;
        for(int var4 = 0; var4 < var3; ++var4) {
            Item item = var2[var4];
            if(item != null && item.hasAction("Bury")) {
                item.interact("Bury");
                //sleep
            }
        }

 

wtf is this :)

 

You could either use streams or there's a simpler way:

for (Item i: inventory.getItems()) {
if (i != null && i.getName().equals("Bones")) {
inventory.interact(i,"Bury");
}
} //wrote in response box so sorry if any errors

merry christmas

apa

Link to comment
Share on other sites

wtf is this smile.png

 

You could either use streams or there's a simpler way:

for (Item i: inventory.getItems()) {
if (i != null && i.getName().equals("Bones")) {
inventory.interact(i,"Bury");
}
} //wrote in response box so sorry if any errors

merry christmas

apa

 im still noob appy plzzzz :doge:

 

dont publicly shame me infront of teh noobs :troll:

 

ty

Link to comment
Share on other sites

if (condition) getInventory().interact("Bury","Bones");

or

Item[] bones = getInventory().getItems();
        Item[] var2 = bones;
        int var3 = bones.length;
        for(int var4 = 0; var4 < var3; ++var4) {
            Item item = var2[var4];
            if(item != null && item.hasAction("Bury")) {
                item.interact("Bury");
                //sleep
            }
        }

 

wtf is that Observer doge.png

Arrays.stream(getInventory().getItems())
    .filter(item -> item.hasAction("Bury"))
        .foreach(bones -> bones.interact("Bury"));

or

for(Item item : getInventory().getItems()){
    if(item.hasAction("Bury")) item.interact("Bury");
}
Edited by Explv
  • Like 1
Link to comment
Share on other sites

Let me give you a bit of the background i guess. It may make it easier to see what i'm doing i'm using apaec's simple tea thievers guides (thanks =P). 

 

so:

@Override
public int onLoop() throws InterruptedException {
switch (getState()) {
case TAKE:
//Entity stall = objects.closest("Tea stall");
GroundItem bones = getGroundItems().closest("Bones");
if (bones != null){
  bones.interact("Take");
}
sleep(random(500,1000));
//if (stall != null) {
// stall.interact("Steal-from");
break;
case BURY:
if (inventory.isFull()) getInventory().interact("Bury","Bones");
//inventory.dropAll();
break;
case WAIT:
sleep(random(700, 1000));
break;
}
return random(200, 300);
}

 

 

Basically taking it and changing slight code. 

 

Goal:

pick up an entire inventory of bones and bury them after a full inventory

Edited by seasons 4
Link to comment
Share on other sites

Let me give you a bit of the background i guess. It may make it easier to see what i'm doing i'm using apaec's simple tea thievers guides (thanks =P). 

 

so:

 

Basically taking it and changing slight code. 

 

Goal:

pick up an entire inventory of bones and bury them after a full inventory

 

Maybe something like

import org.osbot.rs07.api.filter.Filter;
import org.osbot.rs07.api.model.GroundItem;
import org.osbot.rs07.api.model.Item;
import org.osbot.rs07.script.Script;

@ScriptManifest(author = "Noob", name = "Noob Script", version = -15.0, logo = "", info = "Does some noob shit")
public class Burier extends Script {

    private enum STATE{ PICKING, BURYING } // Enum for our two script states

    private STATE getState(){

        if(!getInventory().isFull()) return STATE.PICKING; // When the inventory is not full, pick bones
        else return STATE.BURYING; // When the inventory is full, bury bones
    }

    @Override
    public int onLoop() throws InterruptedException {

        switch (getState()){ // Get the current state

            case PICKING: pick(); // If we are picking, call the pick method
                    break;
            case BURYING: bury(); // If we are burying, call the bury method
                break;
        }
        return 0;
    }

    private void pick(){

        /*
            Get the closest ground item that matches our filter, in this case items which name contains "bones". 
            This could be simplified by storing the names of all bones in a String[]
        */
        GroundItem bones = getGroundItems().closest(new Filter<GroundItem>() {
            @Override
            public boolean match(GroundItem groundItem) {

                return groundItem.getName().toLowerCase().contains("bones");
            }
        });

        if(bones != null){ // Check that we found bones on the ground

            bones.interact("Take"); // If we did, pick them up

            try{
                sleep(random(1000, 1200)); // Sleep for between 1 and 1.2 seconds after clicking on the bones
            } catch(InterruptedException e){
                log(e);
            }
        }
    }

    private void bury(){

        for(Item item : getInventory().getItems()){ // Iterate over each inventory item

            if(item.hasAction("Bury")) { // If it has the "Bury" action

                item.interact("Bury"); // Bury it

                try{
                    sleep(random(1000, 1200)); // Sleep for between 1 and 1.2 seconds after burying
                } catch(InterruptedException e){
                    log(e);
                }
            }
        }
    }
}

Edited by Explv
Link to comment
Share on other sites

 

Maybe something like

import org.osbot.rs07.api.filter.Filter;
import org.osbot.rs07.api.model.GroundItem;
import org.osbot.rs07.api.model.Item;
import org.osbot.rs07.script.Script;

@ScriptManifest(author = "Noob", name = "Noob Script", version = -15.0, logo = "", info = "Does some noob shit")
public class Burier extends Script {

    private enum STATE{ PICKING, BURYING }

    private STATE getState(){

        if(!getInventory().isFull()) return STATE.PICKING;
        else return STATE.BURYING;
    }

    @Override
    public int onLoop() throws InterruptedException {

        switch (getState()){

            case PICKING: pick();
                    break;
            case BURYING: bury();
                break;
        }
        return 0;
    }

    private void pick(){

        getGroundItems().closest(new Filter<GroundItem>() {
            @Override
            public boolean match(GroundItem groundItem) {

                if(groundItem.hasAction("Bury")) return true;
                return false;
            }
        }).interact();

        try{
            sleep(random(1000, 1200));
        } catch(InterruptedException e){
            log(e);
        }
    }

    private void bury(){

        for(Item item : getInventory().getItems()){

            if(item.hasAction("Bury")) item.interact("Bury");
        }

        try{
            sleep(random(1000, 1200));
        } catch(InterruptedException e){
            log(e);
        }
    }
}

 

Alright give me a sec to read this. I will probably have some more questions. especially why it just does some noob shit =P lol

Link to comment
Share on other sites

if (condition) getInventory().interact("Bury","Bones");

or

Item[] bones = getInventory().getItems();
        Item[] var2 = bones;
        int var3 = bones.length;
        for(int var4 = 0; var4 < var3; ++var4) {
            Item item = var2[var4];
            if(item != null && item.hasAction("Bury")) {
                item.interact("Bury");
                //sleep
            }
        }

 

I lol'd :D

I mean, if I was new to this, I'd only get confused more and more :D

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...