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.

AutoHotKey-Like Vertical Dropping/Custom Dropping

Featured Replies

 

Tested and doesn't work, still drops the blacklisted item, you try to check on the entire list, not on an item in the list


!blacklist.contains(getInventory().getItemInSlot(i).getName())
  • 2 weeks later...

Don't use that code. At no point is the Item defined, so he's having to constantly retrieve a single item from the Inventory class multiple times. This is very inefficient. The parameters are also a limitation too. There may be other conditions you wish to set before dropping anything. I'd go for something like this:

	// From int[] to Integer[] because Arrays.asList(Object) doesn't work with primitive type arrays
	public static final Integer[] VERTICAL_DROP = { 0, 4, 8, 12, 16, 20, 24, 1, 5, 9, 13, 17, 21, 25, 2, 6, 10, 14, 18, 22,
			3, 7, 11, 15, 19, 23 };
	
	public static final List<Integer> VERTICAL_DROP_AS_LIST = Arrays.asList(VERTICAL_DROP);
	
	public void dropAll(Predicate<Item> filter) {
		
		VERTICAL_DROP_AS_LIST.forEach((index) -> {
			
			// Acquire item once, store it as a variable
			Item item = getInventory().getItemInSlot(index);
			
			// Validate the item before interacting with it, also only use filter if one exists
			if (item != null && item.hasAction("Drop") && (filter != null && filter.test(item))) {

				item.interact("Drop");
				
				/*
				 * Item#interact(String...) returns a boolean, which you could
				 * wrap in a selector (IF) for better handling
				 */
			}
		});
	}
	
	public void dropFish() {
		
		// Lambda this shit the fuck up!
		dropAll((item) -> item.getName().equals("Trout") && !item.isNote());
		
	}
	

I haven't actually tested this, but it should work. smile.png

 

If you want to go full autist you could have the Integer array explicitly defined within the parameters of the Arrays#asList(Object) method. This would just mean you wouldn't need to define VERTICAL_DROP as a global constant. It's justified too, since VERTICAL_DROP is only ever likely to be referenced once. However having VERTICAL_DROP as mostly dead code isn't going to rip holes in time and space. smile.png

VERTICAL_DROP's type needed to be an array of Integer objects and not the primitive type why? They are just indexes. Why did you need to make it into an array list also?

 

dropAll should return a boolean, that is outside of the for loop. Maybe something like use a counter and ++ it every loop iteration, then return Inventory.getCount == 28 - counter. I assume that would work, never tried it though.

Create an account or sign in to comment

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.