Jump to content

dropAll implementation?


Recommended Posts

Posted

Hey guys! I'm trying to find the code that implements 

getInventory().dropAll(String itemName);

I looked over the forums and I found

private Filter < Item > nameFilter = new NameFilter < Item > ("Iron ore");
for (int slot = 0; slot < 28; slot++) {
    Item itemInSlot = getInventory().getItemInSlot(slot);
    if (itemInSlot != null && nameFilter.match(itemInSlot)) {
        getInventory().interact(slot, "Drop");
        sleep(random(25, 100));
    }
}

Except this doesn't activate the shiftdrop which is what I'm looking for.

Any ideas? I just want to code it so that something happens before a single drop.

Posted

I figured it out. Mine just assumes shiftdrop is enabled

 

                   case DROP:
                        getKeyboard().pressKey(VK_SHIFT);
                        for (int slot = 0; slot < 28; slot++) {
                            Item itemInSlot = getInventory().getItemInSlot(slot);

                            if (itemInSlot != null && nameFilter.match(itemInSlot)) {
                                getInventory().interact(slot);
                                sleep(random(25, 100));
                            }
                        }
                        getKeyboard().releaseKey(VK_SHIFT);

 

Posted
36 minutes ago, PshYouLost said:

Hey guys! I'm trying to find the code that implements 


getInventory().dropAll(String itemName);

I looked over the forums and I found


private Filter < Item > nameFilter = new NameFilter < Item > ("Iron ore");
for (int slot = 0; slot < 28; slot++) {
    Item itemInSlot = getInventory().getItemInSlot(slot);
    if (itemInSlot != null && nameFilter.match(itemInSlot)) {
        getInventory().interact(slot, "Drop");
        sleep(random(25, 100));
    }
}

Except this doesn't activate the shiftdrop which is what I'm looking for.

Any ideas? I just want to code it so that something happens before a single drop.

 

If shift dropping is enabled in the osrs settings, the OSBot dropAll method will use shift dropping afaik.

  • Like 2

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

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