Jump to content
View in the app

A better way to browse. Learn more.

OSBot :: 2007 OSRS Botting

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Custom Inventory dropping method :/

Featured Replies

final Inventory inven = client.getInventory();
for (final Item item : inven.getItems()) {
    if (item != null && Arrays.asList(item.getDefinition().getActions()).contains("Drop")) {
        inven.interactWithId(item.getId(), "Drop");
    }
}

Wrote in 5 seconds without IDE.

final Inventory inven = client.getInventory();
for (final Item item : inven.getItems()) {
    if (item != null && Arrays.asList(item.getDefinition().getActions()).contains("Drop")) {
        inven.interactWithId(item.getId(), "Drop");
    }
}

Wrote in 5 seconds without IDE.

 

Tbh, I don't think that will drop faster then the normal one..

For OSB2

public class DropItems {

	private final Script script;
	@SuppressWarnings("unused")
	private final Bot b;

	public DropItems(final Script script, final Bot b) {
		this.script = script;
		this.b = b;
	}

	public void dropAllExcept(ArrayList<String> blacklist)
			throws InterruptedException {
		Item[] i = script.inventory.getItems();
		for (Item inventoryItem : i) {
			if (!blacklist.contains(inventoryItem.getName())
					&& Arrays
							.asList(inventoryItem.getDefinition().getActions())
							.contains("Drop")) {
				int s = script.inventory.getSlot(inventoryItem);
				Timer failsafe = new Timer(0L);
				while (script.inventory.getSlot(inventoryItem) == s
						&& failsafe.getElapsed() < 5000L) {
					inventoryItem.interact("Drop");
					Script.sleep(750);
				}
			}
			if (script.inventory.isItemSelected()) {
				script.inventory.deselectItem();
			}
		}
	}

}

 

For OSB2

public class DropItems {

	private final Script script;
	@SuppressWarnings("unused")
	private final Bot b;

	public DropItems(final Script script, final Bot b) {
		this.script = script;
		this.b = b;
	}

	public void dropAllExcept(ArrayList<String> blacklist)
			throws InterruptedException {
		Item[] i = script.inventory.getItems();
		for (Item inventoryItem : i) {
			if (!blacklist.contains(inventoryItem.getName())
					&& Arrays
							.asList(inventoryItem.getDefinition().getActions())
							.contains("Drop")) {
				int s = script.inventory.getSlot(inventoryItem);
				Timer failsafe = new Timer(0L);
				while (script.inventory.getSlot(inventoryItem) == s
						&& failsafe.getElapsed() < 5000L) {
					inventoryItem.interact("Drop");
					Script.sleep(750);
				}
			}
			if (script.inventory.isItemSelected()) {
				script.inventory.deselectItem();
			}
		}
	}

}

 

Why did you use an Array List in the parameter, it will be easier and look better with an array of strings "String...blacklist". 

 

example:

	public void dropAllExcept(String...blacklist) throws InterruptedException {
		List<String> list = new ArrayList<String>();
		
		for (String s: blacklist)	{
			if (s!=null)
				list.add(s);
		}
		
		//then you could do the rest in here using the arrayList
	}

initialize it as a List then convert it into an array list

List<String> list = new ArrayList<String>();

Edited by josedpay

 

Why did you use an Array List in the parameter, it will be easier and look better with an array of strings "String...blacklist". 

 

example:

	public void dropAllExcept(String...blacklist) throws InterruptedException {
		List<String> list = new ArrayList<String>();
		
		for (String s: blacklist)	{
			if (s!=null)
				list.add(s);
		}
		
		//then you could do the rest in here using the arrayList
	}

initialize it as a List then convert it into an array list

List<String> list = new ArrayList<String>();

 

The fixed length of simple arrays is the reason why I don't use them much anymore except for constants (my blacklists are usually dynamic, this allows me to have one smart flexible blacklist instead of multiple constant ones). I prefer the collection interface because it offers much more flexibility imo.

Guest
This topic is now closed to further replies.

Recently Browsing 0

  • No registered users viewing this page.

Account

Navigation

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.