Jump to content

Shift Clicking (Is it possible with current API)


Recommended Posts

Posted (edited)

Hey!

I am trying to implement shift-clicking on Rune Essence Pouches in order to empty them in one click.

This is similar to this shift click drop feature.

 

Is it possible to implement this with current API, as I have not found much hope around the interact function within the ItemContainer class.

 

Cheers,

D

 

UPDATE:

SOLUTION for emptying pouches:

After some discussion on trials I came up with the following:

Quote

getKeyboard().pressKey(16);
getInventory().getItem("Large pouch").interact("Empty");
getKeyboard().releaseKey(16);

 

 

Edited by lolhelllol
Posted
14 hours ago, Juggles said:

getInventory.drop("item");

.....

That's all you need.

Have it enabled on your acc and it will use it.....

Pls look at API before posting next time.. .. . . .... .

 

13 hours ago, Muffins said:

jojo plz u cant expect people to search things and do research for themselves on osbot ;( 

Why you guys going at him like that, when he is asking for something completely different :feels:

He wants to know if you can use Shift to empty the rune pouches with the API, which there isn't :boge: (AFAIK)

You just need to make your own method, by using getKeyboard() and holding down shift key > Do action > release shift key

Posted (edited)
On 27/09/2017 at 5:10 PM, Juggles said:

getInventory.drop("item");

.....

That's all you need.

Have it enabled on your acc and it will use it.....

Pls look at API before posting next time.. .. . . .... .

2

Thanks, I did try to look it up first.

But, I wasn't sure how to interpret the descriptions in the API for drop.

image.png.af9bf23a4d3959a6f39737f7f6b2f26d.png

drop() does not work with emptying pouches

Edited by lolhelllol
Posted (edited)
10 hours ago, Viston said:

 

Why you guys going at him like that, when he is asking for something completely different :feels:

He wants to know if you can use Shift to empty the rune pouches with the API, which there isn't :boge: (AFAIK)

You just need to make your own method, by using getKeyboard() and holding down shift key > Do action > release shift key

Cheers for the understanding,

I just tested out what Jnuggles posted and it turns out that .drop() doesn't work on pouches with the current API.

Having to use a manual method :(

Edited by lolhelllol
Posted (edited)

So, when you shift click the rune pouch it automatically uses the empty option for the item?

 

To make matters simpler I'm just going to assume the pouch is always in the first slot. It wouldn't be a bad idea to hard code it as players generally have a preferred location of the pouch. If you want to abstract it for it being in any position in the inventory, searching for it would be a good exercise to learn from.

 

		getMouse().move(getInventory().getMouseDestination(0));
		getKeyboard().pressKey(KeyEvent.VK_SHIFT);
		getMouse().click(false);
		getKeyboard().releaseKey(KeyEvent.VK_SHIFT);

 

This will shift click the first item (index 0) in your inventory.

 

Edit: be sure to import the necessary KeyEvent package:

import java.awt.event.KeyEvent;

Edited by mr magoo
Posted (edited)
7 hours ago, mr magoo said:

So, when you shift click the rune pouch it automatically uses the empty option for the item?

 

To make matters simpler I'm just going to assume the pouch is always in the first slot. It wouldn't be a bad idea to hard code it as players generally have a preferred location of the pouch. If you want to abstract it for it being in any position in the inventory, searching for it would be a good exercise to learn from.

 


		getMouse().move(getInventory().getMouseDestination(0));
		getKeyboard().pressKey(KeyEvent.VK_SHIFT);
		getMouse().click(false);
		getKeyboard().releaseKey(KeyEvent.VK_SHIFT);

 

This will shift click the first item (index 0) in your inventory.

 

Edit: be sure to import the necessary KeyEvent package:

import java.awt.event.KeyEvent;

No need to call getMouse.move() because he can just click the item in the inventory directly.

getInventory().getItem("Essence Pouch").interact("Empty");

Since shift clicking will make the left click the option "Empty" it'll just left click it :)

Edited by Viston
  • Like 1

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...