Jump to content

Interacting with inventory items


PwneRL33T

Recommended Posts

title says it all really, ive been searching the API for about an hour now but cant figure out how to put the code together... can anyone tell me what the code is for interacting with an inventory item?

 

i was hoping it would be as simple as this... but its not

 

 

if (inventory.contains("Bird's Nest")){
item.interact("Search");
}
Link to comment
Share on other sites

 

title says it all really, ive been searching the API for about an hour now but cant figure out how to put the code together... can anyone tell me what the code is for interacting with an inventory item?

 

i was hoping it would be as simple as this... but its not

if (inventory.contains("Bird's Nest")){
item.interact("Search");
}
if(inventory.contains("Bird's Nest")){

 inventory.getItem("Bird's Nest").interact("Search");
  //sleep

}
Edited by Isolate
Link to comment
Share on other sites

if(inventory.contains("Bird's Nest")){

 inventory.getItem("Bird's Nest").interact("Search");
  //sleep

}

 

this actually doesnt work... just figured out the nest after its been searched is still called Bird nest... how can i go about using IDs?

 

private int[] NEST_ID = {5070,5071,5072,5073,5074,5075};

 

i have the in but just dont know how to implement it

Link to comment
Share on other sites

this actually doesnt work... just figured out the nest after its been searched is still called Bird nest... how can i go about using IDs?

 

private int[] NEST_ID = {5070,5071,5072,5073,5074,5075};

 

i have the in but just dont know how to implement it

 

same 


private int[] NEST_ID = {5070,5071,5072,5073,5074,5075};

if(inventory.contains(NEST_ID)){

 inventory.getItem(NEST_ID).interact("Search");
  //sleep

}

or

Item nest = script.inventory.getItem(new Filter<Item>() {
        @Override
        public boolean match(Item item) {
            return item.getName().equalsIgnoreCase("Bird's Nest")&& item.getActions()[0].equalsIgnoreCase("Search");
        }
    });
        
        if(nest != null){
            nest.interact("Search");
            //sleep
        }

there's lots of ways of doing this, but ID's should work well for what you want

Edited by Isolate
Link to comment
Share on other sites

same

private int[] NEST_ID = {5070,5071,5072,5073,5074,5075};if(inventory.contains(NEST_ID)){ inventory.getItem(NEST_ID).interact("Search");  //sleep}
or
Item nest = script.inventory.getItem(new Filter<Item>() {        @Override        public boolean match(Item item) {            return item.getName().equalsIgnoreCase("Bird's Nest")&& item.getActions()[0].equalsIgnoreCase("Search");        }    });                if(nest != null){            nest.interact("Search");            //sleep        }
there's lots of ways of doing this, but ID's should work well for what you want

Ah thanks a lot :)

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