Jump to content
Guest Apogee

Detect ground items by name

Recommended Posts

Guest Apogee

I'm looking to detect "pickaxe head"

I've done this.

String pickhead; -- under class

 

pickhead = "Pickaxe Head"; -- in "onLoop"
 

if (client.getGroundItemDeques().equals(pickhead)) {
log("i have detected a pickaxe head on the ground.");  -- in "onLoop"
}
 

If i am doing this wrong, please let me know. :)


 

Link to comment
Share on other sites

Guest Apogee

 

Use this:

	public GroundItem getGroundItem(String name) {
		for(GroundItem item : client.getCurrentRegion().getItems()) {
			if(item != null) {
				if(item.getName().equalsIgnoreCase(name)) {
					return item;
				}
			}
		}
		return null;
	}

hmmm, thanks for clarifying. I sort of understand this, Here's what i got:

 

	public GroundItem getGroundItem(String name) {
		
		pickhead = "Pickaxe head";
		for(GroundItem item : client.getCurrentRegion().getItems()) {
			if(item != null) {
				if(item.getName().equalsIgnoreCase(pickhead)) {
					return item;
				}
			}
		}
		return null;
	}

-- Does it matter where i put that? I have it above "onLoop()"


and this at the top under script {

String pickhead;
Edited by Bitter
Link to comment
Share on other sites

Guest Apogee

 

i just use

GroundItem hooters = closestGroundItemForName("Hooters");
if(hooters != null) {
if(hooters.isVisible()) {
hooters.interact("Squeeze");
} else {
client.moveCameraToEntity(hooters);
}

To pick up the item, would i use this?:

hooters.interact("Take");

And yes, i know to change hooters to my variables and things. Just unsure if what you have here will work for picking up a ground item and using it on the (equipped) pickaxe handle.

Edited by Bitter
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...