Jump to content

Picking Up Items


Speakmore

Recommended Posts

Hey guys, I'm currently working on my first ever script and I've run into a roadblock.

I would like to know how to pick up items on the ground, and then the next closest, until my inventory is filled.

For example:

If I was making a script that sat at cows and picked up Cowhides. I would like to know how to pick that cowhide up and the next closest one, until 28.

But I don't want the raw meat or bones!!

Thanks

Link to comment
Share on other sites

When the API (located on the top banner) is seemingly fixed, look over it. It has documentation on how each method within the API works, along with the required parameters. You could also import it into your IDE if you so wished, but that's a little extreme for your situation. But right now that's all I have to to suggest to you before I pass out on my bed. 

 

-Night all.

Edited by Brainfree
Link to comment
Share on other sites

When the API (located on the top banner) is seemingly fixed, look over it. It has documentation on how each method within the API works, along with the required parameters. You could also import it into your IDE if you so wished, but that's a little extreme for your situation. But right now that's all I have to to suggest to you before I pass out on my bed. 

 

-Night all.

Believe me, I looked it over. For a solid 2 hours, couldn't get it to work.

Please note, I started scripting today, so I don't know a lot !

Link to comment
Share on other sites

Believe me, I looked it over. For a solid 2 hours, couldn't get it to work.

Please note, I started scripting today, so I don't know a lot !

 

Look over scripts on the forms, it's how I first started out. Even if it's honest Copy and Pasting, if it works, it works. But I'm sure you're more for the knowledge, so I would suggest studying multiple implementations of your desired methods, and see how there used, and how they are structured into any given script.

Edited by Brainfree
Link to comment
Share on other sites

Look over scripts on the forms, it's how I first started out. Even if it's honest Copy and Pasting, if it works, it works. But I'm sure you're more for the knowledge, so I would suggest studying multiple implementations of your desired methods, and see how there used, and structured into any given script.

I'll be glad to check again, but is there any scripts that pick up items.

I'll go look, I think we may have a chicken killer... Let me check!!!

Link to comment
Share on other sites

Haven't tested it yet but this might work

 

 

 

closestGroundItem(ID).interact("Take") 

 

Okay, so I used what you typed out here, with some if's however, and the only thing I'm noticing is that:

It'll actually walk by like 6+ of the items, to go pick up one that is definitely further away than the 6+ it walks over XD

 

So that really is slowing down the process, not to mention the amount of miss-clicks on the item is a killer too -___-

 

Is there any way to make it not miss-click the item, I mean....

Here is my code:

 

if(!client.getInventory().isFull()){            log("Picking Item.")            closestGroundItem(item).getPosition()            if(client.getMyPlayer().getPosition().distance(closestGroundItem(item).getPosition()) < 2){                closestGroundItem(item).interact("Take")            }else{            walk(closestGroundItem(item).getPosition())            return 1000            }        }        if(client.getInventory().isFull()){            log("Are you serious.")            state = State.TODOOR            return 1000        }

I replaced the actual item with "item" so no one makes the script ^_^

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