Jump to content

item interaction


amoeder

Recommended Posts

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);
}

 

 

Link to comment
Share on other sites

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!

Link to comment
Share on other sites

 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
Link to comment
Share on other sites

 

 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

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

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