Jump to content

item interaction


Recommended Posts

Posted

I'm a real  noob but i can't seem to find how to use an item on another item in the API. Do i just use the click method? Can i get some feedback on the little script i tried to write?

 

Item chocolate = getInventory().getItem("Chocolate bar");
Item knife = getInventory().getItem("Knife");
 
if (inventory contains(chocolate)&& inventory.contains(knife){
click(chocolate);
click(knife);
}
Else{ 
objects.closest("Bankbooth").interact("Bank");
depositAllExept(knife);
withdrawAll(chocolate);
}

 

 

Posted

Does that makes it just left click or does it really right clicks and clicks use? because that would make it very obvious that u are botting because no normal player would do that?

 

Not necessarily, I'm not sure how the .interact() method works exactly as I've not looked at the client code, but I believe it will most times just left click but sometimes right click. Give it a test!

 

apa

 

 left click cause its the first option on the item

 

Not always!

Posted (edited)

 Try something along these lines (assumes that a knife is present)

if(getInventory().contains("Chocolate bar")) {
    if("Knife".equals(getInventory().getSelectedItemName())) {
        int slot = getInventory().getSlot("Chocolate bar");
        getMouse().click(new InventorySlotDestination(getBot(), slot));
    } else {
        int slot = getInventory().getSlot("Knife");
        getMouse().click(new InventorySlotDestination(getBot(), slot));
    }
}
Edited by FrostBug
  • Like 1
Posted

 

 Try something along these lines (assumes that a knife is present)

if(getInventory().contains("Chocolate bar")) {
    if("Knife".equals(getInventory().getSelectedItemName())) {
        int slot = getInventory().getSlot("Chocolate bar");
        getMouse().click(new InventorySlotDestination(getBot(), slot));
    } else {
        int slot = getInventory().getSlot("Knife");
        getMouse().click(new InventorySlotDestination(getBot(), slot));
    }
}

i like the flow

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