Jump to content

Interacting with inventory


MaxSkiller

Recommended Posts

Hello,

 

I was trying to sell stuff in a general store,

When i open the genral store and i try to do this:

Item item = script.inventory.getItem(name);

if(item != null){
item.interact("Sell 5",name);
}

The client auto closes the interface, why would the make it that way?

I'm kinda stuck, I tried several ways but when i try to interact with the item it always closes the shop.

 

 

Is there a way I can just right click the item and manually select from the Menu?

anybody any ideas?

Link to comment
Share on other sites

do you have anymore code other than that? because that may be affecting it.

 

Well if you would like to check 20 classes , ya sure tongue.png

 

I'll check it out, but why do they implement such thing?

It's just stupidly annoying

 

Edit:

 

Could the method for checking the inventory count affect this?

 

if(script.inventory.getEmptySlots() > 5){
     shop.sell("Pure essence", 10);
}

public void sell(String name, int amount) {

	Item item = script.inventory.getItem(name);

	if (item != null && item.getName().equals(name)) {
		if (amount < 4)
			item.interact("Sell 1", name);
		else if (amount < 9)
			item.interact("Sell 5", name);
		else if (amount >= 10)
			item.interact("Sell 10", name);
		Utils.sleep(script, 300, 750);
	}
}

 

Edited by MaxSkiller
Link to comment
Share on other sites

 

Well if you would like to check 20 classes , ya sure tongue.png

 

I'll check it out, but why do they implement such thing?

It's just stupidly annoying

 

Edit:

 

Could this be affectting it:

 

if(script.inventory.getEmptySlots() > 5){
     shop.sell("Pure essence", 10);
}

	public void sell(String name, int amount) {

		Item item = script.inventory.getItem(name);

		if (item != null && item.getName().equals(name)) {
			if (amount < 4)
				item.interact("Sell 1", name);
			else if (amount < 9)
				item.interact("Sell 5", name);
			else if (amount >= 10)
				item.interact("Sell 10", name);
			Utils.sleep(script, 300, 750);
		}
	}

 

 

I'm not sure why you're doing this:

item.interact("Sell 5",name);

change it to:

item.interact("Sell 5");

I'm not sure why you are doing item.interact("action","name") when you have already assigned an item to it so you don't need a name.

 

try it and tell me what happens.

 

Link to comment
Share on other sites

I'm not sure why you're doing this:

item.interact("Sell 5",name);

change it to:

item.interact("Sell 5");

I'm not sure why you are doing item.interact("action","name") when you have already assigned an item to it so you don't need a name.

 

try it and tell me what happens.

 

I tried that before wink.png

Just changed to check out if it did somehting else.

 

Both methods do the same anyway xD

 

Trying to debug my problem now sleep.png

 

 

EDIT:

Every method with inventory. just closes the interface...

 

I managed to fix the problem by making a GeneralShopInventory object

While in general shop inventory items get stored in Rsinterface 301.

 

Thx for the help anyway

Edited by MaxSkiller
Link to comment
Share on other sites

I tried that before wink.png

Just changed to check out if it did somehting else.

 

Both methods do the same anyway xD

 

Trying to debug my problem now sleep.png

 

 

EDIT:

Every method with inventory. just closes the interface...

 

I managed to fix the problem by making a GeneralShopInventory object

While in general shop inventory items get stored in Rsinterface 301.

 

Thx for the help anyway

I'm glad you fixed it, makes it more fulfilling when you do it yourself hehe ^_^

Link to comment
Share on other sites

I'm glad you fixed it, makes it more fulfilling when you do it yourself hehe happy.png

 

Meh hehe, kinda stressed so hard atm ...

Really people... I've been just buys whole day trying to make 2 stupid things just because it's impossible to do easy things in an easy way xD

I already had to make like 15 custom classes because osbot API doesn't support most of the things... It takes me more time making my own API then i'm really scripting -_-

 

Why isn't there just a mouse.click(x,y,boolean right) function? just WHY?

Do you know a way to click or right click a certain position on the screen?

 

check:

 

ecc144d956.png

 

Meh xD

Edited by MaxSkiller
Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
  • Recently Browsing   0 members

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